首页 > 数据库 > > 替换故障主机-替换主机-不换IP
集群的主机出现故障,需要使用新的主机进行替换,如果新主机的IP和主机名称和故障主机保持一致,则可以使用命令直接进行替换。
以需要替换新主机名称为plat3为例。
echo $LANG
en_US.UTF-8
新主机上的字符集、编码方式等信息,使与其它主机保持一致。
如果不一致请使用如下方式设置字符集。
export LANG="en_US.UTF-8"以root用户登录集群的任意一台正常主机。
palt1:/opt/software/gaussdb/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml其中omm为数据库管理员(也是运行集群的操作系统用户),dbgrp为运行集群的操作系统用户的群组名称,/opt/software/gaussdb/clusterconfig.xml为集群配置文件路径。
palt1:~ # su - omm执行如下命令完成新增主机的安装操作。
gs_replace -t install -h plat3执行如下命令完成新增主机的配置操作。
gs_replace -t config -h plat3执行如下命令完成新增主机的启动操作。
gs_replace -t start -h plat3示例(替换主机-不换IP)
plat1:/opt/software/gaussdb/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)? yes
Please enter password for root.
Password:
Creating SSH trust for the root permission user.
Successfully created SSH trust for the root permission user.
Pass over configuring LVM
Distributing package.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Creating [omm] user on all nodes.
Successfully created [omm] user on all nodes.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Start creating SSH trust for [omm] user.
Successfully created SSH trust for [omm] user.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Preparing SSH service.
Successfully prepared SSH service.
Setting user environmental variables.
Successfully set user environmental variables.
Configuring alarms on the cluster nodes.
Successfully configured alarms on the cluster nodes.
Setting the dynamic link library.
Successfully set the dynamic link library.
Fixing server package owner.
Successfully fixed server package owner.
Create logrotate service.
Successfully create logrotate service.
Setting finish flag.
Successfully set finish flag.
Clean SSH trust for the root permission user.
Successfully cleaned SSH trust for the root permission user.
Preinstallation succeeded.
omm@plat1:/opt/software/gaussdb/script> gs_replace -t install -h plat3
Distributing configuration to remote host.
Successfully distributed configuration to remote host.
Installing.
Checking installation environment on nodes.
Successfully checking installation environment on nodes.
Installing applications on nodes.
Installation is completed.
==============================
Time statistics:
Install replacement nodes: 9s
total: 9somm@plat1:/opt/software/gaussdb/script> gs_replace -t config -h plat3
Check cluster status for replace.
Check the status of ETCD cluster.
Successfully check the status of ETCD cluster.
Successfully check cluster status.
Filter out all valid hosts for replacing.
Distributing configuration to remote host.
Successfully distributed configuration to remote host.
Configuring
Stopping replace instances.
Successfully stopped replace instances.
Configuring replacement instances.
Config replace instances.
Successfully config replace instances.
Config standby DN of new instances.
.......67s
Config standby DN of new instances successfully.
Successfully configured replacement instances.
Configuration succeeded.
==============================
Time statistics:
Config replacement nodes: 95s
total: 95s
omm@plat1:/opt/software/gaussdb/script> gs_replace -t start -h plat3
Starting.
==============================
..
Start cm agent on new nodes.
Successfully start cm agent for new nodes.
Starting the cluster.
......
Successfully started instance process. Waiting to become Normal.
==============================
Successfully started cluster.
==============================
Time statistics:
Start replacement nodes: 35s
total: 35s
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3166341/ ,如需转载,请注明出处,否则将追究法律责任。