После завершения настройки репликации сервер репликации не запускается только для чтения.
ОБНОВИТЬ
2020-08-12 17:32:18.733 UTC [20767] LOG: shutting down
2020-08-12 17:32:18.738 UTC [20743] LOG: database system is shut down
2020-08-12 17:56:52.918 UTC [21030] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-08-12 17:56:52.918 UTC [21030] LOG: listening on IPv6 address "::", port 5432
2020-08-12 17:56:52.919 UTC [21030] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-08-12 17:56:52.933 UTC [21031] LOG: database system was interrupted; last known up at 2020-08-12 17:53:00 UTC
2020-08-12 17:56:52.953 UTC [21031] LOG: entering standby mode
2020-08-12 17:56:52.971 UTC [21032] LOG: started streaming WAL from primary at 353/40000000 on timeline 1
2020-08-12 17:56:52.971 UTC [21032] FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000010000035300000040 has already been removed
2020-08-12 17:56:52.985 UTC [21033] LOG: started streaming WAL from primary at 353/40000000 on timeline 1
2020-08-12 17:56:52.985 UTC [21033] FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000010000035300000040 has already been removed
Я внес следующие изменения в файл postgresql.conf на главном компьютере.
Настроить главный узел
CREATE USER rep REPLICATION LOGIN CONNECTION LIMIT 1 ENCRYPTED PASSWORD 'xxxxx';
Изменен pg_hba.conf на главном узле.
host replication rep IP_address_of_slave/32 md5
Изменен postgressql.conf на главном узле
listen_addresses = 'localhost,IP_address_of_THIS_host'
wal_level = 'hot_standby'
archive_mode = on
archive_command = 'cd .'
max_wal_senders = 1
hot_standby = on
Перезагрузили главный сервер, чтобы изменения вступили в силу.
Настроен подчиненный сервер
Остановил раба
Открыл pg_hba.conf
vim pg_hba.conf
Добавлен главный узел
host replication rep IP_address_of_master/32 md5
Добавлен в postgresql.conf подчиненного устройства
listen_addresses = '*'
wal_level = 'hot_standby'
archive_mode = on
archive_command = 'cd .'
max_wal_senders = 1
hot_standby = on
На хозяине
psql -c "select pg_start_backup('initial_backup');"
Теперь запустили процесс rsync
env -i sh -c "rsync -av --exclude=*pg_xlog* --progress -e 'ssh ' /var/lib/postgresql/10/main postgres@xxx.31.17.xxx:/var/lib/postgresql/10/"
остановил резервное копирование на главном узле
select pg_stop_backup();
Создал файл рекавери на раб
standby_mode = 'on'
primary_conninfo = 'host=master_IP_address port=5432 user=rep password=yourpassword'
trigger_file = '/tmp/postgresql.trigger.5432'
Удалил файл backup_label
Начал раб