客户端工具通过数据库主节点连接数据库。因此连接前,需获取数据库主节点所在服务器的IP地址及数据库主节点的端口号信息。
操作步骤
步骤1 以操作系统用户gbase登录数据库主节点。
步骤2 使用“gs_om -t status --detail”命令查询GBase 8c各实例情况。
$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state
-----------------------------------------------------------------------------------------------------------------
1 gbase8c_7_6 host_ip 5600 6001 /home/gbase/clusters/gbase8c/datanode/dn_1 P Primary Normal
如上部署了数据库主节点实例的服务器IP地址分别为host_ip。数据库主节点数据路径为/home/gbase/clusters/gbase8c/datanode/dn_1。“P”表示安装时指定的角色为Primary,数据库安装后不在变化,从系统静态文件读取;“Primary”表示实例为主实例; “Normal”表示GBase 8c可用,且数据有冗余备份,所有进程都在运行,主备关系正常。
步骤3 确认数据库主节点的端口号。
在步骤2查到的数据库主节点数据路径下的postgresql.conf文件中查看端口号信息。示 例如下:
cat /home/gbase/clusters/gbase8c/datanode/dn_1/postgresql.conf | grep port
port = 5600 # (change requires restart)
#ssl_renegotiation_limit = 0 # amount of data between renegotiations, no longer supported
# supported by the operating system:
# The heartbeat thread will not start if not set localheartbeatport and remoteheartbeatport.
# e.g. 'localhost=10.145.130.2 localport=12211 localheartbeatport=12214 remotehost=10.145.130.3 remoteport=12212 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12213 remotehost=10.145.133.3 remoteport=12214'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.4 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.4 remoteport=12314'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.5 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.5 remoteport=12314'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.6 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.6 remoteport=12314'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.7 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.7 remoteport=12314'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.8 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.8 remoteport=12314'
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.9 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# e.g. 'localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# %r = remote host and port
alarm_report_interval = 10
5600为数据库主节点的端口号。
----结束
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。