确认连接信息

客户端工具通过数据库主节点连接数据库。因此连接前,需获取数据库主节点所在服务器的IP地址及数据库主节点的端口号信息。

操作步骤

  1. 以操作系统用户omm登录数据库主节点。
  2. 使用“gs_om -t status –detail”命令查询openGauss各实例情况。

    1. gs_om -t status --detail
    1. [ DBnode State ]
    2. node node_ip instance state
    3. -----------------------------------------------------------------------------
    4. 1 plat1 192.168.0.11 5001 /srv/gaussdb/data1/dbnode P Primary Normal

    如上部署了数据库主节点实例的服务器IP地址分别为192.168.10.11。数据库主节点数据路径为“/srv/gaussdb/data1/dbnode”。“P”表示安装时指定的角色为Primary,数据库安装后不在变化,从系统静态文件读取;“Primary”表示实例为主实例;“Normal”表示openGauss可用,且数据有冗余备份,所有进程都在运行,主备关系正常。更多数据库状态含义见《工具参考》中“服务端工具 > gs_om”章节。

  3. 确认数据库主节点的端口号。

    2查到的数据库主节点数据路径下的postgresql.conf文件中查看端口号信息。示例如下:

    1. cat /srv/BigData/gaussdb/data1/dbnode/postgresql.conf | grep port
    1. port = 8000 # (change requires restart)
    2. #comm_sctp_port = 1024 # Assigned by installation (change requires restart)
    3. #comm_control_port = 10001 # Assigned by installation (change requires restart)
    4. # supported by the operating system:
    5. # e.g. 'localhost=10.145.130.2 localport=12211 remotehost=10.145.130.3 remoteport=12212, localhost=10.145.133.2 localport=12213 remotehost=10.145.133.3 remoteport=12214'
    6. # e.g. 'localhost=10.145.130.2 localport=12311 remotehost=10.145.130.4 remoteport=12312, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.4 remoteport=12314'
    7. # %r = remote host and port
    8. alarm_report_interval = 10
    9. support_extended_features=true

    8000为数据库主节点的端口号。