当前位置:   article > 正文

【PG】PostgreSQL高可用 之repmgr常用命令_pg16高可用

pg16高可用

注册 / 取消注册(register)

  1. repmgr -f /etc/repmgr.conf primary register
  2. repmgr -f /etc/repmgr.conf standby register
  3. repmgr -f /etc/repmgr.conf primary unregister -F --node-id=2
  4. repmgr -f /etc/repmgr.conf standby  unregister

克隆主库(repmgr standby clone)

克隆之前进行检查

 repmgr -h 10.79.21.29 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --dry-run

真实执行 

  1. $repmgr -h 10.79.21.30 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone
  2. NOTICE: destination directory "/home/storage/pgsql/data" provided
  3. INFO: connecting to source node
  4. DETAIL: connection string is: host=10.79.21.30 user=repmgr dbname=repmgr
  5. DETAIL: current installation size is 115 MB
  6. INFO: replication slot usage not requested; no replication slot will be set up for this standby
  7. NOTICE: checking for available walsenders on the source node (2 required)
  8. NOTICE: checking replication connections can be made to the source server (2 required)
  9. INFO: checking and correcting permissions on existing directory "/home/storage/pgsql/data"
  10. NOTICE: starting backup (using pg_basebackup)...
  11. HINT: this may take some time; consider using the -c/--fast-checkpoint option
  12. INFO: executing:
  13. /usr/local/pgsql/bin/pg_basebackup -l "repmgr base backup" -D /home/storage/pgsql/data -h 10.79.21.30 -p 5432 -U repmgr -X stream
  14. NOTICE: standby clone (using pg_basebackup) complete
  15. NOTICE: you can now start your PostgreSQL server
  16. HINT: for example: /usr/local/pgsql/bin/pg_ctl -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log start
  17. HINT: after starting the server, you need to register this standby with "repmgr standby register"

提升从库为主 (repmgr standby promote)

场景

如果主服务器发生故障或需要从复制集群中删除,则必须指定新的主服务器,以确保集群继续正常运行。可以通过repmgr standby promote 来完成,它将当前服务器上的备用服务器提升为主服务器。

查看状态

  1. $repmgr -f /etc/repmgr.conf cluster show
  2. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
  3. ----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------
  4. 1 | node1 | primary | * running | | default | 100 | 3 | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  5. 2 | node2 | standby | running | node1 | default | 100 | 3 | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

停止主库 

 pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop

再次查看状态(从节点)

  1. $repmgr -f /etc/repmgr.conf cluster show
  2. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
  3. ----+-------+---------+---------------+----------+----------+----------+----------+------------------------------------------------------------------------
  4. 1 | node1 | primary | ? unreachable | ? | default | 100 | | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  5. 2 | node2 | standby | running | ? node1 | default | 100 | 3 | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  6. WARNING: following issues were detected
  7. - unable to connect to node "node1" (ID: 1)
  8. - node "node1" (ID: 1) is registered as an active primary but is unreachable
  9. - unable to connect to node "node2" (ID: 2)'s upstream node "node1" (ID: 1)
  10. - unable to determine if node "node2" (ID: 2) is attached to its upstream node "node1" (ID: 1)
  11. HINT: execute with --verbose option to see connection error messages

提升从节点(在从节点上执行)

repmgr -f /etc/repmgr.conf standby promote --log-level=debug --verbose

如果想查看详细的日志输出 可以添加 --log-level=debug --verbose

  1. $repmgr -f /etc/repmgr.conf standby promote --log-level=debug --verbose
  2. NOTICE: using provided configuration file "/etc/repmgr.conf"
  3. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
  4. DEBUG: set_config():
  5. SET synchronous_commit TO 'local'
  6. INFO: connected to standby, checking its state
  7. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  8. DEBUG: get_node_record():
  9. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.node_id = 2
  10. INFO: searching for primary node
  11. DEBUG: get_primary_connection():
  12. SELECT node_id, conninfo, CASE WHEN type = 'primary' THEN 1 ELSE 2 END AS type_priority FROM repmgr.nodes WHERE active IS TRUE AND type != 'witness' ORDER BY active DESC, type_priority, priority, node_id
  13. INFO: checking if node 1 is primary
  14. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
  15. ERROR: connection to database failed
  16. DETAIL:
  17. could not connect to server: Connection refused
  18. Is the server running on host "10.79.21.30" and accepting
  19. TCP/IP connections on port 5432?
  20. DETAIL: attempted to connect using:
  21. user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path=
  22. INFO: checking if node 2 is primary
  23. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
  24. DEBUG: set_config():
  25. SET synchronous_commit TO 'local'
  26. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  27. DEBUG: get_node_replication_stats():
  28. SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers, current_setting('max_replication_slots')::INT AS max_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical') AS active_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots, pg_catalog.pg_is_in_recovery() AS in_recovery
  29. DEBUG: get_active_sibling_node_records():
  30. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.upstream_node_id = 1 AND n.node_id != 2 AND n.active IS TRUE ORDER BY n.node_id
  31. DEBUG: clear_node_info_list() - closing open connections
  32. DEBUG: clear_node_info_list() - unlinking
  33. DEBUG: get_node_record():
  34. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.node_id = 2
  35. NOTICE: promoting standby to primary
  36. DETAIL: promoting server "node2" (ID: 2) using pg_promote()
  37. NOTICE: waiting up to 60 seconds (parameter "promote_check_timeout") for promotion to complete
  38. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  39. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  40. INFO: standby promoted to primary after 1 second(s)
  41. DEBUG: setting node 2 as primary and marking existing primary as failed
  42. DEBUG: begin_transaction()
  43. DEBUG: commit_transaction()
  44. NOTICE: STANDBY PROMOTE successful
  45. DETAIL: server "node2" (ID: 2) was successfully promoted to primary
  46. DEBUG: _create_event(): event is "standby_promote" for node 2
  47. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  48. DEBUG: _create_event():
  49. INSERT INTO repmgr.events ( node_id, event, successful, details ) VALUES ($1, $2, $3, $4) RETURNING event_timestamp
  50. DEBUG: _create_event(): Event timestamp is "2023-11-15 19:31:25.636843+08"
  51. DEBUG: clear_node_info_list() - closing open connections
  52. DEBUG: clear_node_info_list() - unlinking

查看状态 

  1. $repmgr -f /etc/repmgr.conf cluster show
  2. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
  3. ----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------
  4. 1 | node1 | primary | - failed | ? | default | 100 | | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  5. 2 | node2 | primary | * running | | default | 100 | 4 | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  6. WARNING: following issues were detected
  7. - unable to connect to node "node1" (ID: 1)
  8. HINT: execute with --verbose option to see connection error messages

孤立的备用服务器成为新主的从(repmgr standby follow)

场景

在复制集群的现有主服务器发生故障或删除之后,repmgr standby follow可用于使“孤立”备用服务器成为新的主服务器的从 并追赶上其当前状态

repmgr -f /etc/repmgr.conf standby follow

计划内切换(repmgr  standby swtichover)

场景

在某些情况下,需要以有计划的方式提升备用数据库,例如,主数据库上需要执行维护;repmgr  standby swtichover 命令支持这种切换。

repmgr standby switchover与其他repmgr 操作的不同之处在于,它还在其他服务器(降级候选服务器,以及可选的任何遵循新主服务器的其他服务器)上执行操作,这意味着从执行的服务器到这些服务器需要无密码 SSH 访问 。

查看状态

repmgr -f /etc/repmgr.conf cluster show

  1. $repmgr -f /etc/repmgr.conf cluster show
  2. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
  3. ----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------
  4. 1 | node1 | primary | * running | | default | 100 | 1 | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  5. 2 | node2 | standby | running | node1 | default | 100 | 1 | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

准备切换

切换操作的成功取决于 repmgr能否快速、干净地关闭当前主服务器。

确保被升级的候选者有足够的空闲 walsender 可用(PostgreSQL 配置项max_wal_senders),并且如果复制槽正在使用中,则至少有一个空闲槽可用于降级候选者(PostgreSQL 配置项max_replication_slots)。

确保可以从升级候选者(standby)到降级候选者(current primary)进行无密码 SSH 连接。如果--siblings-follow 使用,请确保被从升级的候选者到附加到降级候选者的所有节点(包括 witness server,如果正在使用)可以进行无密码 SSH 连接。

再次检查哪些命令将用于停止/启动/重新启动当前主节点

  1. repmgr -f /etc/repmgr.conf node service --list-actions --action=stop
  2. repmgr -f /etc/repmgr.conf node service --list-actions --action=start
  3. repmgr -f /etc/repmgr.conf node service --list-actions --action=restart

执行前检查

repmgr standby switchover使用 --dry-run选项执行前检查;这将执行任何必要的检查并通知成功/失败,并在运行第一个实际命令(关闭当前的主节点)之前停止

repmgr standby switchover -f /etc/repmgr.conf --dry-run --verbose --log-level=debug

  1. $repmgr standby switchover -f /etc/repmgr.conf --dry-run --verbose --log-level=debug
  2. NOTICE: using provided configuration file "/etc/repmgr.conf"
  3. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
  4. DEBUG: set_config():
  5. SET synchronous_commit TO 'local'
  6. DEBUG: get_node_record():
  7. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.node_id = 2
  8. NOTICE: checking switchover on node "node2" (ID: 2) in --dry-run mode
  9. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  10. INFO: searching for primary node
  11. DEBUG: get_primary_connection():
  12. SELECT node_id, conninfo, CASE WHEN type = 'primary' THEN 1 ELSE 2 END AS type_priority FROM repmgr.nodes WHERE active IS TRUE AND type != 'witness' ORDER BY active DESC, type_priority, priority, node_id
  13. INFO: checking if node 1 is primary
  14. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
  15. DEBUG: set_config():
  16. SET synchronous_commit TO 'local'
  17. DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
  18. INFO: current primary node is 1
  19. DEBUG: get_node_record():
  20. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.node_id = 1
  21. DEBUG: remote node name is "node1"
  22. DEBUG: test_ssh_connection(): executing ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /bin/true 2>/dev/null
  23. INFO: SSH connection to host "10.79.21.30" succeeded
  24. DEBUG: remote_command():
  25. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug --version >/dev/null 2>&1 && echo "1" || echo "0"
  26. DEBUG: remote_command(): output returned was:
  27. 1
  28. DEBUG: remote_command():
  29. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug --version 2>/dev/null
  30. DEBUG: remote_command(): output returned was:
  31. repmgr 5.3.3
  32. DEBUG: "repmgr" version on "10.79.21.30" is 50303
  33. DEBUG: remote_command():
  34. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 test -f /etc/repmgr.conf && echo 1 || echo 0
  35. DEBUG: remote_command(): output returned was:
  36. 1
  37. DEBUG: remote_command():
  38. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug node check --data-directory-config --optformat -LINFO 2>/dev/null
  39. DEBUG: remote_command(): output returned was:
  40. --configured-data-directory=OK
  41. INFO: able to execute "repmgr" on remote host "10.79.21.30"
  42. DEBUG: remote_command():
  43. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug node check --replication-config-owner --optformat -LINFO 2>/dev/null
  44. DEBUG: remote_command(): output returned was:
  45. --replication-config-owner=OK
  46. DEBUG: get_node_replication_stats():
  47. SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers, current_setting('max_replication_slots')::INT AS max_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical') AS active_replication_slots, (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots, pg_catalog.pg_is_in_recovery() AS in_recovery
  48. DEBUG: get_active_sibling_node_records():
  49. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n WHERE n.upstream_node_id = 1 AND n.node_id != 2 AND n.active IS TRUE ORDER BY n.node_id
  50. DEBUG: clear_node_info_list() - closing open connections
  51. DEBUG: clear_node_info_list() - unlinking
  52. INFO: 1 walsenders required, 10 available
  53. DEBUG: remote_command():
  54. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug node check --remote-node-id=2 --replication-connection
  55. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
  56. DEBUG: remote_command(): output returned was:
  57. --connection=OK
  58. INFO: demotion candidate is able to make replication connection to promotion candidate
  59. DEBUG: guc_set():
  60. SELECT true FROM pg_catalog.pg_settings WHERE name = 'archive_mode' AND setting != 'off'
  61. DEBUG: remote_command():
  62. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug node check --terse -LERROR --archive-ready --optformat
  63. DEBUG: remote_command(): output returned was:
  64. --status=OK --files=0
  65. INFO: 0 pending archive files
  66. DEBUG: get_replication_lag_seconds():
  67. SELECT CASE WHEN (pg_catalog.pg_last_wal_receive_lsn() = pg_catalog.pg_last_wal_replay_lsn()) THEN 0 ELSE EXTRACT(epoch FROM (pg_catalog.clock_timestamp() - pg_catalog.pg_last_xact_replay_timestamp()))::INT END AS lag_seconds
  68. DEBUG: lag is 0
  69. INFO: replication lag on this standby is 0 seconds
  70. DEBUG: get_all_node_records():
  71. SELECT n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached FROM repmgr.nodes n ORDER BY n.node_id
  72. DEBUG: clear_node_info_list() - closing open connections
  73. DEBUG: clear_node_info_list() - unlinking
  74. NOTICE: attempting to pause repmgrd on 2 nodes
  75. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
  76. DEBUG: set_config():
  77. SET synchronous_commit TO 'local'
  78. DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
  79. DEBUG: set_config():
  80. SET synchronous_commit TO 'local'
  81. NOTICE: local node "node2" (ID: 2) would be promoted to primary; current primary "node1" (ID: 1) would be demoted to standby
  82. DEBUG: remote_command():
  83. ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf -L debug node service --terse -LERROR --list-actions --action=stop
  84. DEBUG: remote_command(): output returned was:
  85. /usr/local/pgsql/bin/pg_ctl -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop
  86. INFO: following shutdown command would be run on node "node1":
  87. "/usr/local/pgsql/bin/pg_ctl -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop"
  88. INFO: parameter "shutdown_check_timeout" is set to 60 seconds
  89. DEBUG: clear_node_info_list() - closing open connections
  90. DEBUG: clear_node_info_list() - unlinking
  91. INFO: prerequisites for executing STANDBY SWITCHOVER are met

执行切换

repmgr -f /etc/repmgr.conf standby switchover 

  1. $repmgr -f /etc/repmgr.conf standby switchover
  2. NOTICE: executing switchover on node "node2" (ID: 2)
  3. NOTICE: attempting to pause repmgrd on 2 nodes
  4. NOTICE: local node "node2" (ID: 2) will be promoted to primary; current primary "node1" (ID: 1) will be demoted to standby
  5. NOTICE: stopping current primary node "node1" (ID: 1)
  6. NOTICE: issuing CHECKPOINT on node "node1" (ID: 1)
  7. DETAIL: executing server command "/usr/local/pgsql/bin/pg_ctl -D '/home/storage/pgsql/data' -W -m fast stop"
  8. INFO: checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")
  9. INFO: checking for primary shutdown; 2 of 60 attempts ("shutdown_check_timeout")
  10. NOTICE: current primary has been cleanly shut down at location 0/10000028
  11. NOTICE: promoting standby to primary
  12. DETAIL: promoting server "node2" (ID: 2) using pg_promote()
  13. NOTICE: waiting up to 60 seconds (parameter "promote_check_timeout") for promotion to complete
  14. NOTICE: STANDBY PROMOTE successful
  15. DETAIL: server "node2" (ID: 2) was successfully promoted to primary
  16. NOTICE: node "node2" (ID: 2) promoted to primary, node "node1" (ID: 1) demoted to standby
  17. NOTICE: switchover was successful
  18. DETAIL: node "node2" is now primary and node "node1" is attached as standby
  19. NOTICE: STANDBY SWITCHOVER has completed successfully

再次查看状态切换成功

  1. [postgres@ehr-db-mysql-test-s01.zjy:/home/storage/repmgr]$repmgr -f /etc/repmgr.conf cluster show
  2. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
  3. ----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------
  4. 1 | node1 | standby | running | node2 | default | 100 | 1 | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=2
  5. 2 | node2 | primary | * running | | default | 100 | 2 | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

报错1 ERROR: unable to execute "repmgr" on "10.79.21.30"

原因 :没有设置pg_bindir参数

解决 : 配置文件添加pg_bindir参数

  1. $repmgr -f /etc/repmgr.conf standby switchover
  2. NOTICE: executing switchover on node "node2" (ID: 2)
  3. ERROR: unable to execute "repmgr" on "10.79.21.30"
  4. HINT: check "pg_bindir" is set to the correct path in "repmgr.conf"; current value: (not set)

报错2 ERROR: shutdown of the primary server could not be confirmed

  1. repmgr -f /etc/repmgr.conf standby switchover
  2. NOTICE: executing switchover on node "node2" (ID: 2)
  3. NOTICE: attempting to pause repmgrd on 2 nodes
  4. NOTICE: local node "node2" (ID: 2) will be promoted to primary; current primary "node1" (ID: 1) will be demoted to standby
  5. NOTICE: stopping current primary node "node1" (ID: 1)
  6. NOTICE: issuing CHECKPOINT on node "node1" (ID: 1)
  7. DETAIL: executing server command "pg_ctl -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop"
  8. INFO: checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")
  9. INFO: checking for primary shutdown; 2 of 60 attempts ("shutdown_check_timeout")
  10. ...
  11. INFO: checking for primary shutdown; 60 of 60 attempts ("shutdown_check_timeout")
  12. ERROR: shutdown of the primary server could not be confirmed
  13. HINT: check the primary server status before performing any further actions

解决:

参数改为绝对路径

service_start_command='/usr/local/pgsql/bin/pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log start'

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/449841
推荐阅读
相关标签
  

闽ICP备14008679号