高可用测试,主库关机后,再开启,pg list pg-test无法同步到从库信息 Failed to drop replication slot 'pg_test_1
主库:172.28.100.207 从库 :172.28.100.208、172.28.100.216
主库pg-test重新起来后的日志,此时日志的时间是错乱的,正常的应该早8小时,但是时间过断时间会正常:
主库日志
2022-09-21 22:12:06 +0800 INFO: Deregister service pg-test/pg-test-1 2022-09-21 22:12:06 +0800 INFO: running pg_rewind from pg-test-2 2022-09-21 22:12:06 +0800 INFO: running pg_rewind from dbname=postgres user=replicator host=172.28.100.208 port=5432 target_session_attrs=read-write 2022-09-21 22:12:07 +0800 INFO: pg_rewind exit code=0 2022-09-21 22:12:07 +0800 INFO: stdout= 2022-09-21 22:12:07 +0800 INFO: stderr=pg_rewind: servers diverged at WAL location 0/4006B78 on timeline 5 pg_rewind: rewinding from last common checkpoint at 0/4006AC8 on timeline 5 pg_rewind: Done!
2022-09-21 22:12:07 +0800 WARNING: Postgresql is not running. 2022-09-21 22:12:07 +0800 INFO: Lock owner: pg-test-2; I am pg-test-1 2022-09-21 22:12:07 +0800 INFO: pg_controldata: pg_control version number: 1300 Catalog version number: 202107181 Database system identifier: 7145386086991413439 Database cluster state: in archive recovery pg_control last modified: Wed Sep 21 14:10:09 2022 Latest checkpoint location: 0/4006D78 Latest checkpoint's REDO location: 0/4006D40 Latest checkpoint's REDO WAL file: 000000060000000000000004 Latest checkpoint's TimeLineID: 6 Latest checkpoint's PrevTimeLineID: 6 Latest checkpoint's full_page_writes: on Latest checkpoint's NextXID: 0:975 Latest checkpoint's NextOID: 24576 Latest checkpoint's NextMultiXactId: 1 Latest checkpoint's NextMultiOffset: 0 Latest checkpoint's oldestXID: 726 Latest checkpoint's oldestXID's DB: 1 Latest checkpoint's oldestActiveXID: 975 Latest checkpoint's oldestMultiXid: 1 Latest checkpoint's oldestMulti's DB: 1 Latest checkpoint's oldestCommitTsXid: 733 Latest checkpoint's newestCommitTsXid: 974 Time of latest checkpoint: Wed Sep 21 14:10:09 2022 Fake LSN counter for unlogged rels: 0/3E8 Minimum recovery ending location: 0/4033630 Min recovery ending loc's timeline: 6 Backup start location: 0/0 Backup end location: 0/0 End-of-backup record required: no wal_level setting: logical wal_log_hints setting: on max_connections setting: 100 max_worker_processes setting: 8 max_wal_senders setting: 10 max_prepared_xacts setting: 0 max_locks_per_xact setting: 64 2022-09-21 22:12:07 +0800 INFO: Lock owner: pg-test-2; I am pg-test-1 2022-09-21 22:12:07 +0800 INFO: Deregister service pg-test/pg-test-1 2022-09-21 22:12:07 +0800 INFO: starting as a secondary 2022-09-21 22:12:08 +0800 INFO: postmaster pid=1504 2022-09-21 22:12:09 +0800 INFO: Lock owner: pg-test-2; I am pg-test-1 2022-09-21 22:12:09 +0800 INFO: establishing a new patroni connection to the postgres cluster 2022-09-21 22:12:09 +0800 INFO: Register service pg-test, params {'service_id': 'pg-test/pg-test-1', 'address': '172.28.100.207', 'port': 5432, 'check': {'http': 'http://172.28.100.207:8008/replica', 'interval': '15s', 'DeregisterCriticalServiceAfter': '150.0s'}, 'tags': ['pg-test', 'replica'], 'enable_tag_override': True} 2022-09-21 22:12:09 +0800 INFO: no action. I am (pg-test-1), a secondary, and following a leader (pg-test-2) 2022-09-21 22:12:20 +0800 INFO: no action. I am (pg-test-1), a secondary, and following a leader (pg-test-2) 2022-09-21 14:12:30 +0800 INFO: no action. I am (pg-test-1), a secondary, and following a leader (pg-test-2) 2022-09-21 14:22:32 +0800 INFO: Register service pg-test, params {'service_id': 'pg-test/pg-test-1', 'address': '172.28.100.207', 'port': 5432, 'check': {'http': 'http://172.28.100.207:8008/replica', 'interval': '15s', 'DeregisterCriticalServiceAfter': '150.0s'}, 'tags': ['pg-test', 'replica'], 'enable_tag_override': True} 2022-09-21 14:22:32 +0800 INFO: Lock owner: pg-test-2; I am pg-test-1 2022-09-21 14:22:32 +0800 INFO: Register service pg-test, params {'service_id': 'pg-test/pg-test-1', 'address': '172.28.100.207', 'port': 5432, 'check': {'http': 'http://172.28.100.207:8008/replica', 'interval': '15s', 'DeregisterCriticalServiceAfter': '150.0s'}, 'tags': ['pg-test', 'replica'], 'enable_tag_override': True} 2022-09-21 14:22:32 +0800 INFO: no action. I am (pg-test-1), a secondary, and following a leader (pg-test-2)
从库日志:
2022-09-21 14:13:10 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:13:10 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:13:10 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:13:20 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:13:20 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:13:20 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:13:30 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:13:30 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:13:30 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:13:40 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:13:40 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:13:40 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:13:50 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:13:50 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:13:50 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:00 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:00 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:00 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:10 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:10 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:10 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:20 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:20 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:20 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:30 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:30 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:30 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:40 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:40 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:40 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:14:50 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:14:50 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:14:50 +0800 INFO: no action. I am (pg-test-2), the leader with the lock 2022-09-21 14:15:00 +0800 INFO: Lock owner: pg-test-2; I am pg-test-2 2022-09-21 14:15:00 +0800 ERROR: Failed to drop replication slot 'pg_test_1' 2022-09-21 14:15:00 +0800 INFO: no action. I am (pg-test-2), the leader with the lock
此时,pg list pg-test无法查询到重启的原主库节点
此时重启:patroni后正常
是否是因为patroni服务的顺序问题所导致