Linux RHCS 基础维护命令

本文只是介绍Linux RHCS最基本的一些维护命令,属于DBA应该了解的层面。

  1. 查看集群状态
  2. 集群正常启动
  3. 集群正常关闭
  4. 查看服务是否关闭开机启动

1. 查看集群状态

clustat
cman_tool status
cman_tool nodes -a

下面是这些命令查询的显示结果示例:

#1.1 clustat查看集群状态(最常用)
在节点1查看的,状态中的Local就在节点1上显示。
# clustat
Cluster Status for new_cluster @ Tue Sep  1 12:23:09 2015
Member Status: Quorate

 Member Name                                 ID   Status                         
 ------ ----                                 ---- ------
 heartdb1                                        1 Online, Local, rgmanager
 heartdb2                                        2 Online, rgmanager

 Service Name                                 Owner (Last)                                   State         
 ------- ----                                 ----- ------                                   -----         
 service:orares                               heartdb1                                       started    


#1.2 cman_tool status 查看
# cman_tool status
Version: 6.2.0
Config Version: 18
Cluster Name: new_cluster
Cluster Id: 23732
Cluster Member: Yes
Cluster Generation: 432
Membership state: Cluster-Member
Nodes: 2
Expected votes: 1
Total votes: 2
Quorum: 1  
Active subsystems: 8
Flags: 2node Dirty 
Ports Bound: 0 177  
Node name: heartdb1
Node ID: 1
Multicast addresses: 239.192.92.17 
Node addresses: 192.168.1.1 

#1.3 cman_tool 查看nodes信息
# cman_tool nodes -a
Node  Sts   Inc   Joined               Name
   1   M    404   2015-08-03 17:52:20  heartdb1
       Addresses: 192.168.1.1 
   2   M    432   2015-09-01 14:32:27  heartdb2
       Addresses: 192.168.1.2 

2. 集群正常启动

先启动cman,再启动rgmanager.

service cman start
service rgmanager start 

下面是集群正常启动过程示例:
注: 各节点先依次启动cman再依次启动rgmanager,注意启动顺序。

# service cman start
Starting cluster: 
   Loading modules... done
   Mounting configfs... done
   Starting ccsd... done
   Starting cman... done
   Starting daemons... done
   Starting fencing... done
[确定]

# service rgmanager start
启动 Cluster Service Manager:[确定]

3. 集群正常关闭

先关闭rgmanager,再关闭cman.

service rgmanager stop
service cman stop

下面是集群正常关闭过程示例:
注: 各节点先依次关闭rgmanager,再依次关闭cman,注意关闭顺序。

# service rgmanager stop
Shutting down Cluster Service Manager...
等待服务停止:[确定]
Cluster Service Manager is stopped.

# service cman stop
Stopping cluster: 
   Stopping fencing... done
   Stopping cman... done
   Stopping ccsd... done
   Unmounting configfs... done
[确定]

4. 查看服务是否关闭开机启动

chkconfig --list |grep cman
chkconfig --list |grep rgmanager

下面的查看结果都是关闭的:

# chkconfig --list |grep cman
cman            0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭
# chkconfig --list |grep rgmanager
rgmanager       0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭
posted @ 2015-09-01 16:10 AlfredZhao 阅读(...) 评论(...) 编辑 收藏