pg_ctl: directory "/var/lib/postgresql/10/main" is not a database cluster directory

I'm following this guide to do a replica server using postgres, I already made everything in a shell to automate it and seems fine, until I get to this command

pg_basebackup -h 192.168.1.103 -D /var/lib/postgresql/10/main -P -U replication

which I rewrote as

sudo -H -u postgres bash -c "pg_basebackup -h 192.168.1.103 -D /var/lib/postgresql/10/main/ -P -U replication"

However right when my shell gets to run that command linux suddenly just keeps working... for around 3 minutes until it gives up, the shell resumes the script and ends the job, needless to say the command that gets stuck didn't get me the folder I was asking on from the primary server to the secondary server, the postgres log file shows me this:

pg_ctl: directory "/var/lib/postgresql/10/main" is not a database cluster directory

Running

pg_lsclusters

gets me

 Ver Cluster Port Status Owner Data directory Log file 10 main 5433 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log

So I'm clueless of what to do next since I can't find information about this error online

However I'm clueless of what to do next

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like