【发布时间】:2020-06-08 21:51:32
【问题描述】:
Postgresql 数据库复制有两台服务器,一台用于主服务器,另一台用于从服务器。由于某种原因,主 IP 地址已更改,该地址已在从服务器的多个位置使用。使用新的 IP 地址,在从服务器中用最新的 IP 地址替换旧 IP 地址后,复制无法像以前一样工作。有人可以帮助解决这个问题吗? 以下是设置从服务器的步骤:
1.在pg_hba.conf文件中添加用户复制的主IP地址
nano /etc/postgresql/11/main/pg_hba.conf host
replication master-IP/24 md5
2.modify the following lines in the PostgreSQL.conf file of slave server where listen_addresses should be the IP of the slave server
nano /etc/postgresql/11/main/postgresql.conf
listen_addresses = 'localhost,slave-IP'
wal_level = replica
max_wal_senders = 10
wal_keep_segments = 64
3. Take the backup of the master server by entering the IP
pg_basebackup -h master-ip -D /var/lib/postgresql/11/main/ -P -U
replication --wal-method=fetch
4.create a recovery file and adding the following commands
standby_mode = 'on'
primary_conninfo = 'host=master-ip port=5432 user=replication password= '
trigger_file = '/tmp/MasterNow'
以下是日志文件中的错误:
started streaming WAL from primary at A/B3000000 on timeline 2
FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000020000000A000000B3 has already been removed
FATAL: could not connect to the primary server: could not connect to server: Connection timed out
Is the server running on host "master ip" and accepting
TCP/IP connections on port 5432?
record with incorrect prev-link 33018C00/0 at 0/D8E15D18
【问题讨论】:
标签: postgresql database-replication master-slave