GBase 8a
其他
文章

GBase8a如何修改IP地址

发表于2024-08-15 14:47:20195次浏览1个评论

IP地址修改操作步骤(V952版本测试通过):

1. 计算nodeid

    原IP地址:192.168.92.129    新IP地址:192.168.92.151
    GBASE> SELECT '192.168.92.151' AS IPAddr,
                INET_ATON('151.92.168.192') AS NodeID, 
                CAST(INET_ATON('151.92.168.192') AS INT) - 4294967296 AS minus_NodeID
            FROM DUAL;
    +----------------+------------+--------------+
    | IPAddr         | NodeID     | minus_NodeID |
    +----------------+------------+--------------+
    | 192.168.92.151 | 2539432128 |  -1755535168 |
    +----------------+------------+--------------+

    
2. 停服务
    gcluster_services all stop

3. 启动gcware
    gcware_services gcware start

4. 刷快照
    python
    >>> import gcware
    >>> gcware.flush_statemachine()    #重复至max(REDO.n)-1=max(SNAPSHOT.xx.n+1)
    
5. 停止gcware
    gcware_services gcware stop

6. 修改操作系统IP地址
    vi /etc/sysconfig/network-scripts/ifcfg-ens32

7. 修改集群IP
    7.1 gcware配置文件【路径:/opt/gcware/config/gcware.conf】
        sed -i 's/\<192.168.92.129\>/192.168.92.151/g' /opt/gcware/config/gcware.conf; 
        sed -i 's/\<192.168.92.130\>/192.168.92.152/g' /opt/gcware/config/gcware.conf; 
        sed -i 's/\<192.168.92.131\>/192.168.92.153/g' /opt/gcware/config/gcware.conf;

    7.2 raft协议元数据【路径:/opt/gcware/data/gcware/GCWARE_META.*】
        sed -i 's/\<2170333376\>/2539432128/g' /opt/gcware/data/gcware/GCWARE_META.*; 
        sed -i 's/\<2187110592\>/2556209344/g' /opt/gcware/data/gcware/GCWARE_META.*; 
        sed -i 's/\<2203887808\>/2572986560/g' /opt/gcware/data/gcware/GCWARE_META.*;

    7.3 SNAPSHOT(数值最大)【路径:/opt/gcware/data/gcware/SNAPSHOT.*.*/members】
        sed -i 's/\<192.168.92.129\>/192.168.92.151/g' members; 
        sed -i 's/\<192.168.92.130\>/192.168.92.152/g' members; 
        sed -i 's/\<192.168.92.131\>/192.168.92.153/g' members; 
        sed -i 's/\<2170333376\>/2539432128/g' members; 
        sed -i 's/\<2187110592\>/2556209344/g' members; 
        sed -i 's/\<2203887808\>/2572986560/g' members; 
        
    7.4 statemachine目录【路径:/opt/gcware/data/gcware/SNAPSHOT.43.5200/statemachine】
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.129\>/192.168.92.151/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.130\>/192.168.92.152/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.131\>/192.168.92.153/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2170333376\>/2539432128/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2187110592\>/2556209344/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2203887808\>/2572986560/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2124633920\>/-1755535168/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2107856704\>/-1738757952/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2091079488\>/-1721980736/g' {} \;

    7.5 statemachine/VC目录【路径:/opt/gcware/data/gcware/SNAPSHOT.43.5200/statemachine/vc00001】
        # 兼容模式,只有vc00001
        # 多VC模式,则每个VC都必须修改
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.129\>/192.168.92.151/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.130\>/192.168.92.152/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<192.168.92.131\>/192.168.92.153/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2170333376\>/2539432128/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2187110592\>/2556209344/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<2203887808\>/2572986560/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2124633920\>/-1755535168/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2107856704\>/-1738757952/g' {} \; 
        find . -maxdepth 1 -type f -exec sed -i 's/\<-2091079488\>/-1721980736/g' {} \;

8. 启动服务
    gcluster_services all start

9. 验证
    gcadmin

10. 问题总结
    问题:gcadmin显示集群状态正常,gccli -e"show nodes" 有节点OFFLINE,查询表提示:Failed to get metadata ... no valid nodes ....
    解决: 多执行几次:gcluster_services all restart,更新gcluster缓存即可。

评论

登录后才可以发表评论
用户头像
levvel发表于 3个月前
先水一个