ITPub博客

首页 > 数据库 > 国内数据库 > 实战GBase 8a MPP Cluster 节点替换 (一)

实战GBase 8a MPP Cluster 节点替换 (一)

原创 国内数据库 作者:Miaomiao_Shui 时间:2020-09-27 14:56:44 0 删除 编辑

1)  在的Coordinator 节点的 IP ;

2)  修改existDataHost 参数为已存在的所有 data 节点的 IP 。

修改后的demo.options 参考如下:

$ cat demo.options

installPrefix= /opt

#coordinateHost =172.168.83.11,172.168.83.12,172.168.83.13

#coordinateHostNodeID = 11,12,13

dataHost =172.168.83.16

existCoordinateHost =172.168.83.11,172.168.83.12,172.168.83.13

existDataHost =172.168.83.11,172.168.83.12,172.168.83.13,172.168.83.14,172.168.83.15

dbaUser = gbase

dbaGroup = gbase

dbaPwd = 'gbasedba'

rootPwd = '111111'

#rootPwdFile = rootPwd.json

 

步骤2 :执行安装。

$ ./gcinstall.py --silent=demo.options

*********************************************************************************

Thank you for choosing GBase product!

 

………………

******************************************************************

Do you accept the above licence agreement ([Y,y]/[N,n])? y

******************************************************************

                     Welcome to install GBase products

******************************************************************

Environmental Checking on gcluster nodes.

CoordinateHost:

DataHost:

172.168.83.1 6

Are you sure to install GCluster on these nodes ([Y,y]/[N,n])? y

 

………………

 

172.168.83.1 6          install cluster on host 172.168.83.1 6  successfully.

update and sync configuration file...

Starting all gcluster nodes...

adding new datanodes to gcware...

$


设置节点状态并清理feventlog

检查节点状态,集群状态应为normal , Coordinator 节点状态正常 , 确认被替换节点是纯Data 节点后设置 被替换节点 状态 为unavailable 状态 。

操作 步骤

步骤1 :检查节点状态,集群状态应为 normal , Coordinator 节点状态正常,被替换的节点为 DATA NODE 。

$ gcadmin showcluster vc vc1

CLUSTER STATE:         ACTIVE

VIRTUAL CLUSTER MODE:  NORMAL

 

=======================================================

|          GBASE VIRTUAL CLUSTER INFORMATION          |

=======================================================

|    VcName    | DistributionId |       comment       |

-------------------------------------------------------

|     vc1      |       1        | comment message vc1 |

-------------------------------------------------------

===================================================================================

|                       VIRTUAL CLUSTER DATA NODE INFORMATION                     |

===================================================================================

| NodeName |   IpAddress     | DistributionId |    gnode    |syncserver|DataState |

-----------------------------------------------------------------------------------

|  node1   | 172.168.83.11   |       1        |    OPEN     |   OPEN   |    0     |

-----------------------------------------------------------------------------------

|  node2   | 172.168.83.12   |       1        |    OPEN     |   OPEN   |    0     |

-----------------------------------------------------------------------------------

|  node3   | 172.168.83.15   |       1        |    OPEN     |   OPEN   |    0     |

-----------------------------------------------------------------------------------

 

3 data node

步骤2 :设置被替换节点状态为 unavailable :在操作系统的 DBA 用户( demo.options 文件中 dbauser 参数指定的用户)下运行 gcadmin setnodestate 命令设置要替换的节点状态为 unavailable 。

$ gcadmin setnodestate 172.168.83.15 unavailable

after set node state into unavailable,can not set the state into normal,

must run gcadmin replacenodes to replace this node ,after that command node state can return into normal.

you realy want to set node state into unavailable(yes or no)?

yes

get node data state by ddl fevent log start ......

get node data state by ddl fevent log end ......

get node data state by dml fevent log start ......

get node data state by dml fevent log end ......

get node data state by dml storage fevent log start ......

get node data state by dml storage fevent log end ......

 

check data server node data state by fevent log start ......

check data server node data state by fevent log end ......

set node [172.168.83.15] state to unavailable successful

步骤3 :删除被替换节点的feventlog 。

$ gcadmin rmfeventlog 172.168.83.15

after rmfeventlog 172.168.83.15, fevent log will be removed, must run gcadmin replacenodes to replace this node.

you realy want to remove node 172.168.83.15 fevent log(yes or no)?

yes

delete ddl event log on node 172.168.83.15 start

delete ddl event log on node 172.168.83.15 end

delete dml event log on node 172.168.83.15 start

delete dml event log on node 172.168.83.15 end

delete dml storage event log on node 172.168.83.15 start

delete dml storage event log on node 172.168.83.15 end

创建中间的distribution

建立新的distribution , 该分布信息用于 剔除被替换节点,其他节点分片分布保持不变。

操作 步骤

步骤1 :查看 172.168.83.15 节点所在 vc1 的 distribution 信息。

$ gcadmin showdistribution vc vc1 node

     Distribution ID: 1 | State: new | Total segment num: 3

 

===============================================================

|  nodes   |  172.168.83.11  | 172.168.83.12 | 172.168.83.15  |

---------------------------------------------------------------

| primary  |       1         |      2        |      3         |

| segments |                 |               |                |

---------------------------------------------------------------

|duplicate |       3         |      1        |      2         |

|segments 1|                 |               |                |

===============================================================

步骤2 :使用 gcadmin getdistribution 命令将待替换节点所在的 vc 的 distribution 信息保存在指定的文件中。

从步骤1 的执行结果可以看到 Disribution ID 为 1 ,将 vc1 上 distribution ID 为 1 的 distribution 信息保存到文件 distribution_info_vc1.xml 中:

$ gcadmin getdistribution 1 distribution_info_vc1.xml vc vc1

gcadmin getdistribution 1 distribution_info_vc1.xml vc vc1 ...

 

get segments information

write segments information to file [distribution_info_vc1.xml]

 

gcadmin getdistribution information successful

 

$ cat distribution_info_vc1.xml

<?xml version='1.0' encoding="utf-8"?>
<distributions>
    <distribution>
        <segments>
            <segment>
                <primarynode ip="172.168.83.11"/>
 
                <duplicatenodes>
                    <duplicatenode ip="172.168.83.12"/>
                </duplicatenodes>
            </segment>
 
            <segment>
                <primarynode ip="172.168.83.12"/>
                <duplicatenodes>
                    <duplicatenode ip="172.168.83.15"/>
                </duplicatenodes>
            </segment>
 
            <segment>
                <primarynode ip="172.168.83.15"/>
                <duplicatenodes>
                    <duplicatenode ip="172.168.83.11"/>
                </duplicatenodes>
            </segment>
        </segments>
    </distribution>
</distributions>


步骤3 :修改新的 distribution 的分布规则信息。

修改原则为让被替换节点没有任何分片,其他节点分片的分布规则不变,

l  若被替换节点存储的分片是作为主分片,则将该分片的备份分片节点修改为主分片节点,即节点IP 在 primarynode 标签中,则将该 segment 内的 duplicatenodes 标签内的 IP 替换被替换节点 IP ,并删除 duplicatenodes 标签。

l  若被替换节点存储的分片是作为备份分片,即被替换的节点IP 在 duplicatenodes 标签中,则将该 duplicatenodes 标签删除。

修改后的distribution_info_vc1.xml 文件参考如下:

$ cat distribution_info_vc1.xml

<?xml version='1.0' encoding="utf-8"?>
<distributions>
    <distribution>
        <segments>
            <segment>
                <primarynode ip="172.168.83.11"/>
 
                <duplicatenodes>
                    <duplicatenode ip="172.168.83.12"/>
                </duplicatenodes>
            </segment>
 
            <segment>
                <primarynode ip="172.168.83.12"/>
            </segment>
 
            <segment>
                <primarynode ip="172.168.83.11"/>
            </segment>
        </segments>
    </distribution>
</distributions>


步骤4 :修改创建 distribution 所需的 gcChangeInfo _vc1 .xml 文件。

$ cat gcChangeInfo _vc1 .xml

<?xml version="1.0" encoding="utf-8"?>
<servers>
 <cfgFile file="distribution_info_vc1.xml"/>
</servers>


步骤5 :执行 创建新的distribution ( Distribution ID 为 3 )的 distribution 。

$ gcadmin distribution gcChangeInfo _vc1 .xml vc vc1

gcadmin generate distribution ...

 

gcadmin generate distribution successful


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69980090/viewspace-2724496/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2020-09-27

  • 博文量
    2
  • 访问量
    784