You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PGPool-II 4.3.2版本if_up_cmd配置无效问题求助

PGPool-II Watchdog虚拟IP未创建问题排查

环境与配置

使用**PGPool-II 4.3.2 (tamahomeboshi)**版本,已开启Watchdog,核心配置如下:

use_watchdog = on
delegate_IP = '10.17.3.158' 
if_up_cmd = '/usr/bin/sudo /sbin/ip addr add $_IP_$/24 dev ens192 label ens192:1'
if_down_cmd = '/usr/bin/sudo /sbin/ip addr del $_IP_$/24 dev ens192'
arping_cmd = '/usr/bin/sudo /usr/sbin/arping -U $_IP_$ -w 1 -I ens192'

问题现象

启动后未达到预期效果:

  • 执行ifconfig检查,未发现配置的虚拟IP(10.17.3.158)
  • 查看pgpool_log,无任何与if_up_cmd相关的日志记录,怀疑该命令未被执行

日志内容

2022-08-16 04:58:59.992: main pid 19939: LOG:  health_check_stats_shared_memory_size: requested size: 12288
2022-08-16 04:58:59.992: main pid 19939: LOG:  memory cache initialized
2022-08-16 04:58:59.992: main pid 19939: DETAIL:  memcache blocks :64
2022-08-16 04:58:59.992: main pid 19939: LOG:  allocating (136981896) bytes of shared memory segment
2022-08-16 04:58:59.992: main pid 19939: LOG:  allocating shared memory segment of size: 136981896 
2022-08-16 04:59:00.169: main pid 19939: LOG:  health_check_stats_shared_memory_size: requested size: 12288
2022-08-16 04:59:00.169: main pid 19939: LOG:  health_check_stats_shared_memory_size: requested size: 12288
2022-08-16 04:59:00.169: main pid 19939: LOG:  memory cache initialized
2022-08-16 04:59:00.169: main pid 19939: DETAIL:  memcache blocks :64
2022-08-16 04:59:00.177: main pid 19939: LOG:  pool_discard_oid_maps: discarded memqcache oid maps
2022-08-16 04:59:00.193: main pid 19939: LOG:  waiting for watchdog to initialize
2022-08-16 04:59:00.193: watchdog pid 19942: LOG:  setting the local watchdog node name to "10.17.3.77:9999 Linux localhost.localdomain"
2022-08-16 04:59:00.193: watchdog pid 19942: LOG:  watchdog cluster is configured with 2 remote nodes
2022-08-16 04:59:00.194: watchdog pid 19942: LOG:  watchdog remote node:0 on 10.17.3.83:9000
2022-08-16 04:59:00.194: watchdog pid 19942: LOG:  watchdog remote node:1 on 10.17.3.84:9000
2022-08-16 04:59:00.194: watchdog pid 19942: LOG:  interface monitoring is disabled in watchdog
2022-08-16 04:59:00.195: watchdog pid 19942: LOG:  watchdog node state changed from [DEAD] to [LOADING]
2022-08-16 04:59:05.200: watchdog pid 19942: LOG:  watchdog node state changed from [LOADING] to [JOINING]
2022-08-16 04:59:09.205: watchdog pid 19942: LOG:  watchdog node state changed from [JOINING] to [INITIALIZING]
2022-08-16 04:59:10.206: watchdog pid 19942: LOG:  I am the only alive node in the watchdog cluster
2022-08-16 04:59:10.207: watchdog pid 19942: HINT:  skipping stand for coordinator state
2022-08-16 04:59:10.207: watchdog pid 19942: LOG:  watchdog node state changed from [INITIALIZING] to [LEADER]
2022-08-16 04:59:10.207: watchdog pid 19942: LOG:  I am announcing my self as leader/coordinator watchdog node
2022-08-16 04:59:14.211: watchdog pid 19942: LOG:  I am the cluster leader node
2022-08-16 04:59:14.211: watchdog pid 19942: DETAIL:  our declare coordinator message is accepted by all nodes
2022-08-16 04:59:14.211: watchdog pid 19942: LOG:  setting the local node "10.17.3.77:9999 Linux localhost.localdomain" as watchdog cluster leader
2022-08-16 04:59:14.211: watchdog pid 19942: LOG:  signal_user1_to_parent_with_reason(1)
2022-08-16 04:59:14.211: watchdog pid 19942: LOG:  I am the cluster leader node but we do not have enough nodes in cluster
2022-08-16 04:59:14.211: watchdog pid 19942: DETAIL:  waiting for the quorum to start escalation process
2022-08-16 04:59:14.211: main pid 19939: LOG:  watchdog process is initialized
2022-08-16 04:59:14.211: main pid 19939: DETAIL:  watchdog messaging data version: 1.2
2022-08-16 04:59:14.212: main pid 19939: LOG:  Pgpool-II parent process received SIGUSR1
2022-08-16 04:59:14.213: main pid 19939: LOG:  Pgpool-II parent process received watchdog state change signal from watchdog
2022-08-16 04:59:14.213: watchdog pid 19942: LOG:  new IPC connection received
2022-08-16 04:59:14.213: watchdog pid 19942: LOG:  new IPC connection received
2022-08-16 04:59:14.213: main pid 19939: LOG:  Setting up socket for 0.0.0.0:9999
2022-08-16 04:59:14.213: main pid 19939: LOG:  Setting up socket for :::9999
2022-08-16 04:59:14.213: life_check pid 19949: LOG:  3 watchdog nodes are configured for lifecheck
2022-08-16 04:59:14.214: life_check pid 19949: LOG:  watchdog nodes ID:0 Name:"10.17.3.77:9999 Linux localhost.localdomain"
2022-08-16 04:59:14.214: life_check pid 19949: DETAIL:  Host:"10.17.3.77" WD Port:9000 pgpool-II port:9999
2022-08-16 04:59:14.214: life_check pid 19949: LOG:  watchdog nodes ID:1 Name:"Not_Set"
2022-08-16 04:59:14.214: life_check pid 19949: DETAIL:  Host:"10.17.3.83" WD Port:9000 pgpool-II port:9999
2022-08-16 04:59:14.214: life_check pid 19949: LOG:  watchdog nodes ID:2 Name:"Not_Set"
2022-08-16 04:59:14.214: life_check pid 19949: DETAIL:  Host:"10.17.3.84" WD Port:9000 pgpool-II port:9999
2022-08-16 04:59:14.236: main pid 19939: LOG:  find_primary_node_repeatedly: waiting for finding a primary node
2022-08-16 04:59:14.264: main pid 19939: LOG:  find_primary_node: primary node is 0
2022-08-16 04:59:14.268: pcp_main pid 19987: LOG:  PCP process: 19987 started
2022-08-16 04:59:14.269: sr_check_worker pid 19988: LOG:  process started
2022-08-16 04:59:14.269: health_check pid 19989: LOG:  process started
2022-08-16 04:59:14.270: watchdog pid 19942: LOG:  new IPC connection received
2022-08-16 04:59:14.270: main pid 19939: LOG:  pgpool-II successfully started. version 4.3.2 (tamahomeboshi)
2022-08-16 04:59:14.270: main pid 19939: LOG:  node status[0]: 1
2022-08-16 04:59:14.270: main pid 19939: LOG:  node status[1]: 0
2022-08-16 04:59:14.270: main pid 19939: LOG:  node status[2]: 0
2022-08-16 04:59:15.215: heart_beat_receiver pid 19951: LOG:  set SO_REUSEPORT option to the socket
2022-08-16 04:59:15.215: heart_beat_receiver pid 19951: LOG:  creating watchdog heartbeat receive socket.
2022-08-16 04:59:15.215: heart_beat_receiver pid 19951: DETAIL:  set SO_REUSEPORT
2022-08-16 04:59:15.216: heart_beat_sender pid 19953: LOG:  set SO_REUSEPORT option to the socket
2022-08-16 04:59:15.216: heart_beat_sender pid 19953: LOG:  creating socket for sending heartbeat
2022-08-16 04:59:15.216: heart_beat_sender pid 19953: DETAIL:  set SO_REUSEPORT
2022-08-16 04:59:15.216: heart_beat_receiver pid 19955: LOG:  set SO_REUSEPORT option to the socket
2022-08-16 04:59:15.217: heart_beat_receiver pid 19955: LOG:  creating watchdog heartbeat receive socket.
2022-08-16 04:59:15.217: heart_beat_receiver pid 19955: DETAIL:  set SO_REUSEPORT
2022-08-16 04:59:15.217: heart_beat_sender pid 19957: LOG:  set SO_REUSEPORT option to the socket
2022-08-16 04:59:15.217: heart_beat_sender pid 19957: LOG:  creating socket for sending heartbeat
2022-08-16 04:59:15.217: heart_beat_sender pid 19957: DETAIL:  set SO_REUSEPORT
2022-08-16 04:59:24.302: watchdog pid 19942: LOG:  new IPC connection received
2022-08-16 04:59:34.336: watchdog pid 19942: LOG:  new IPC connection received
2022-08-16 04:59:44.370: watchdog pid 19942: LOG:  new IPC connection received

问题分析与解决步骤

从日志关键信息可以定位根因:

I am the cluster leader node but we do not have enough nodes in cluster
DETAIL: waiting for the quorum to start escalation process

Watchdog集群未达到法定人数(quorum),因此不会触发IP漂移相关的if_up_cmd命令。

具体排查与修复操作:

  1. 检查远程节点状态

    • 确认另外两个配置的Watchdog节点(10.17.3.83、10.17.3.84)是否正常启动并完成集群加入。日志中这两个节点名称显示为Not_Set,说明当前节点无法与它们建立有效通信。
    • 测试节点间9000端口(Watchdog通信端口)的连通性,排查防火墙、安全组是否拦截该端口。
  2. 调整法定人数配置(按需)

    • 若为测试环境或单节点部署场景,可修改wd_quorum_count参数降低法定人数要求。3节点集群默认需要至少2个节点在线;单节点场景可将该值设为1。
    • 修改配置后重启PGPool-II服务。
  3. 验证sudo权限

    • 确保运行PGPool-II的用户无需输入密码即可执行ip和arping命令,可在sudoers文件中添加如下配置:
      pgpool ALL=(ALL) NOPASSWD: /sbin/ip, /usr/sbin/arping
      
    • 权限不足可能导致命令执行失败且无日志输出。
  4. 手动测试命令有效性

    • 切换到PGPool-II运行用户,手动执行if_up_cmd中的命令(替换$_IP_$为实际虚拟IP):
      /usr/bin/sudo /sbin/ip addr add 10.17.3.158/24 dev ens1
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 23:51:24