PostgresXL pgxc_ctl connection refused when adding coordinator - postgres-xl

Following tutorial on https://github.com/bitnine-oss/postgres-xl-ha/blob/master/README.md, I get the following error when trying to add coordinator (using pgxc_ctl):
Actual Command:
PGXC add coordinator master coord komp2 30001 30011 none none none
Bring remote stdout:
ssh aaron#komp2 "( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord --nodename coord ) > /tmp/skripsi_STDOUT_17620_12 2>&1" < /dev/null > /dev/null 2>&1
scp aaron#komp2:/tmp/skripsi_STDOUT_17620_12 /tmp/STDOUT_17620_13 > /dev/null 2>&1
The files belonging to this database system will be owned by user "aaron".
This user must also own the server process.
initdb: invalid locale settings; check LANG and LC_* environment variables
bash: /home/aaron/DATA/pgxl/nodes/coord/postgresql.conf: No such file or directory
bash: /home/aaron/DATA/pgxl/nodes/coord/pg_hba.conf: No such file or directory
ERROR: failed to find any running coordinatorStarting coordinator master coord
pg_ctl: directory "/home/aaron/DATA/pgxl/nodes/coord" does not exist
Done.
psql: could not connect to server: Connection refused
Is the server running on host "komp2" (192.168.38.21) and accepting
TCP/IP connections on port 30001?
What probably cause it? Thanks in advance

Related

How to send the data to TCP PORT using shell script commands

I’m looking for a solution to send the data from a file to the TCP port which is available on the specific server using the shell script/Unix command.
When I checking for this option I found the below one but it’s not working out? Is there any solution is available?
The command I tried from a shell script and find the response below.
Option 1: exec cat /home/data/load.txt > /dev/tcp/$host/$port
-bash: : Name or service not known
-bash: /dev/tcp//: Invalid argument
Option 2:
ncat -v -w 2 hostname 4053 < /home/data/test.txt
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to xx.xx.xx.xx:4053.
Ncat: Connection reset by peer.
It would be helpful if could someone help with this.
Thanks | SP

psql is not connecting to the localhost if listen_address is different

I am trying to fetch some data using psql command. If I run the command directly in the console its working fine. The same command if I try to run from shell script, it says unable to connect to psql server. I have checked the listen_address variable in postgresql.conf, as I expected it was set to some name instead of * or localhost.
This server is running under cluster environment, so its using virtual ip in listen_address. The pg_hba.conf allowing local (IPv4 and IPv6) with trust authentication.
It makes sense to me so far. But, I'm confused why it isn't allowing through shell script on same server?
Edit 1:
myuser # psql -d mydb -U postgres -c "select 1"
?column?
----------
1
(1 row)
myuser # cat myscript.sh
psql -d mydb -U postgres -c "select 1"
myuser # sh myscript.sh
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?

capture plink failed connection messages to file [duplicate]

This question already has answers here:
How to redirect Windows cmd stdout and stderr to a single file?
(7 answers)
Closed last year.
I am using plink in windows to connect to a network device and capture the output to a file. That part works great.
Here is an example of the command line I am putting in a batch program.
plink.exe -v -l [username] -pw [password] [ip address] -m "c:\empty.txt" < "c:\commands.txt" > "c:\command_output.txt"
command_output.txt only contains the output from the ssh session.
I want to add some error handling in case it cannot connect for example. I can't figure out how to get the connection messages to go to a file. They go to the command window only. I have tried using start /c cmd.exe from another batch program and redirectiong that output to another log file. Tried using 2>&1. I get nothing. It always just goes to the command window.
Here is and example of what I want to capture.
Looking up host "xxx.xxx.xxx.xxx"
Connecting to xxx.xxx.xxx.xxx port 22
Failed to connect to xxx.xxx.xxx.xxx: Network error: Connection timed out
Network error: Connection timed out
FATAL ERROR: Network error: Connection timed out
So, to sum up use the command below. I'm incorporating #Martin Prikryl's suggestion into an answer so this shows as answered.
plink.exe -v -l [username] -pw [password] [ip address] -m "c:\empty.txt" < "c:\commands.txt" > "c:\command_output.txt" 2>&1

Transfer files without LFTP hanging

I want to transfer a file using LFTP.
Connection Type: Passive connection Implicit SSL
Protocol: FTPS
Steps followed by me:
-bash-4.1$ set ftp:ssl-protect-data true
-bash-4.1$ set ftps:initial-prot
-bash-4.1$ set ftp:ssl-force true
-bash-4.1$ set ftp:ssl-protect-data true
-bash-4.1$ set ssl:verify-certificate off
-bash-4.1$ lftp
lftp :~> open ftps.host.com
lftp ftps.host.com:~> user u001
Password:
lftp u001#ftps.host.com:~> pwd
ftp://u001#ftps.host.com
lftp u001#ftps.host.com:~> ls
Interrupt
lftp u001#ftps.host.com:~> cd folderName
Interrupt
lftp u001#ftps.host.com:~> ls -ltr
`ls -ltr' at 0 [Connecting...]
Telnet is connecting & working but LFTP seems to hang. Can anybody please provide a solution to this?
lftp seems to be unable to connect to the server. You can use debug command to enable verbose messages and see what happens in detail. One of possible reasons is an incorrect port number to connect to. You can specify a port number explicitly by -p NNN option to open command, or just use open ftp://u001#ftps.host.com:NNN where NNN is the port number.
BTW, the set commands should be given inside lftp.

shrewsoft command line interface to connect and terminate vpn on ubuntu

Shrewsoft [1] provides a command line interface for setting up the vpn tunnel automatically without any user intervention, such as by using the following command
ikec -u username -p password -r configuration -a
IS there any way to detect if the connect attempt was successful such as by reading live logs and how can we terminate the vpn tunnel after some time using the command line. Any help will be appreciable.
By looking at the terminal output from ikec -u username -p password -r configuration -a, you can tell if the connection was successful; if the output has a line ii : tunnel enabled, that means the connection was successful and should work. If you get a message such as >> : detached from key daemon or failed to connect to key daemon, it means there was a problem with the connection (https://askubuntu.com/a/793336/705434 suggests running sudo /usr/sbin/iked for a solution to this particular error). To exit the ikec command, just type q into the terminal.
EDIT: it looks like this page (https://gist.github.com/fschabmeyer/22b759994cf852df7e9b) has a shell script that can handle the detection, you should be able to add a case to exit the command automatically after a certain amount of time.

Resources