半路接手openGauss(数据库),小白定位Failed to get cluster node info.exception is: list index out of range.

事情起因:运维说,周末我要给虚拟机加硬盘,虚拟机会全部关机,有问题你自己去搞吧!

PS:关机虽然是比较好的保障机制,但是只是加硬盘,不用吧!自信点,遇见百分百会有问题!

遇到部门的变动,今年日子确实不怎么好过,测试不仅得会测试,还的会运维,会部署,会安装,会定位问题,主要还是得学会解决问题!然后总结教程,贡献大家!

第二步,基础扫盲,快速掌握:

  虽然一次都没接触过,但是相信花三分钟扫盲还是可以的!由于前面已经有小白安装完成,我们这边只需要定位报错问题,解决问题,重启就可以。

启动数据库实例
gs_om -t start
或者是
gs_ctl start -D /opt/dashi/install/data/dn

停止数据库实例
gs_om -t stop
或者是
gs_ctl stop -D /opt/dashi/install/data/dn

重启数据库实例
gs_om -t restart
或者是
gs_om -t stop && gs_om -t start

查看数据库实例状态
gs_om -t status
或者是
gs_ctl status -D /opt/huawei/install/data/dn 


第三步,二话不说,直接开干;

# 直接重启呗,看看报错再说

gs_om -t restart

# 不得不说,start,restart,stop都是一样的套路

第四步,果不其然,抛出异常;

[omm@172 dn]$ gs_om -t restart
Stopping cluster.
=========================================
[GAUSS-53606]: Can not stop the database, the cmd is source /home/omm/.bashrc; python3 '/opt/huawei/install/om/script/local/StopInstance.py' -U omm -R /opt/huawei/install/app -t 300 -m fast,  Error:
[GAUSS-51400] : Failed to execute the command: source /home/omm/.bashrc; python3 '/opt/huawei/install/om/script/local/StopInstance.py' -U omm -R /opt/huawei/install/app -t 300 -m fast. Error:
[FAILURE] 192.100.200.130:


# 好家伙,只能看懂failed,其他的内容也不知道什么意思,那就按照报错的建议处理

[omm@172 dn]$ source /home/omm/.bashrc

# 成功,没问题这个

[omm@172 dn]$ python3 '/opt/huawei/install/om/script/local/StopInstance.py' -U omm -R /opt/huawei/install/app -t 300 -m fast
[GAUSS-51619] : The host name [172.0.1.12] is not in the cluster.

# 这个是说本地的IP不在节点范围,猜测可能是关机后IP变化了,看一下本机的ip是不是一样

[omm@172 dn]$ ip a # 基础的命令我还是会的,不然会被吐槽

# 查询出来的IP和这个报错的IP是一致的
。
。
。

# 思考一晚上,第二天还没有被开除,继续定位,好在度娘总在关键事件挺身而出,再次给出两个救命的命令

[omm@172 dn]$ gs_guc set -N all -I all -c "listen_addresses = 'localhost,172.0.1.12'"
The gs_guc run with the following arguments: [gs_guc -N all -I all -c listen_addresses = 'localhost,172.0.1.12' set ].
Begin to perform the total nodes: 1.
Popen count is 1, Popen success count is 1, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
Command count is 1, Command success count is 1, Command failure count is 0.

Total instances: 1. Failed instances: 0.
ALL: Success to perform gs_guc!

[omm@172 dn]$ gs_guc set -N all -I all -c "local_bind_address = '172.0.1.12'"
The gs_guc run with the following arguments: [gs_guc -N all -I all -c local_bind_address = '172.1.3.49' set ].
Begin to perform the total nodes: 1.
Popen count is 1, Popen success count is 1, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
Command count is 1, Command success count is 1, Command failure count is 0.

Total instances: 1. Failed instances: 0.
ALL: Success to perform gs_guc!

# 看到成功,这里我已经把开除的心又放进了肚子里

[GAUSS-53606]: Can not stop the database, the cmd is source /home/omm/.bashrc; python3 '/opt/huawei/install/om/script/local/StopInstance.py' -U omm -R /opt/huawei/install/app -t 300 -m fast,  Error:
[GAUSS-51400] : Failed to execute the command: source /home/omm/.bashrc; python3 '/opt/huawei/install/om/script/local/StopInstance.py' -U omm -R /opt/huawei/install/app -t 300 -m fast. Error:
[FAILURE] 192.100.200.130:
..

# water?water?water?这个是度娘对我放了个屁。。。。。








第五步,出其不意,问题解决;

# 简单的报错,总希望看到详细的日志,男人得能屈能伸,刚刚骂完度娘,又去求助了,我很软

[omm@172 dn]$ gs_om -t status --detail
[GAUSS-51652] : Failed to get cluster node info.exception is: list index out of range.

# 想到是不是还有啥配置文件没有处理好,就去看了一下gs_om的静态配置文件

# 这个一般是安装人才知道,不过自己按照关键词也能大致找到,猜到具体的位置

# 找到安装解压目录,找到节点配置文件

[root@172 openGauss]# scp cluster_config.xml cluster_config.xml.bak # 虽然我是小白,但是也知道要备份再修改

[omm@172 openGauss]$ cat cluster_config.xml 
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
    <!-- openGauss整体信息 -->
    <CLUSTER>
        <!-- 数据库名称 -->
        <PARAM name="clusterName" value="dbCluster" />
        <!-- 数据库节点名称(hostname) -->
        <PARAM name="nodeNames" value="192.100.200.130" />
        <!-- 数据库安装目录-->
        <PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
        <!-- 日志目录-->
        <PARAM name="gaussdbLogPath" value="/var/log/omm" />
        <!-- 临时文件目录-->
        <PARAM name="tmpMppdbPath" value="/opt/huawei/tmp" />
        <!-- 数据库工具目录-->
        <PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />
        <!-- 数据库core文件目录-->
        <PARAM name="corePath" value="/opt/huawei/corefile" />
        <!-- 节点IP,与数据库节点名称列表一一对应 -->
        <PARAM name="backIp1s" value="192.100.200.130"/> 
    </CLUSTER>
    <!-- 每台服务器上的节点部署信息 -->
    <DEVICELIST>
        <!-- 节点1上的部署信息 -->
        <DEVICE sn="192.100.200.130">
            <!-- 节点1的主机名称 -->
            <PARAM name="name" value="192.100.200.130"/>
            <!-- 节点1所在的AZ及AZ优先级 -->
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.100.200.130"/>
            <PARAM name="sshIp1" value="192.100.200.130"/>
               
	    <!--dbnode-->
	    <PARAM name="dataNum" value="1"/>
	    <PARAM name="dataPortBase" value="5432"/>
	    <PARAM name="dataNode1" value="/opt/huawei/install/data/dn"/>
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE>
    </DEVICELIST>
</ROOT>

这里很明显是单节点部署,然后虚拟机重启之后,这里的IP变化,需要重新配置一下单节点的ip,这里需要将这个192的全部替换成当前服务器的IP就可以。

修改之后,需要配置生效(这一点我不是很确定)

[omm@172 dn]$ gs_om -t generateconf -X /opt/software/openGauss/cluster_config.xml --distribute
Generating static configuration files for all nodes.
Creating temp directory to store static configuration files.
Successfully created the temp directory.
Generating static configuration files.
Successfully generated static configuration files.
Static configuration files for all nodes are saved in /opt/huawei/install/om/script/static_config_files.
Distributing static configuration files to all nodes.
Successfully distributed static configuration files.

确认一下,当前的节点ip是否生效,再次重启吧

[omm@172 dn]$ 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  172.1.2.12 172.1.2.12      5432       6001 /opt/huawei/install/data/dn   P Primary Normal
[omm@172 ~]$ gs_om -t stop && gs_om -t start #卧槽,成功了
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Starting cluster.
=========================================
[SUCCESS] 172.1.3.49
2024-01-16 11:02:43.796 65a5f1d3.1 [unknown] 140394453228608 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2024-01-16 11:02:43.796 65a5f1d3.1 [unknown] 140394453228608 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2024-01-16 11:02:43.821 65a5f1d3.1 [unknown] 140394453228608 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3516 Mbytes) is larger.
=========================================
Successfully started.

# 没有被开除,希望对大家有帮助

欢迎收藏,点赞,谢谢大家发财的小手!

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
【大纲】 0-1-课程内容和安排介绍 1-1-计算机的概念 1-2-程序设计语言概述 1-3-Python语言 1-4-Python开发环境配置 1-5-基本程序设计方法 1-6-理解问题的计算部分 1-7-温度转换程序实例 2-1-Python程序元素分析 2-2-程序编写模板 2-3-turtle库和蟒蛇绘制程序 2-4-蟒蛇绘制程序分析 2-5-函数库的引用 3-1-Python中类型的概念 3-2-数字类型 3-3-字符串类型 3-4-字符串的操作 3-5-元组类型 3-6-列表类型及操作 3-7-math库和random库 3-8-π的计算 4-1-1-程序基本结构 4-1-2-简单分支 4-1-3-多分支 4-1-4-异常处理设计 4-1-5-三者最大实例分析 4-2-1-基本循环结构 4-2-2-通用循环构造方法 4-2-3-死循环半路循环 4-2-4-布尔表达式 6-1-1-文件的基础 6-1-2-文件的基本处理 6-1-3-文件实例一 6-1-4-文件实例二 6-2-1-字典的基础 6-2-2-字典的操作 6-2-3-字典实例一 6-2-4-字典实例二 7-3-1-计算思维 7-3-2-自顶向下的设计 7-3-3-自底向上的执行 7-3-4-软件工程 7-3-5-敏捷开发方法 7-4-1-面向过程的程序设计 7-4-2-面向对象的程序设计 7-4-3-基本例子 7-4-4-面向对象的特点 8-6-1-基本介绍 8-6-2-图形对象概念 8-6-3-交互式图形用户接口 8-6-4-图形库的应用方法 8-6-5-Turtle库介绍 8-6-6-图形用户接口实例 8-6-7-Turtle实例 8-6-8-Turtle Art 第6章-函数与递归-1-函数定义 第6章-函数与递归-2-函数的调用和返回值 第6章-函数与递归-3-改变参数值的函数 第6章-函数与递归-4-程序结构和递归 第6章-函数与递归-5-函数实例

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值