【问题标题】:PGPool 'SHOW pool_nodes' returns 'ERROR: unrecognized configuration parameter "pool_nodes"' over jdbcPGPool 'SHOW pool_nodes' 在 jdbc 上返回 'ERROR: unrecognized configuration parameter "pool_nodes"'
【发布时间】:2015-01-13 21:29:32
【问题描述】:

我已经成功地使用 PGpool 配置了我们的应用程序,我必须说,它非常棒。我正在尝试在我们的应用程序中公开有关 PGPool 集群的信息,并且在使用 postgres 驱动程序的 JDBC 上使用“SHOW”命令时遇到问题。

司机:

postgresql-9.3-1101-jdbc41.jar

当我尝试执行查询“SHOW pool_nodes”时,我收到此错误:

ERROR: unrecognized configuration parameter "pool_nodes"

我很确定我连接到 pgpool 而不是 postgres,因为故障转移工作得很好。我的猜测是 postgres 驱动程序正在预先进行一些检查。有没有人建议在我的 java 应用程序中获取这些数据?

【问题讨论】:

标签: java postgresql jdbc pgpool


【解决方案1】:

不能通过show命令获取结果,所以我使用pgadmin并添加了一些PHP代码来获取它。

首先你必须安装pgadmin并将getNodeInfo.php添加到文件夹中,getNodeInfo.php代码:

<?php

/**
* The status value can refrence:
* http://www.pgpool.net/docs/latest/en/html/pcp-node-info.html
* 
* Status is represented by a digit from [0 to 3].
* 
* 0 - This state is only used during the initialization. PCP will never display it.
* 
* 1 - Node is up. No connections yet.
* 
* 2 - Node is up. Connections are pooled.
* 
* 3 - Node is down.
*/

require_once('common.php');
require_once('command.php');

$_SESSION[SESSION_LOGIN_USER]          = "your_pgadmin_account";
$_SESSION[SESSION_LOGIN_USER_PASSWORD] = "your_pgadmin_password";

$nodeCount = getNodeCount();

$nodeInfo = array();

for($i = 0;$i < $nodeCount; $i++){
    $nodeInfo[$i] = getNodeInfo($i);
}

echo json_encode($nodeInfo);

exit();


如果你的 pgadmin 可以正常工作,你可以拨打http://localhost/getNodeInfo.php 点赞

[
  {
    "hostname": "host1 ip",
    "port": "5432",
    "status": "2",
    "weight": "0.500"
  },
  {
    "hostname": "host2 ip",
    "port": "5432",
    "status": "2",
    "weight": "0.500"
  }
]

如果状态 == 3,则主机已关闭。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2020-12-07
    • 1970-01-01
    • 2019-06-08
    • 1970-01-01
    • 2016-04-12
    • 1970-01-01
    相关资源
    最近更新 更多