目标是部署mfs的master高可用,实现双机热备,首先搭建scsi共享存储,然后同步两个master端的存储,之后将mfsmaster中的数据迁移到iscsi共享存储中,使得两个mfs master端的数据保持一致。
1.mfs的master高可用
server4的chunk server停止,重新配置使其称为一个新的mfs master
[root@server4 mfs]# systemctl stop moosefs-chunkserver.service
[root@server4 ~]# yum install -y moosefs-master moosefs-cli
server3的iscsi共享存储准备
server3上新添加的硬盘分区删除掉,将mfs存储直接挂载到根分区上,使用空出来的硬盘做下一步的iscsi共享存储,注:若没有分区,则忽略
删除server3上新添加的硬盘分区开机自动挂载
[root@server3 ~]# vim /etc/fstab :开机自动挂载配置文件
[root@server3 ~] mount -a :编辑生效
删除硬盘分区(server2上新添加)
[root@server3 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x27ce7c8b
Device Boot Start End Blocks Id System
/dev/vdb1 2048 20971519 10484736 83 Linux
Command (m for help): d ##删除分区
Selected partition 1
Partition 1 is deleted
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
将mfs存储直接挂载到根分区上
[root@server3 ~]# systemctl stop moosefs-chunkserver
[root@server3 ~]# umount /mnt/chunk2/ :卸载前挂载
[root@server3 ~]# chown mfs.mfs /mnt/chunk2/
[root@server3 ~]# systemctl start moosefs-chunkserver :重启服务,mfs存储会挂载到根分区
2.iscsi部署
2.1 iscsi server (server3)配置
清除磁盘上的分区表
[root@server3 ~]# dd if=/dev/zero of=/dev/vdb bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000447115 s, 1.1 MB/s
安装并启动targetcli
[root@server3 ~]# yum install -y targetcli
[root@server3 ~]# systemctl start target.service 启动服务
iscsi 储存编辑
[root@server3 ~]# targetcli
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/backstores/block> ls
o- block ............................................................. [Storage Objects: 0]
/backstores/block> create my_disk /dev/vdb
Created block storage object my_disk using /dev/vdb.
/backstores/block> cd /iscsi
/iscsi> create iqn.2021-07.org.westos:target1
Created target iqn.2021-07.org.westos:target1.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> cd iqn.2021-07.org.westos:target1/
/iscsi/iqn.20...stos:target1> ls
o- iqn.2021-07.org.westos:target1 .............................................. [TPGs: 1]
o- tpg1 .......................................................... [no-gen-acls, no-auth]
o- acls ..................................................................... [ACLs: 0]
o- luns ............................................................