RHCS套件(ISCSI/SCSI)实现存储共享、CLVM/GFS2集群文件系统部署
程序员文章站
2024-03-08 14:49:46
...
1.安装共享存储需要的软件(yum源必须高级)
yum install scsi-* -y
2.在rhcs1上安装客户端iscsi-*
yum install iscsi-* -y
rhcs2操作相同
yum install iscsi-* -y
3.给rhcs3上添加一块硬盘,用来共享
fdisk -l(发现vda出现)
4.在文件里配置共享策略,开启服务,查看
vim /etc/tgt/targets.conf
38 <target iqn.2019-04.com.example:server.target1>
39 backing-store /dev/vda
40 </target>
/etc/init.d/tgtd start
Starting SCSI target daemon: [ OK ]
tgt-admin -s #查看信息
ps ax
1056 ? Ssl 0:00 tgtd
1059 ? S 0:00 tgtd
1090 pts/0 R+ 0:00 ps ax
5.在rhcs1和rhcs2上查看共享出的存储
iscsiadm -m discovery -t st -p 172.25.80.3
Starting iscsid: [ OK ]
172.25.80.3:3260,1 iqn.2019-04.com.example:server.target1
iscsiadm -m discovery -t st -p 172.25.8.3
Starting iscsid: [ OK ]
172.25.80.3:3260,1 iqn.2019-04.com.example:server.target1
6.在rhcs3上设置共享策略
vim /etc/tgt/targets.conf
38 <target iqn.2019-04.com.example:server.target1>
39 backing-store /dev/vda
40 initiator-address 172.25.80.1 ##只共享给172.25.80.1和2
41 initiator-address 172.25.80.2
42 </target>
/etc/init.d/tgtd restart ##重启服务
tgt-admin -s
ACL information:
172.25.8.1
172.25.8.2
7.重新发现一下存储
iscsiadm -m discovery -t st -p 172.25.8.3
172.25.8.3:3260,1 iqn.2019-04.com.example:server.target1
iscsiadm -m discovery -t st -p 172.25.8.3
172.25.8.3:3260,1 iqn.2019-04.com.example:server.target1
8.**存储
iscsiadm -m node -l
iscsiadm -m node -l
fdisk -l(会发现sdb出现)
fdisk -l
9.确定信息正确
vim /etc/lvm/lvm.conf
462 locking_type = 3
10.格式化设备
mkfs.ext4 /dev/sdb
11.挂载,修改主与组
mount /dev/sdb /var/lib/mysql/
chown mysql.mysql /var/lib/mysql/
[aaa@qq.com mysql]# ll -d /var/lib/mysql/
drwxr-xr-x 3 mysql mysql 4096 Apr 20 14:46 /var/lib/mysql/
12.开启mysql,产生新的文件
/etc/init.d/mysqld start
13.停止服务,卸载磁盘
/etc/init.d/mysqld stop
Stopping mysqld: [ OK ]
[aaa@qq.com mysql]# umount /var/lib/mysql/
umount: /var/lib/mysql: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
14.在网页上关闭apache服务,查询
[aaa@qq.com ~]# clustat
Cluster Status for westos_ha @ Sat Apr 23 14:51:27 2019
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
server1 1 Online, Local, rgmanager
server2 2 Online, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:apache (server1) disabled
15.网页配置见截图
16.测试
server2上mysql -p