RedHat6 仲裁盘Qdisk
实验目的:
掌握仲裁盘的理论和配置
实验理论:
仲裁盘(quorum disk)是微软推出概念
在存储上分一个10M的分区,运行qdisk服务,各个节点默认每10秒ping公共设备3次,只要有一次ping成功,就表示这个节点是活的,ping成功的给这个节点记一分,每记一分,都会把分数累加传到10M的分区里存着
仲裁盘机制(Qdisk)相当于心跳线的作用,判断集群中的节点是否正常工作,一旦检测到某个节点没有活,会让Fence设备把这个节点Fence掉
myqdisk相当于仲裁盘的卷标
缺点:
在集群坏境中,各个节点都默认会有一票,配置了这个仲裁盘的存储,这个存储也会有1票。
也就是说,你挂个1、2台(根据存活条件),可能整个集群就挂了。
实验步骤:
Node1:
在node1上对共享存储分一个10M的分区
[root@node1 ~]# fdisk /dev/mapper/clusterstorage
WARNING: DOS-compatible mode is deprecated.It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (29-261, default 29):
Using default value 29
Last cylinder, +cylinders or +size{K,M,G}(29-261, default 261): +10M
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition tablefailed with error 22: Invalid argument.
The kernel still uses the old table. Thenew table will be used at
the next reboot or after you runpartprobe(8) or kpartx(8)
Syncing disks.
[root@node1 ~]# partprobe /dev/mapper/clusterstoragep3 把clusterstoragep3分区写进内核生效
[root@node1 ~]# mkqdisk -c /dev/mapper/clusterstoragep3 -l myqdisk
mkqdisk v3.0.12.1 mkqdisk相当于mkfs.ext4的格式化,格式化成仲裁盘的格式 -c 对那个磁盘格式化 -l 填写仲裁盘的卷标
Writing new quorum disk label 'myqdisk' to/dev/mapper/clusterstoragep3.
WARNING: About to destroy all data on/dev/mapper/clusterstoragep3; proceed [N/y] ? y
Initializing status block for node 1...
Initializing status block for node 2...
Initializing status block for node 3...
Initializing status block for node 4...
Initializing status block for node 5...
Initializing status block for node 6...
Initializing status block for node 7...
Initializing status block for node 8...
Initializing status block for node 9...
Initializing status block for node 10...
Initializing status block for node 11...
Initializing status block for node 12...
Initializing status block for node 13...
Initializing status block for node 14...
Initializing status block for node 15...
Initializing status block for node 16...
Node2:
[root@node2 ~]# partprobe /dev/mapper/clusterstorage
[root@node2 ~]# fdisk -l
Disk /dev/mapper/clusterstoragep3: 16 MB,16450560 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk identifier: 0x00000000
集群套件RHCS:
点击应用
Node2:
实验效果:
[root@node2 ~]# mkqdisk -L
mkqdisk v3.0.12.1
/dev/block/253:6:
/dev/disk/by-id/dm-name-clusterstoragep3:
/dev/dm-6:
/dev/mapper/clusterstoragep3:
Magic: eb7a62c2
Label: myqdisk
Created: Fri Oct 16 21:10:26 2015
Host: node1.private.cluster0.example.com
KernelSector Size: 512
RecordedSector Size: 512
[root@node2 ~]# iptables -A OUTPUT -d 172.16.0.254 -j REJECT
[root@node2 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere 172.16.0.254 reject-withicmp-port-unreachable
配置了这个防火墙规则,node2会重启