首页 > 数据库 > > 服务端工具-gs_lcctl
GaussDB 200提供了gs_lcctl工具来实现逻辑集群功能,支持逻辑集群内的资源管控及逻辑集群间的数据互访。
gs_lcctl -t create --name=ngname {-h HOSTNAME | -f hostfile} [--upgrade] [--high-perform] [--non-interactive] [-l LOGFILE]说明:
gs_lcctl -t add --name=ngname {-h HOSTNAME | -f hostfile} [-l LOGFILE]说明:
gs_lcctl -t delete --name=ngname [-l LOGFILE]说明:
gs_lcctl -t delete --elastic-group [-h HOSTNAME | -f hostfile] [-l LOGFILE]说明:
gs_lcctl -t rollback --name=ngname [-l LOGFILE]说明:
该回滚操作只能回滚从其他版本升级到V300R002C00版本后创建的逻辑集群。其他回滚场景暂不支持。
gs_lcctl -t display [--lcname-only] [-l LOGFILE]说明:
gs_lcctl -? | --help显示版本信息
gs_lcctl -V | --version参数说明
gs_lcctl参数可以分为如下几类:
gs_lcctl命令参数类型。
取值范围:create,rollback,add,display,delete。
指定日志文件及存放路径。
默认值:$GAUSSLOG/om/gs_lcctl-YYYY-MM-DD_hhmmss.log
显示帮助信息。
显示版本号信息。
指定需要创建的逻辑集群名称。
取值范围:不包含特殊字符的字符串。
指定需要创建的逻辑集群包含的节点名称,中间用逗号分隔。
指定需要创建的逻辑集群包含的节点文件,文件每行为一个节点名称。
-h参数和-f参数只能同时指定一个。
如果从其他版本升级到当前版本,则必须指定该参数。
如果不指定,默认使用当前版本安装的集群。
用户自己保证该参数的正确使用。
检查用户指定的-h参数是否成环。
如果不指定,默认不检查-h参数值是否成环。
指定需要加节点的逻辑集群名称。
取值范围:不包含特殊字符的字符串。
指定需要加节点的逻辑集群包含的节点名称,中间用逗号分隔。
指定需要加节点的逻辑集群包含的节点文件,文件每行为一个节点名称。
-h参数和-f参数只能同时指定一个。
指定需要回滚的逻辑集群名称。
取值范围:不包含特殊字符的字符串。
该回滚操作只能回滚从其他版本升级到V300R002C00版本后创建的逻辑集群。其他回滚场景暂不支持。
是否只显示逻辑集群名称。
如果不指定,默认显示逻辑集群名称和逻辑集群对应的节点名称。
指定需要删除的逻辑集群名称。
是否是删除弹性集群。
如果不指定,默认不是删除弹性集群操作。
指定需要删除弹性集群中的节点名称,中间用逗号分隔。
指定需要删除弹性集群中的节点名称文件,文件每行为一个节点名称。
-h参数和-f参数只能同时指定一个。
创建逻辑集群,必须安装物理集群,并且集群状态正常。
perfadm@SIA1000124312:~> gs_install -X ${BIGDATA_HOME}/FusionInsight_MPPDB_6.5.1/install/FusionInsight-MPPDB-6.5.1/clusterconfig_dilatation.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
Installing the cluster.
Checking the installation environment on all nodes.
Installing applications on all nodes.
Successfully installed APP.
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
Starting cluster.
======================================================================
Successfully started primary instance. Wait for standby instance.
======================================================================
.
Successfully started cluster.
======================================================================
cluster_state : Normal
redistributing : No
node_count : 3
Coordinator State
normal : 3
abnormal :
GTM State
primary : 1
standby : 1
abnormal :
down :
Datanode State
primary : 3
standby : 3
secondary : 3
building :
abnormal :
down :
示例一:正常流程创建逻辑集群。
perfadm@SIA1000125810:~> gs_lcctl -t create --name=group1 -h SIA1000125810,SIA1000022034,SIA1000022033
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Preapring the backup directory.
Successfully preapred the backup directory.
Checking the cluster status.
Successfully checked the cluster status.
Checking the count of general nodegroup.
Successfully checked the general nodegroup.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Creating a logical cluster administrator.
Obtaining the user password.
Please enter password for the logic cluster user [group2].
Please enter password for logic cluster user.
Password:
Please enter password for logic cluster user again.
Password:
Successfully obtained the user password.
Successfully created a logical cluster administrator.
Creating a node group.
Obtaining the IP list of the node through the hostname list.
Successfully obtained the IP list of the node through the hostname list.
Obtaining DN instance info through the IP list.
Successfully obtained DN instance info through the IP list.
Successfully created a node group.
Creating a static configuration file for the logic cluster.
Successfully create a static configuration file for the logic cluster.
Configuring cgroup.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Loading the cgroup config file.
Successfully loaded the cgroup config file.
Successfully configured cgroup.
Successfully created a logic cluster.
示例二:创建过程中ctrl+C,然后重入继续ctrl+C。逻辑集群创建失败。
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t create --name=group1 -h SIA1000125810,SIA1000022034,SIA1000022033
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Preapring the backup directory.
Successfully preapred the backup directory.
Checking the cluster status.
Successfully checked the cluster status.
Checking the count of general nodegroup.
Successfully checked the general nodegroup.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Creating a logical cluster administrator.
Obtaining the user password.
Please enter password for the logic cluster user [group1].
Please enter password for logic cluster user.
Password:
Please enter password for logic cluster user again.
Password:
Successfully obtained the user password.
Successfully created a logical cluster administrator.
Creating a node group.
Obtaining the IP list of the node through the hostname list.
Successfully obtained the IP list of the node through the hostname list.
Obtaining DN instance info through the IP list.
Successfully obtained DN instance info through the IP list.
^CTraceback (most recent call last):
File "./gs_lcctl", line 3137, in <module>
main()
File "./gs_lcctl", line 3128, in main
runner.run()
File "./gs_lcctl", line 3099, in run
self.doCreateLC()
File "./gs_lcctl", line 2643, in doCreateLC
self.createNodegroupForCreate()
File "./gs_lcctl", line 1505, in createNodegroupForCreate
ignoreError = False)
File "/opt/software/VC_ronghe/script/gspylib/common/Common.py", line 3643, in remoteSQLCommand
(status1, output1) = commands.getstatusoutput(cmd)
File "/usr/lib64/python2.6/commands.py", line 56, in getstatusoutput
text = pipe.read()
KeyboardInterrupt
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t create --name=group1 -h SIA1000125810,SIA1000022034,SIA1000022033
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Checking whether the reentry command is consistent with the previous command.
Successfully checked whether the reentry command is consistent with the previous command.
Last time end with: Create node group.
Rolling back.
Deleting a logic cluster and cluster administrator.
Successfully deleted a logic cluster and cluster administrator.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Rollback is completed.
Preapring the backup directory.
Successfully preapred the backup directory.
Checking the cluster status.
Successfully checked the cluster status.
Checking the count of general nodegroup.
Successfully checked the general nodegroup.
Checking if cluster is locked.
Successfully checked if cluster is locked.
^CTraceback (most recent call last):
File "./gs_lcctl", line 3137, in <module>
main()
File "./gs_lcctl", line 3128, in main
runner.run()
File "./gs_lcctl", line 3099, in run
self.doCreateLC()
File "./gs_lcctl", line 2627, in doCreateLC
self.writeOperateStep(step)
File "/opt/software/VC_ronghe/script/gspylib/common/ParallelBaseOM.py", line 804, in writeOperateStep
self.sshTool.scpFiles(self.operateStepFile, self.operateStepDir, nodes)
File "/opt/software/VC_ronghe/script/gspylib/threads/SshTool.py", line 527, in scpFiles
(status, output) = commands.getstatusoutput(scpCmd)
File "/usr/lib64/python2.6/commands.py", line 56, in getstatusoutput
text = pipe.read()
KeyboardInterrupt
示例三:创建过程中ctrl+C,然后重入。逻辑集群创建成功。
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t create --name=group1 -h SIA1000125810,SIA1000022034,SIA1000022033
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Checking whether the reentry command is consistent with the previous command.
Successfully checked whether the reentry command is consistent with the previous command.
Last time end with: Cgroup lc.
Rolling back.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Rollback is completed.
Preapring the backup directory.
Successfully preapred the backup directory.
Checking the cluster status.
Successfully checked the cluster status.
Checking the count of general nodegroup.
Successfully checked the general nodegroup.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Creating a logical cluster administrator.
Obtaining the user password.
Please enter password for the logic cluster user [group1].
Please enter password for logic cluster user.
Password:
Please enter password for logic cluster user again.
Password:
Successfully obtained the user password.
Successfully created a logical cluster administrator.
Creating a node group.
Obtaining the IP list of the node through the hostname list.
Successfully obtained the IP list of the node through the hostname list.
Obtaining DN instance info through the IP list.
Successfully obtained DN instance info through the IP list.
Successfully created a node group.
Creating static config file and map cgroup.
Creating a static configuration file for the logic cluster.
Successfully create a static configuration file for the logic cluster.
Loading the cgroup config file.
Successfully loaded the cgroup config file.
Successfully created static config file and map cgroup.
Successfully created a logic cluster.
示例四:给指定逻辑集群增加节点。
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t add --name=group1 -h SIA1000125810,SIA1000022034,SIA1000022033
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Getting new and old nodes.
Successfully get new and old nodes.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Checking whether the -h parameter is valid.
Successfully checked whether the -h parameter is valid.
Successfully checked if hostname is looped.
Completing the initialization before performing the addition.
Deleting the table remaining after redistribution.
Getting all the databases.
Successfully deleted the table remaining after redistribution.
Successfully completed the initialization.
Stopping DN of new nodes.
Successfully stopped DN of new nodes.
Rebuilding new nodes.
Locking cluster.
Successfully locked cluster.
Restoring new nodes.
Successfully restored new nodes.
Successfully rebuild new nodes.
Doing post add.
Starting new nodes.
Successfully started new nodes.
Waiting for the cluster status to become normal.
.......
The cluster status is normal.
Unlocking cluster.
Successfully unlocked cluster.
Successfully posted add.
Creating a node group for add.
Successfully created a node group for add.
Updating cluster configuration.
Creating a static configuration file for the logic cluster.
Successfully create a static configuration file for the logic cluster.
Successfully updated cluster configuration.
Configuring cgroup.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Loading the cgroup config file.
Successfully loaded the cgroup config file.
Successfully configured cgroup.
Successfully add hostname to the logic cluster.
示例五:查询逻辑集群信息。
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t display
logic cluster name
--------------------------------
group2
示例六:查询逻辑集群信息,只显示逻辑集群名称。
perfadm@SIA1000124312:/opt/software/VC_ronghe/script> ./gs_lcctl -t -t display --lcname-only
logic cluster name | hostname
------------------------------------------------------------------------------------------------------
elastic_group | SIA1000124312
group2 | SIA1000124316 SIA1000124314
示例七:删除逻辑集群。
perfadm@test1:~> gs_lcctl -t delete --name=lc2
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Delete the logic cluster.
Completing the initialization before performing the delete.
Checking deleted nodes.
Successfully checked deleted nodes.
Checking the count of the nodegroup.
Successfully checked the count of the nodegroup.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Other user may be operating the lc2 now.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Successfully completed the initialization.
Drop the node group database object.
Drop all database schema.
Getting all the databases.
Successfully drop all database schema.
Drop all database object.
Successfully drop all database object.
Successfully drop the node group database object.
Deleting the lc name text file for the logic cluster.
Successfully deleted a lc name text file for the logic cluster.
Creating a lc name text file for the cluster.
Successfully create a lc name text file for the logic cluster.
Updating the lc name text file for the logic cluster.
Successfully updated a lc name text file for the logic cluster.
Unlocking cluster.
Successfully unlocked cluster.
Locking cluster.
Successfully locked cluster.
Waiting for the cluster status to become normal.
..
The cluster status is normal.
Unlocking cluster.
Successfully unlocked cluster.
Deleting logical cluster nodes.
Warning: Failed to delete temporary directory.
Successfully deleted logical cluster nodes.
Deleting the static configuration file for the logic cluster.
Successfully deleted a static configuration file for the logic cluster.
Successfully delete the logic cluster.
示例八:删除弹性集群。
perfadm@test1:~> gs_lcctl -t delete --elastic-group
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Successfully checked if hostname is looped.
Delete the logic cluster.
Completing the initialization before performing the delete.
Checking deleted nodes.
Successfully checked deleted nodes.
Checking the count of the nodegroup.
Successfully checked the count of the nodegroup.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Other user may be operating the elastic_group now.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Successfully completed the initialization.
Drop the node group database object.
Drop all database schema.
Getting all the databases.
Successfully drop all database schema.
Drop all database object.
Successfully drop all database object.
Successfully drop the node group database object.
Deleting the lc name text file for the logic cluster.
Successfully deleted a lc name text file for the logic cluster.
Creating a lc name text file for the cluster.
Successfully create a lc name text file for the logic cluster.
Updating the lc name text file for the logic cluster.
Successfully updated a lc name text file for the logic cluster.
Unlocking cluster.
Successfully unlocked cluster.
Locking cluster.
Successfully locked cluster.
Waiting for the cluster status to become normal.
...
The cluster status is normal.
Unlocking cluster.
Successfully unlocked cluster.
Deleting logical cluster nodes.
Warning: Failed to delete temporary directory.
Successfully deleted logical cluster nodes.
Successfully delete the logic cluster.
示例九:删除弹性集群中指定节点。
perfadm@test1:~> gs_lcctl -t delete --elastic-group -h test4,test5,test6
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Successfully checked if hostname is looped.
Delete the logic cluster.
Completing the initialization before performing the delete.
Checking deleted nodes.
Successfully checked deleted nodes.
Checking the count of the nodegroup.
Successfully checked the count of the nodegroup.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Other user may be operating the elastic_group now.
Checking if cluster is locked.
Successfully checked if cluster is locked.
Successfully completed the initialization.
Drop the node group database object.
Drop all database schema.
Getting all the databases.
Successfully drop all database schema.
Drop all database object.
Successfully drop all database object.
Successfully drop the node group database object.
Deleting the lc name text file for the logic cluster.
Successfully deleted a lc name text file for the logic cluster.
Creating a lc name text file for the cluster.
Successfully create a lc name text file for the logic cluster.
Updating the lc name text file for the logic cluster.
Successfully updated a lc name text file for the logic cluster.
Unlocking cluster.
Successfully unlocked cluster.
Locking cluster.
Successfully locked cluster.
Waiting for the cluster status to become normal.
..
The cluster status is normal.
Unlocking cluster.
Successfully unlocked cluster.
Deleting logical cluster nodes.
Warning: Failed to delete temporary directory.
Successfully deleted logical cluster nodes.
Successfully delete the logic cluster.
示例十:从弹性集群节点给逻辑集群扩容时停止DN失败。
1.问题定位:
在cms主节点上$GAUSSLOG/om/gs_lcctl-2019-01-25_201359.log查看日志: 扩容失败的原因是:
[2019-01-25 10:53:13.990792][gs_lcctl][ERROR]:[FAILURE] 172-31--241: Stopping instance. ========================================= cm_ctl: stop the node: 3, datapath: /srv/BigData/mppdb/data1/dummyslave1.
............ cm_ctl: stop instance failed in (300)s!
2.故障修复处理:
以集群用户omm登陆失败节点,kill掉停止不了的DN进程:
kill命令: ps ux | grep '\<datanode\>' | grep '/srv/BigData/mppdb/data1/dummyslave1' | grep -v grep | awk '{print $2}' | xargs -r kill -9 其中/srv/BigData/mppdb/data1/dummyslave1目录是停止失败的DN实例目录
3.重入进行从弹性集群往逻辑集群的扩容。
perfadm_R@testdb1:~> gs_lcctl -t add --name logic -h testdb6,testdb4,testdb5
Checking if the node name is in the physical cluster.
Checking host file.
Successfully checked host file.
Successfully checked if the node name is in the physical cluster.
Getting new and old nodes.
Successfully get new and old nodes.
Checking if the specified logic cluster has been created.
Successfully checked if the specified logic cluster has been created.
Checking whether the -h or -f parameter is valid.
Successfully checked whether the -h or -f parameter is valid.
Successfully checked if hostname is looped.
Completing the initialization before performing the addition.
Stopping DN of new nodes.
Successfully stopped DN of new nodes.
Rebuilding new nodes.
Locking cluster.
Successfully locked cluster.
Restoring new nodes.
Successfully restored new nodes.
Successfully rebuild new nodes.
Doing post add.
Starting new nodes.
Successfully started new nodes.
Waiting for the cluster status to become normal.
.
The cluster status is normal.
Unlocking cluster.
Successfully unlocked cluster.
Successfully posted add.
Creating a node group for add.
Successfully created a node group for add.
Updating cluster configuration.
Creating a static configuration file for the logic cluster.
Successfully create a static configuration file for the logic cluster.
Successfully updated cluster configuration.
Configuring cgroup.
Operating a logic cluster resource management configuration file.
Successfully operated a logic cluster resource management configuration file.
Loading the cgroup config file.
Successfully loaded the cgroup config file.
Successfully configured cgroup.
Successfully add hostname to the logic cluster.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3147056/ ,如需转载,请注明出处,否则将追究法律责任。