首页 > 数据库 > > 数据库管理工具-gs_expand
GaussDB 100提供了gs_expand工具来帮助用户在业务发展和数据量变更的情况下,增加副本节点、CN节点或DN组,以满足业务需求。
gs_expand -t check_tablespace -I INSTANCENAME [-o OUPUTFILE] [-l LOGFILE]集群扩容
gs_expand -X XMLFILE [--meta-cn=INSTANCENAME] [--meta-dn=INSTANCENAME] [--tablespace-map-file=MAPFILE] [--rollback|--role=passive] [-l LOGFILE]gs_expand { -? | --help }显示版本信息
gs_expand { -V | --version }参数说明
gs_expand参数可以分为如下几类:
指定日志文件及存放路径。
默认值:$GAUSSLOG/om/gs_expand.log
显示帮助信息。
显示版本号信息。
执行的命令为检测表空间
检测表空间元数据的实例
非标准表空间的datafile输出文件,默认为 $GAUSSTMP/absolute_tablespace.lst

如果需要修改xml文件名称时,需要将修改后的xml文件分发到集群的其他主机上,且保证xml文件权限和修改名称前相同。
取值范围:clusterconfig.xml的文件路径。
指定导出CN元数据的CN实例
指定导出DN元数据的DN实例
替换绝对路径的表空间元数据时,指定替换规则的文件
回滚上一次执行失败的扩容。
omm@plat1:~> gs_expand -t check_tablespace -I cn_401
Check tablespace data files.
Get instance named cn_401.
Successfully got instance.
Export metadata from cn_401.
Successfully export metadata.
Get the standard paths of tablespace.
Successfully got the non-standard tablespace paths.
Write the non-standard paths into output file.
Successfully wrote the non-standard paths.
Successfully check tablespace data files.
The non-standard path tablespace are:
/opt/huawei/gaussdb_tbs/yy_test001cn
/opt/huawei/gaussdb_tbs/zz_test001cnomm@plat1:~> gs_expand -t check_tablespace -I DB1_1
Check tablespace data files.
Get instance named DB1_1.
Successfully got instance.
Export metadata from DB1_1.
Successfully export metadata.
Get the standard paths of tablespace.
Successfully got the non-standard tablespace paths.
Write the non-standard paths into output file.
Successfully wrote the non-standard paths.
Successfully check tablespace data files.
The non-standard path tablespace are:
/opt/huawei/gaussdb_tbs/bb_test001dn
/opt/huawei/gaussdb_tbs/cc_test001dn
{
"plat4:/opt/huawei/gaussdb/sdc/data/data_dn4": [
[
"/opt/huawei/gaussdb_tbs/bb_test001dn",
"/opt/huawei/gaussdb_tbs/test/bb_test001dn"
],
[
"/opt/huawei/gaussdb_tbs/cc_test001dn",
"/opt/huawei/gaussdb_tbs/test/cc_test001dn"
]
],
"plat4:/opt/huawei/gaussdb/sdc/data/data_cn": [
[
"/opt/huawei/gaussdb_tbs/yy_test001cn",
"/opt/huawei/gaussdb_tbs/test/yy_test001cn"
],
[
"/opt/huawei/gaussdb_tbs/zz_test001cn",
"/opt/huawei/gaussdb_tbs/test/zz_test001cn"
]
]
}plat1:/opt/software/gaussdb/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/ClusterConfig_diatation.xml --alarm-type=1
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.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for the root permission user.
Distributing package.
Successfully distributed package.
Are you sure you want to create the user[perfadm] and create trust for it (yes/no)? yes
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [perfadm] user.
Please enter password for current user[perfadm].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [perfadm] 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.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/gaussdb/script/gs_checkos -i A -h plat1,plat2,plat3".
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.
Preinstallation succeeded.omm@plat1:~> gs_expand -X /opt/software/gaussdb/ClusterConfig_diatation.xml
Check ssh trust.
Successfully check ssh trust.
Check time consistency.
Successfully check time consistency.
Get cluster status.
Successfully get cluster status.
Check cluster open status.
Successfully check cluster open status.
Compare config file.
Compare config file successfully.
Get new instances.
Successfully get new instances.
Backing up cluster configuration.
Successfully backed up cluster configuration.
Distribute ETCD keys to new host.
Distribute ETCD keys to new host successfully.
Close the CM heartbeat about CN.
Install new hosts.
Install new hosts successfully.
Initialize new instances.
...........71s
Initialize new instances successfully.
Build standby database.
Config standby DN of new instances.
..............74s
Config standby DN of new instances successfully.
Build standby database successfully.
Config applications.
Config applications successfully.
.Export metadata from original instance.
Successfully export metadata from original instance.
Import metadata into new instances.
Successfully import metadata into new instances.
Update zhba.conf.
Successfully update zhba.conf.
Begin close cm update node info.
Successfully close cm update node info.
Update node info for the cluster.
Successfully update node info for the cluster.
Reload new json to etcd.
Reload new json successfully.
Begin open cm update node info.
Successfully open cm update node info.
Starting cluster.
Successfully starting the cluster.
Starting cluster successfully.
Open the CM heartbeat about CN.
Expand is completed.omm@plat1:~> gs_expand -X /opt/software/gaussdb/ClusterConfig_diatation.xml --meta-dn=DB1_1 --meta-cn=cn_401 --tablespace-map-file=/home/omm/replace_tbs.json
Check ssh trust.
Successfully check ssh trust.
Check time consistency.
Successfully check time consistency.
Get cluster status.
Successfully get cluster status.
Check cluster open status.
Successfully check cluster open status.
Compare config file.
Compare config file successfully.
Get new instances.
Successfully get new instances.
Export metadata from cn_401.
Successfully export metadata.
Check tablespace map info about cn_401.
Successfully checked tablespace map info about cn_401.
Export metadata from DB1_1.
Successfully export metadata.
Check tablespace map info about DB1_1.
Successfully checked tablespace map info about DB1_1.
Distribute tablespace map file to remote hosts.
Check the replace paths of tablespace on remote nodes.
Backing up cluster configuration.
Successfully backed up cluster configuration.
Distribute ETCD keys to new host.
Distribute ETCD keys to new host successfully.
Close the CM heartbeat about CN.
Install new hosts.
Install new hosts successfully.
Initialize new instances.
..........70s
Initialize new instances successfully.
Build standby database.
Config standby DN of new instances.
...123s
Config standby DN of new instances successfully.
Build standby database successfully.
Config applications.
Config applications successfully.
Import metadata into new instances.
Successfully import metadata into new instances.
Update zhba.conf.
Successfully update zhba.conf.
Begin close cm update node info.
Successfully close cm update node info.
Update node info for the cluster.
Successfully update node info for the cluster.
Reload new json to etcd.
Reload new json successfully.
Begin open cm update node info.
Successfully open cm update node info.
Starting cluster.
Successfully starting the cluster.
Starting cluster successfully.
Open the CM heartbeat about CN.
Expand is completed.来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3135346/ ,如需转载,请注明出处,否则将追究法律责任。