MFS分布式存储系统----iscsi共享存储、master高可用部署

1. 环境准备

我们的目标是部署mfs的master高可用,首先我们需要搭建一个iscsi共享存储,然后同步两个master端的存储,之后将mfs master中的数据迁移到iscsi共享存储中,使得两个mfs master端的数据保持一致。
server4上的chunk server停止,重新配置使其称为一个新的mfs master:

[root@server4 ~]# yum install -y moosefs-master moosefs-cli

[root@server3 ~]# vim /etc/fstab  ##server3上新添加的硬盘分区删除掉,将mfs存储直接挂载到根分区上,使用空出来的硬盘做下一步的iscsi共享存储:
[root@server3 ~]# systemctl stop moosefs-chunkserver
[root@server3 ~]# umount /mnt/chunk2/
[root@server3 ~]# chown mfs.mfs /mnt/chunk2/
[root@server3 ~]# systemctl start moosefs-chunkserver
[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.

在这里插入图片描述

2. iscsi部署

2.1 服务端部署

选择server3作为服务端来配置iscsi共享存储

[root@server3 ~]# dd if=/dev/zero of=/dev/vdb bs=512 count=1  ##清除磁盘上的分区表,因为iscsi输出的是存储块
[root@server3 ~]# yum install -y targetcli
[root@server3 ~]# systemctl start target.service  ##启动服务
[root@server3 ~]# targetcli
/> ls
/> cd backstores/
/backstores> cd block 
/backstores/block> create my_disk /dev/vdb
Created block storage object my_disk using /dev/vdb.
/backstores/block> ls
/backstores/block> cd /
/> ls
/> cd /iscsi 
/iscsi> ls
/iscsi> create iqn.2021-04.org.westos:storage1
Created target iqn.2021-04.org.westos:storage1.
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-04.org.westos:storage1/
/iscsi/iqn.20...stos:storage1> cd tpg1/
/iscsi/iqn.20...storage1/tpg1> cd acls 
/iscsi/iqn.20...ge1/tpg1/acls> create iqn.2021-04.org.westos:client
Created Node ACL for iqn.2021-04.org.westos:client
/iscsi/iqn.20...ge1/tpg1/acls> cd ..
/iscsi/iqn.20...storage1/tpg1> cd luns 
/iscsi/iqn.20...ge1/tpg1/luns> /backstores/block/my_disk/
/backstores/block/my_disk> cd /
/> cd /iscsi/
/iscsi> cd iqn.2021-04.org.westos:storage1/tpg1/luns 
/iscsi/iqn.20...ge1/tpg1/luns> create /backstores/block/my_disk 
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2021-04.org.westos:client
/iscsi/iqn.20...ge1/tpg1/luns> ls
o- luns ....................................................................................................... [LUNs: 1]
  o- lun0 ................................................................. [block/my_disk (/dev/vdb) (default_tg_pt_gp)]
/iscsi/iqn.20...ge1/tpg1/luns> cd ..
/iscsi/iqn.20...storage1/tpg1> cd ..
/iscsi/iqn.20...stos:storage1> ls
o- iqn.2021-04.org.westos:storage1 ............................................................................ [TPGs: 1]
  o- tpg1 ........................................................................................ [no-gen-acls, no-auth]
    o- acls ................................................................................................... [ACLs: 1]
    | o- iqn.2021-04.org.westos:client ................................................................. [Mapped LUNs: 1]
    |   o- mapped_lun0 ........................................................................ [lun0 block/my_disk (rw)]
    o- luns .................................................................
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值