Home >System Tutorial >LINUX >Management and maintenance of RHCS cluster
Introduction | Managing and maintaining an RHCS cluster is a very complex and tedious task. To maintain a RHCS cluster well, you must be familiar with the basic operating principles of RHCS. In terms of cluster management, RHCS provides two methods: Luci graphics Interface mode and command line mode, here we focus on how to manage the RHCS cluster under the command line. |
The core processes of the RHCS cluster are cman and rgmanager. To start the cluster, start cman in sequence, and then start rgmanager. The operation is as follows:
Start the cluster service on host web1:
[root@web1 ~]# service cman start Starting cluster: Loading modules... done Mounting configs... done Starting ccsd... done Starting cman... done Starting qdiskd...done Starting daemons...done Starting fencing... done [ OK ]
After cman is successfully started on other nodes, start the rgmanager service. The specific operations are as follows:
[root@web1 ~]# service rgmanager start Starting Cluster Service Manager: [ OK ]Close the RHCS cluster
Just the opposite of starting the cluster server, the command to shut down the RHCS cluster is as follows:
[root@web1 ~]# service rgmanager stop [root@web1 ~]# service cman stop
Sometimes when closing the cman service, a failure message may be displayed. At this time, you can check whether the local shared storage GFS2 file system has been uninstalled, and you can also check whether all rgmanager services on other nodes have been shut down normally.
Manage application servicesAfter the cluster system is started, the application service is automatically started by default. However, if an application service does not start automatically, it needs to be started manually. The command to manage application services is clusvcadm. Through these commands, you can start, shut down, restart, and switch Del application services in cluster services.
Start an applicationYou can start the application service on a node in the following ways, taking starting wrbserver as an example:
[root@web1 ~]#clusvcadm -e webserver -m web1 Member web1 trying to enable service:webserver...Success service:webserver is now running on web1Close an application
You can shut down the application service on a node in the following ways, taking starting mysqlserver as an example:
[root@mysql1 ~]#clusvcadm -s mysqlserver -m web1 Member mysql1 stopping service:mysqlserver...SuccessRestart an application
You can restart the application service on a node in the following ways, taking starting wrbserver as an example:
[root@web2 ~]#clusvcadm -R wrbserver -m web1 Member web1 trying to restart service:wrbserver...Success
This command is executed on the web2 node, and can also restart the wrbserver on the web1 node. It can be seen that the clusvcadm command can be executed on any node in the cluster.
Switch an applicationYou can switch the application service on a certain node in the following ways, taking the service switching from node web1 to node web2 as an example:
[root@web1 ~]# clusvcadm -r wrbserver -m web2 Trying to relocate service:webserver to web2...Success service:webserver is now running on web2Monitor RHCS cluster status
Monitoring RHCS helps to understand the health status of each node in the cluster, identify problems and solve them in a timely manner. The RHCS cluster provides a wealth of status viewing commands. Here we mainly introduce how to use cman_tool, clustat, and ccs_tool.
cman_tool commandcman_tool has many parameters, but its usage is relatively simple. Here we introduce how to use two parameters:
[root@web1 ~]# cman_tool nodes -a Node Sts Inc Joined Name 0 M 0 2010-08-23 01:24:00 /dev/sdb7 1 M 2492 2010-08-23 01:22:43 web2 Addresses: 192.168.12.240 2 M 2492 2010-08-23 01:22:43 Mysql1 Addresses: 192.168.12.231 3 M 2492 2010-08-23 01:22:43 Mysql2 Addresses: 192.168.12.232 4 M 2488 2010-08-23 01:22:43 web1 Addresses: 192.168.12.230
This command displays the node name, the corresponding node IP address and the time it joined the cluster.
If you want to know more cluster node information, you can use the following command:
[root@web1 ~]# cman_tool status Version: 6.2.0 Config Version: 35 #集群配置文件版本号 Cluster Name: mycluster #集群名称 Cluster Id: 56756 Cluster Member: Yes Cluster Generation: 2764 Membership state: Cluster-Member Nodes: 4 #集群节点数 Expected votes: 6 #期望的投票数 Quorum device votes: 2 #表决磁盘投票值 Total votes: 6 #集群中所有投票值大小 Quorum: 4 #集群法定投票值,低于这个值,集群将停止服务 Active subsystems: 9 Flags: Dirty Ports Bound: 0 177 Node name: web1 Node ID: 4 #本节点在集群中的ID号 Multicast addresses: 239.192.221.146 #集群广播地址 Node addresses: 192.168.12.230 #本节点对应的IP地址clustat command
The clustat command is very simple to use. For detailed usage, you can get help information through "clustat -h". Here are just a few examples.
[root@web1 ~]#clustat -i 3 Cluster Status for mycluster @ Mon Aug 23 18:54:15 2010 Member Status: Quorate Member Name ID Status ------ ---- ---- ------ web2 1 Online, rgmanager Mysql1 2 Online, rgmanager Mysql2 3 Online, rgmanager web1 4 Online, Local, rgmanager /dev/sdb7 0 Online, Quorum Disk Service Name Owner (Last) State ------- ---- ----- ------ -------- service:mysqlserver Mysql1 started service:webserver web1 started
The meaning of the output content is as follows:
The "-i" parameter of clustat can display the running status of each node and service in the cluster system in real time. "-i 3" means to refresh the cluster status every three seconds.
In this output, you can see that each node is in the "Online" state, indicating that each node is running normally. If a node exits the cluster, the corresponding status should be "Offline". You can also see that the cluster The two services are also in the "started" state, running on the Mysql1 node and web1 node respectively.
In addition, you can know the corresponding relationship of the cluster nodes through the "ID" column. For example, web2 corresponds to the "Node 1" node in this cluster. Similarly, web1 corresponds to the "Node 4" node. Understanding the cluster node order helps interpret cluster logs.
ccs_tool is mainly used to manage the cluster configuration file cluster.conf. Through ccs_tool, you can add/delete nodes, add/delete fence devices, update cluster configuration files and other operations in the cluster.
The following are several application examples of ccs_tool:
After modifying the configuration file on one node, you can execute the "ccs_tool update" command to update the configuration file on all nodes, for example:
[root@web1 cluster]# ccs_tool update /etc/cluster/cluster.conf Proposed updated config file does not have greater version number. Current config_version :: 35 Proposed config_version:: 35 Failed to update config file.
ccs_tool是根据cluster.conf中的“config_version”值来决定是否进行更新的,因此在修改完cluster.conf文件后,一定要将cluster.conf的config_version值进行更新,这样执行ccs_tool时才能更新配置文件。
[root@web1 cluster]# ccs_tool update /etc/cluster/cluster.conf Config file updated from version 35 to 36 Update complete.
本文原创地址:https://www.linuxprobe.com/management-maintenance-rhcs.html作者:冯琪,审核员:苏西云
本文原创地址:https://www.linuxprobe.com/management-maintenance-rhcs.html编辑:public,审核员:暂无
The above is the detailed content of Management and maintenance of RHCS cluster. For more information, please follow other related articles on the PHP Chinese website!