更新时间:2024-02-07 GMT+08:00
分享

PGXC_NODE

PGXC_NODE系统表存储集群节点信息。

表1 PGXC_NODE字段

名称

类型

描述

node_name

name

节点名称。

node_type

"char"

节点类型。

C:协调节点。

D:数据节点。

node_port

integer

节点的端口号。

node_host

name

节点的主机名称或者IP(如配置为虚拟IP,则为虚拟IP)。

node_port1

integer

复制节点的端口号。

node_host1

name

复制节点的主机名称或者IP(如配置为虚拟IP,则为虚拟IP)。

hostis_primary

boolean

表明当前节点是否发生主备切换。

nodeis_primary

boolean

在replication表下,是否优选当前节点作为优先执行的节点进行非查询操作。

nodeis_preferred

boolean

在replication表下,是否优选当前节点作为首选的节点进行查询。

node_id

integer

节点标识符。

sctp_port

integer

主节点使用TCP代理通信库或SCTP通信库的数据通道监听端口。

control_port

integer

主节点使用TCP代理通信库或SCTP通信库的控制通道监听端口。

sctp_port1

integer

备节点使用TCP代理通信库或SCTP通信库的数据通道监听端口。

control_port1

integer

备节点使用TCP代理通信库或SCTP通信库的控制通道监听端口。

nodeis_central

boolean

当前节点为中心控制节点。

应用示例

查询某节点DN数量:

1
2
3
4
5
6
7
SELECT count(node_name),node_host FROM pgxc_node WHERE node_type='D' GROUP BY 2;
 count |   node_host
-------+---------------
     1 | 192.**.**.10
     1 | 192.**.**.11
     1 | 192.**.**.12
(3 rows)

查询集群的CN和DN信息:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
SELECT * FROM pgxc_node;
  node_name   | node_type | node_port |   node_host    | node_port1 |   node_host1   | hostis_primary | nodeis_primary | nodeis_preferred
 |   node_id   | sctp_port | control_port | sctp_port1 | control_port1 | nodeis_central
--------------+-----------+-----------+----------------+------------+----------------+----------------+----------------+-----------------
-+-------------+-----------+--------------+------------+---------------+----------------
 dn_6001_6002 | D         |     40000 | 192.**.***.**1 |      45000 | 192.**.**.**2  | t              | f              | f
 |  1644780306 |     40002 |        40003 |      45002 |         45003 | f
 dn_6003_6004 | D         |     40000 | 192.**.**.**2  |      45000 | 192.**.**.**3  | t              | f              | f
 |  -966646068 |     40002 |        40003 |      45002 |         45003 | f
 dn_6005_6006 | D         |     40000 | 192.**.**.**3  |      45000 | 192.**.***.**1 | t              | f              | f
 |   868850011 |     40002 |        40003 |      45002 |         45003 | f
 cn_5001      | C         |      8000 | 192.**.***.**1 |       8000 | 192.**.***.**1 | t              | f              | f
 |  1120683504 |      8002 |         8003 |          0 |             0 | f
 cn_5002      | C         |      8000 | 192.**.**.**2  |       8000 | 192.**.**.**2  | t              | f              | f
 | -1736975100 |      8002 |         8003 |          0 |             0 | f
 cn_5003      | C         |      8000 | localhost      |       8000 | localhost      | t              | f              | f
 |  -125853378 |      8002 |         8003 |          0 |             0 | t
(6 rows)
分享:

    相关文档

    相关产品