1.1. 群集状态查看(clustat)
The clustat command displays the status of the cluster. It shows membership information, quorum view, and the state of all configured user services. The clustat command displays cluster status only from the viewpoint of the cluster system on which it is running.
常用参数-i,指定刷新间隔,可动态观察群集起停状态转变。如:clustat -i 2,每隔2秒钟刷新显示clustat输出。
1.2. cman管理工具(man_tool)
cman_tool is a program that manages the cluster management subsystem CMAN. cman_tool can be used to join the node to a cluster, leave the cluster, kill another cluster node or change the value of expected votes of a cluster. Be careful that you understand the consequences of the commands issued via cman_tool as they can affect all nodes in your cluster. Most of the time the cman_tool will only be invoked from your startup and shutdown scripts.
下图可看到db1上次被fenced的时间,以及使用的fence设备。
[root@db1 oradata]# cman_tool nodes -f
Node Sts Inc Joined Name
1 M 96 2010-09-02 15:04:11 db1.fjnet114.com
Last fenced: 2010-09-02 14:04:11 by ilo1
2 M 100 2010-09-02 15:04:11 db2.fjnet114.com
-------------------------------------------------------------------------------
[root@db1 home]# cman_tool status
Version: 6.1.0
Config Version: 8
Cluster Name: new_cluster
Cluster Id: 23732
Cluster Member: Yes
Cluster Generation: 104
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: db1.fjnet114.com
Node ID: 1
Multicast addresses: 239.192.92.17 //在RedHat 4中未发现多播地址;
Node addresses: 192.168.114.102
1.3. fence/dlm状态查看(group_tool)
The group_tool program displays the status of fence, dlm and gfs groups. The information is read from the groupd daemon which controls the fenced, dlm_controld and gfs_controld daemons. group_tool will also dump debug logs from various daemons.
此命令在redhat 4版本上没有。
[root@db1 oradata]# group_tool ls
type level name id state
fence 0 default 00010001 none
[1 2]
dlm 1 rgmanager 00020001 none
[1 2]
1.4. rgmanager资源测试(rg_test)
Cman对群集资源监控设置查看rg_test rules, /usr/share/cluster保留有部分应用默认监控脚本;
1、Display there source rules that rg_test understands. rg_test rules Test a configuration (and /usr/share/cluster) for errors or redundant resource agents.
rg_test test /etc/cluster/cluster.conf
2、Display the start and stop ordering of a service.Display start order:
rg_test noop /etc/cluster/cluster.conf start service servicename
这个命令在测试资源的依赖关系时很有用,使用rg_test --help看不到noop参数。在我环境下输出如下:
[root@db1 oradata]# rg_test noop /etc/cluster/cluster.conf start service wbdb_service
Running in test mode.
Starting wbdb_service...
[start] service:wbdb_service
[start] fs:oradata
[start] fs:orabackup
[start] ip:192.168.114.108
[start] script:Oracle
Start of wbdb_service complete
Display stop order:
rg_test noop /etc/cluster/cluster.conf stop service servicename
3、Explicitly start or stop a service.
Important Only do this on one node, and always disable the service in rgmanager
first. Start a service:
rg_test test /etc/cluster/cluster.conf start service servicename
Stop a service:
rg_test test /etc/cluster/cluster.conf stop service servicename
4、Calculate and display the resource tree delta between two cluster.conf files.查看2份cluster配置文件的资源目录结构和启停顺序。
rg_test delta cluster.conf file 1 cluster.conf file 2
For example:
rg_test delta /etc/cluster/cluster.conf.bak /etc/cluster/cluster.conf
1.5. 动态查看日志(tail –f)
该命令用以观察群集日志时特别有用,可看到群集何时进行磁盘mount,IP地址切换,服务启动等信息。
常用命令:
Tail –f /var/log/message
1.6. 测试fence设备配置(fence_node/fence_drac/…)
使用fence_node 命令进行fence配置测试,该命令将读取cluster.conf中关于fence设备的配置。
常用命令
/sbin/fence_node db1.fjnet114.com
/sbin/fence_node db2.fjnet114.com