打开五台虚拟机
每台虚拟机添加一块硬盘(25G即可)
打开虚拟机
添加hosts数据(centos01)
[root@centos01 ~]# vim /etc/hosts
192.168.100.10 centos01
192.168.100.20 centos02
192.168.100.30 centos03
192.168.100.40 centos04
192.168.100.50 centos05
使用scp互传到其他四台上去
[root@centos01 ~]# scp /etc/hosts root@192.168.100.20:/etc/hosts
[root@centos01 ~]# scp /etc/hosts root@192.168.100.30:/etc/hosts
[root@centos01 ~]# scp /etc/hosts root@192.168.100.40:/etc/hosts
[root@centos01 ~]# scp /etc/hosts root@192.168.100.50:/etc/hosts
分配磁盘空间(centos01)、
配置三个主分区
两个逻辑分区
一个扩展分区
[root@centos01 ~]# fdisk /dev/sdb
设置磁盘文件类型
[root@centos01 ~]# mkfs.xfs /dev/sdb1
[root@centos01 ~]# mkfs.xfs /dev/sdb2
[root@centos01 ~]# mkfs.xfs /dev/sdb3
[root@centos01 ~]# mkfs.xfs /dev/sdb4
[root@centos01 ~]# mkfs.xfs /dev/sdb5
[root@centos01 ~]# mkfs.xfs /dev/sdb6
添加完成后进行保存
循环创建多个目录
创建挂载点
[root@centos01 ~]# vim /etc/fstab
重启电脑
Reboot
为centos其他主机创建分区
安装服务Glusterfs
修改hosts文件
安装服务
[root@centos01 ~]# yum -y install glusterfs gluster
启动服务并设置开机自启
[root@centos01 ~]# systemctl start glusterd
[root@centos01 ~]# systemctl enable glusterd
创建集群
[root@centos01 ~]# gluster peer probe centos02
[root@centos01 ~]# gluster peer probe centos03
[root@centos01 ~]# gluster peer probe centos04
[root@centos01 ~]# gluster peer probe centos05
[root@centos01 ~]# gluster peer probe centos06
查看集群状态
[root@centos01 ~]# gluster peer status
创建分布式卷、条带卷、复制卷、分布式条带卷、分布式复制卷、(并启动)
客户端进行访问控制
创建挂载点
Mkdir /分布式
Mkdir /条带卷
Mkdir /复制卷
Mkdir /分布式条带卷
Mkdir /分布式复制卷
手动挂载一下
Mount –t glusterfs 192.168.100.10
设置自动挂载
Vim /etc /fstab
进行重启后查看
Df –Th
查看所有卷
[root@centos01 ~]# gluster volume list
启动、停止、删除、查看状态就可以了。