Thứ Ba, 18 tháng 9, 2018

Share LUN giữa các host

Từ bước 1 -> 5 các bước này thực hiện trên tất cả các host
1. Cài đặt
yum install pcs pacemaker fence-agents-all -y
2. allow firewall
# firewall-cmd --permanent --add-service=high-availability
# firewall-cmd --add-service=high-availability
3. Đặt passwork cho user hacluster
# passwd hacluster
4. Start pcsd
# systemctl start pcsd.service
# systemctl enable pcsd.service
5. Add authentication trên mỗi hosts
[root@ubqlvnn-app01-48  ~]# pcs cluster auth ubqlvnn-app01-48 ubqlvnn-app02-49 ubqlvnn-app03-50 ubqlvnn-app04-51
Username: hacluster
6. thực hiện trên 1 host -> create cluster
pcs cluster setup --start --name my_cluster ubqlvnn-app01-48 ubqlvnn-app02-49 ubqlvnn-app03-50 ubqlvnn-app04-51
7. Enable run cluster service mỗi khi reboot
pcs cluster enable --all
start cluster service manual bằng pcs cluster start
8.Kiểm tra trạng thái của cluster
[root@ubqlvnn-app03-50 ~]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: ubqlvnn-app02-49 (version 1.1.18-11.el7_5.3-2b07d5c5a9) - partition with quorum
 Last updated: Fri Aug 31 23:18:42 2018
 Last change: Fri Aug 31 23:18:07 2018 by hacluster via crmd on ubqlvnn-app02-49
 4 nodes configured
 0 resources configured

PCSD Status:
  ubqlvnn-app03-50: Online
  ubqlvnn-app02-49: Online
  ubqlvnn-app04-51: Online
  ubqlvnn-app01-48: Online

8. Cấu hình STONITH trên cluster trên mỗi host
 pcs stonith create myapc fence_apc_snmp ipaddr="ubqlvnn-app01-48" pcmk_host_map="ubqlvnn-app01-48:1;ubqlvnn-app02-49:2;ubqlvnn-app03-50:3;ubqlvnn-app04-51:4" login="apc" passwd="apc"
 pcs stonith create myapc fence_apc_snmp ipaddr="ubqlvnn-app02-49" pcmk_host_map="ubqlvnn-app01-48:1;ubqlvnn-app02-49:2;ubqlvnn-app03-50:3;ubqlvnn-app04-51:4" login="apc" passwd="apc"
 pcs stonith create myapc fence_apc_snmp ipaddr="ubqlvnn-app03-50" pcmk_host_map="ubqlvnn-app01-48:1;ubqlvnn-app02-49:2;ubqlvnn-app03-50:3;ubqlvnn-app04-51:4" login="apc" passwd="apc" 
 pcs stonith create myapc fence_apc_snmp ipaddr="ubqlvnn-app04-51" pcmk_host_map="ubqlvnn-app01-48:1;ubqlvnn-app02-49:2;ubqlvnn-app03-50:3;ubqlvnn-app04-51:4" login="apc" passwd="apc"
9. Cài đặt trên tất cả các hosts
  yum install lvm2-cluster gfs2-utils
10. Set the global Pacemaker parameter no_quorum_policy to freeze.
  pcs property set no-quorum-policy=freeze
11. tạo 1 dlm resource trên 1 hosts
pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true
12. Thực hiện các câu lệnh sau trên tất cả các host
  /sbin/lvmconf --enable-cluster
13. Tạo 1 clvmd  resources
pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=true
14.Tạo constrain clvmd phải start sau dlm và phải chạy trên cùng 1 host dlm.
# pcs constraint order start dlm-clone then clvmd-clone
# pcs constraint colocation add clvmd-clone with dlm-clone
15. tạo lvm
# pvcreate /dev/sdb1
# vgcreate -Ay -cy cluster_vg /dev/sdb1
# lvcreate -L5G -n cluster_lv cluster_vg
16. format
mkfs.gfs2 -j4 -p lock_dlm -t my_cluster:gfs2 /dev/cluster_vg/cluster_lv
chú ý tùy chọn -j bằng số host muốn mount và my_cluster
17. Mount
pcs resource create clusterfs Filesystem device="/dev/cluster_vg/cluster_lv" directory="/mnt/shares" fstype="gfs2" "options=noatime" op monitor interval=10s on-fail=fence clone interleave=true
18. Tạo constraint clusterfs phải chạy sau clvmd, và phải cùng host clvmd
# pcs constraint order start clvmd-clone then clusterfs-clone
# pcs constraint colocation add clusterfs-clone with clvmd-clone

Share This!


Không có nhận xét nào:

Đăng nhận xét