pg_basebackup failing from another server
-
13-02-2021 - |
سؤال
I want to take backup of my PostgreSQL database cluster from another server. I'm using below command ,from another server:
[root@shiwangini2 pgsql]# sudo -u postgres pg_basebackup -h 192.168.XX.XX -p 5432 -Ft -D /var/lib/pgsql/db_file_backup
However, I'm getting below message after running this:
[root@shiwangini2 pgsql]# sudo -u postgres pg_basebackup -h
192.168.XX.XX -p 5432 -Ft -D /var/lib/pgsql/db_file_backup
Password:
pg_basebackup: could not get write-ahead log end position from server: ERROR: could not open file "./pg_hba.conf": Permission denied pg_basebackup: removing contents of data directory "/var/lib/pgsql/db_file_backup"
In order to fix this,after googling I updated my server's pg_hba.conf file like below,to allow connections from outside:
host all all 0.0.0.0/0
md5
host all all ::/0 md5
After that I restarted PotgreSQL services. And again, when I'm trying to backup it from another server, I'm still getting the same error. Please let me know if anything wrong I'm making here. Or any other way to take backup from another server.
المحلول
What are the permissions set on the file pg_hba.conf
?
Does the postgres user have the ability to read it?
Here is my configuration:
-rw-------. 1 postgres postgres 4334 Apr 4 22:14 ./pg_hba.conf
نصائح أخرى
In order to fix these kind of errors, first I have got allowed connections from another servers and then I realized by mistake, I have updated pg_hba.conf file with "root" user login..Later on, I created the same file with "postgres" user and then the problem got fixed.