8.4.2. 使用 scp 更新配置
要使用
scp
命令更新配置,请执行以下步骤:
- 在每个节点中如 第 8.1.2 节 “停止集群软件” 所述停止集群软件。例如:
[root@example-01 ~]#
service rgmanager stop
Stopping Cluster Service Manager: [ OK ] [root@example-01 ~]#service gfs2 stop
Unmounting GFS2 filesystem (/mnt/gfsA): [ OK ] Unmounting GFS2 filesystem (/mnt/gfsB): [ OK ] [root@example-01 ~]#service clvmd stop
Signaling clvmd to exit [ OK ] clvmd terminated [ OK ] [root@example-01 ~]#service cman stop
Stopping cluster: Leaving fence domain... [ OK ] Stopping gfs_controld... [ OK ] Stopping dlm_controld... [ OK ] Stopping fenced... [ OK ] Stopping cman... [ OK ] Waiting for corosync to shutdown: [ OK ] Unloading kernel modules... [ OK ] Unmounting configfs... [ OK ] [root@example-01 ~]# - 在集群的任意节点中编辑
/etc/cluster/cluster.conf
文件。 - 增加
config_version
属性参数即可更新该参数(例如:从config_version="2"
改为config_version="3">
)。 - 保存
/etc/cluster/cluster.conf
。 - 运行
ccs_config_validate
命令,根据集群方案(cluster.rng
)验证更新的文件。例如:[root@example-01 ~]#
ccs_config_validate
Configuration validates - 如果更新的文件有效,则请使用
scp
将其推广到每个集群节点的/etc/cluster/
文件中。 - 确认推广了更新的文件。
- 在每个节点中如 第 8.1.1 节 “启动集群软件” 所述启动集群软件。例如:
[root@example-01 ~]#
service cman start
Starting cluster: Checking Network Manager... [ OK ] Global setup... [ OK ] Loading kernel modules... [ OK ] Mounting configfs... [ OK ] Starting cman... [ OK ] Waiting for quorum... [ OK ] Starting fenced... [ OK ] Starting dlm_controld... [ OK ] Starting gfs_controld... [ OK ] Unfencing self... [ OK ] Joining fence domain... [ OK ] [root@example-01 ~]#service clvmd start
Starting clvmd: [ OK ] Activating VG(s): 2 logical volume(s) in volume group "vg_example" now active [ OK ] [root@example-01 ~]#service gfs2 start
Mounting GFS2 filesystem (/mnt/gfsA): [ OK ] Mounting GFS2 filesystem (/mnt/gfsB): [ OK ] [root@example-01 ~]#service rgmanager start
Starting Cluster Service Manager: [ OK ] [root@example-01 ~]# - 在任意集群节点中运行
cman_tool nodes
以确认那些节点是作为集群的成员运行(在状态列 "Sts" 中被标记为 "M")。例如:[root@example-01 ~]#
cman_tool nodes
Node Sts Inc Joined Name 1 M 548 2010-09-28 10:52:21 node-01.example.com 2 M 548 2010-09-28 10:52:21 node-02.example.com 3 M 544 2010-09-28 10:52:21 node-03.example.com - 在任意节点中使用
clustat
程序确认那些 HA 服务正常运行。另外clustat
可显示集群节点状态。例如:[root@example-01 ~]#
clustat
Cluster Status for mycluster @ Wed Nov 17 05:40:00 2010 Member Status: Quorate Member Name ID Status ------ ---- ---- ------ node-03.example.com 3 Online, rgmanager node-02.example.com 2 Online, rgmanager node-01.example.com 1 Online, Local, rgmanager Service Name Owner (Last) State ------- ---- ----- ------ ----- service:example_apache node-01.example.com started service:example_apache2 (none) disabled - 如果集群如预期运行,则您完成了配置更新。