antony@notes:~/suse$ cat "Cluster-Managed-Storage.md"
Cluster Managed Storage
Cluster Managed Storage
Preface
本篇文章會主要會採取 Step by Step 和 ScreenShot 的方式介紹,如何建立與管理 Cluster Managed Storage
可以透過點擊以下目錄,選擇想看的內容,跳轉至特定章節
:::warning
:::spoiler {state=“open”} 目錄
[TOC]
:::
1. 設定 sle-ha-1 存取 san 上用於 DRBD 的 storage
Task 1: Connect sle-ha-1 to the iSCSI device to be used for the DRBD
- SSH 連線至 sle-ha-1
- 啟動 Yast 的 iSCSI initiator module
$ sudo yast2 iscsi-client- After writing configuration 的值改成 :
Restart

- 選擇 Connected Targets 選項
- 選擇 Add

- 輸入以下訊息 :
IP Address: 10.12.2.13
Port: 3260
No Discovery Authentication: Box checked- 選擇 Next

在 iSCSI Initiator Discovery 螢幕中會看到多個 targets
- 選擇
iqn.2023-11.com.example:app-disk1 - 選擇
Connect

- 把
Startup選項的值改成 :automatic - 選擇
Next→Next


- In the iSCSI Initiator Overview screens Connected Targets tab check the Start-up is set to automatic
- 點選 OK

Task 2: Check the iscsi configuration
- 檢查總共有 4 個連接,3 個是 sbd,另外一個是給 DRBD
$ sudo iscsiadm -m session螢幕輸出 :
tcp: [11] 10.12.2.13:3260,1 iqn.2023-11.com.example:sbd-disk1 (non-flash)
tcp: [12] 10.12.2.13:3260,1 iqn.2023-11.com.example:sdb-disk2 (non-flash)
tcp: [13] 10.12.2.13:3260,1 iqn.2023-11.com.example:sdb-disk3 (non-flash)
tcp: [14] 10.12.2.13:3260,1 iqn.2023-11.com.example:app-disk1 (non-flash)- 列出 scsi disks
$ lsscsi螢幕輸出 :
[0:0:0:0] disk QEMU QEMU HARDDISK 2.5+ /dev/sda
[2:0:0:0] cd/dvd QEMU QEMU DVD-ROM 2.5+ /dev/sr0
[3:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdb
[4:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdc
[5:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdd
[6:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sde- 檢查 persistent device names 和空間大小
$ lsblk螢幕輸出 :
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 8M 0 part
└─sda2 8:2 0 200G 0 part /boot/grub2/x86_64-efi
/home
/boot/grub2/i386-pc
/root
/var
/opt
/tmp
/usr/local
/srv
/.snapshots
/
sdb 8:16 0 1G 0 disk
└─mpathd 254:0 0 1G 0 mpath
sdc 8:32 0 1G 0 disk
└─mpathe 254:3 0 1G 0 mpath
sdd 8:48 0 1G 0 disk
└─mpathf 254:1 0 1G 0 mpath
sde 8:64 0 100G 0 disk
└─mpathb 254:2 0 100G 0 mpath
sr0 11:0 1 13.5G 0 rom2. Configure sle-ha-2 access to storage for DRBD
Task 1: Connect sle-ha-2 to the iSCSI device to be used for the DRBD
- SSH 連線至
sle-ha-2 - 啟動 Yast 的 iSCSI initiator module
$ sudo yast2 iscsi-client- After writing configuration 的值改成 :
Restart

- 選擇 Connected Targets 選項
- 選擇 Add

- 輸入以下訊息 :
IP Address: 10.12.2.13
Port: 3260
No Discovery Authentication: Box checked- 選擇 Next

在 iSCSI Initiator Discovery 螢幕中會看到多個 targets
- 選擇
iqn.2023-11.com.example:app-disk2 - 選擇
Connect

- 把
Startup選項的值改成 :automatic - 選擇
Next→Next


- In the iSCSI Initiator Overview screens Connected Targets tab check the Start-up is set to automatic
- 點選 OK

Task 2: Check the iscsi configuration
- 檢查總共有 4 個連接,3 個是 sbd,另外一個是給 DRBD
$ sudo iscsiadm -m session螢幕輸出 :
tcp: [11] 10.12.2.13:3260,1 iqn.2023-11.com.example:sbd-disk1 (non-flash)
tcp: [12] 10.12.2.13:3260,1 iqn.2023-11.com.example:sdb-disk2 (non-flash)
tcp: [13] 10.12.2.13:3260,1 iqn.2023-11.com.example:sdb-disk3 (non-flash)
tcp: [14] 10.12.2.13:3260,1 iqn.2023-11.com.example:app-disk2 (non-flash)- 列出 scsi disks
$ lsscsi螢幕輸出 :
[0:0:0:0] disk QEMU QEMU HARDDISK 2.5+ /dev/sda
[2:0:0:0] cd/dvd QEMU QEMU DVD-ROM 2.5+ /dev/sr0
[3:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdb
[4:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdc
[5:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sdd
[6:0:0:0] disk LIO-ORG IBLOCK 4.0 /dev/sde- 檢查 persistent device names 和空間大小
$ lsblk螢幕輸出 :
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 8M 0 part
└─sda2 8:2 0 200G 0 part /var
/tmp
/home
/root
/usr/local
/srv
/boot/grub2/i386-pc
/boot/grub2/x86_64-efi
/.snapshots
/opt
/
sdb 8:16 0 1G 0 disk
└─mpathd 254:1 0 1G 0 mpath
sdc 8:32 0 1G 0 disk
└─mpathe 254:2 0 1G 0 mpath
sdd 8:48 0 1G 0 disk
└─mpathf 254:3 0 1G 0 mpath
sde 8:64 0 100G 0 disk
└─mpathc 254:0 0 100G 0 mpath
sr0 11:0 1 13.5G 0 rom3. Create cluster IPaddr2 resources for DRBD
Task 1: Create the first IP address resource
- SSH 連線至 sle-ha-1
- open the crm shell in the configure context
$ sudo crm configure- 建立 IPaddr2 Resource
$ primitive p-IP_20 IPaddr2 \
params ip=10.12.2.20 nic=eth1 cidr_netmask=24 \
op start timeout=20 \
op stop timeout=20 \
op monitor interval=10 timeout=20- Commit the changes:
$ commit- Change to the resource context
$ cd ../resource- Show the status of the new resource
$ status p-IP_20螢幕輸出 :
resource p-IP_20 is running on: sle-ha-2Task 2: Create the second IP address resource
- In the crm shell change back to the configure context:
$ cd ../configure- 建立 IPaddr2 Resource
$ primitive p-IP_21 IPaddr2 \
params ip=10.12.2.21 nic=eth1 cidr_netmask=24 \
op start timeout=20 \
op stop timeout=20 \
op monitor interval=10 timeout=20- Commit the changes:
$ commit- Change to the resource context
$ cd ../resource- Show the status of the new resource
$ status p-IP_21螢幕輸出 :
resource p-IP_21 is running on: sle-ha-2- Exit the crm shell:
$ q4. Configure and test DRBD outside the cluster environment
Task 1: Create mount points for DRBD
- 在 sle-ha-1 上執行以下建立目錄的命令
$ sudo mkdir /drbdvol- 在 sle-ha-2 上執行以下建立目錄的命令
$ sudo mkdir /drbdvolTask 2: Configure DRBD using YaST
- 在 sle-ha-1 節點上找出測試 DRBD 用的 Disk 對應的 ID
$ sudo multipath -ll mpathb螢幕輸出 :
mpathb (360014053be325d33ebb4e7e966df3a4f) dm-2 LIO-ORG,IBLOCK
size=100G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
`- 6:0:0:0 sde 8:64 active ready running- 透過 ID 列出 Disk
$ ls -l /dev/disk/by-id/scsi-3600*螢幕輸出應該和以下類似 :
/dev/disk/by-id/scsi-360014053be325d33ebb4e7e966df3a4f -> ../../dm-2
/dev/disk/by-id/scsi-3600140552d947e312e24a4f8a9a0f9b1 -> ../../dm-1
/dev/disk/by-id/scsi-36001405c2d16cc2065f4004ac0a1c188 -> ../../dm-0
/dev/disk/by-id/scsi-36001405e9b0b982a26f493e97b88ca61 -> ../../dm-3確認
/dev/disk/by-id/scsi-360014053be325d33ebb4e7e966df3a4f對應的是測試 DRBD 用的 Disk
- Configure DRBD on sle-ha-1 using yast:
$ sudo yast2 drbd- At the Warning screen click
YES

- 讓 Booting option 保留預設值:
Off - Server Only Starts Manually,因為不要透過systemd去管理 DRBD

- 在左側選單選
Resource Configuration - 選擇
Add開始新增 DRBD configuration

- 輸入以下內容 :
- Resource Name:
r0 - Address Port:
10.12.2.20:7788 - Device:
/dev/drbd0 - Disk:
<enter the disk by id noted in step 2 above>- for example:
/dev/disk/by-id/scsi-360014053be325d33ebb4e7e966df3a4f
- for example:
- Meta-disk:
internal
- 點選
Save

- 開始新增 sle-ha-2 到 DRBD configuration
- 在 sle-ha-2 節點上找出測試 DRBD 用的 Disk 對應的 ID
$ sudo multipath -ll mpathc螢幕輸出 :
mpathc (36001405ee25a89d7a8a4df09f6a3a5f0) dm-0 LIO-ORG,IBLOCK
size=100G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
`- 6:0:0:0 sde 8:64 active ready running- 透過 ID 列出 Disk
$ ls -l /dev/disk/by-id/scsi-3600*螢幕輸出應該和以下類似 :
/dev/disk/by-id/scsi-3600140552d947e312e24a4f8a9a0f9b1 -> ../../dm-3
/dev/disk/by-id/scsi-36001405c2d16cc2065f4004ac0a1c188 -> ../../dm-1
/dev/disk/by-id/scsi-36001405e9b0b982a26f493e97b88ca61 -> ../../dm-2
/dev/disk/by-id/scsi-36001405ee25a89d7a8a4df09f6a3a5f0 -> ../../dm-0確認
/dev/disk/by-id/scsi-36001405ee25a89d7a8a4df09f6a3a5f0對應的是測試 DRBD 用的 Disk
- Continue configuring DRBD using yast. in the DRBD - Resource Basic Configuration screen click
Add - Complete the form using the details below:
- Name:
sle-ha-2

- 點選
OK,再輸入以下內容 :
- Resource Name:
r0 - Address Port:
10.12.2.21:7788 - Device:
/dev/drbd0 - Disk:
<enter the disk by id noted in step 12 above>- for example:
/dev/disk/by-id/scsi-36001405ee25a89d7a8a4df09f6a3a5f0
- for example:
- Meta-disk:
internal








