centos7快速安装gluster

2024-11-16 11:35:07

1、以两台机器为例。ip hostname10.0.40.151 x110.0.40.151 x2在每台机器的host中添加10.0.40.151 x110.0.40.151 x2两行保存。

centos7快速安装gluster

2、以下命令在每台机器上都执行。执行命令,安装gluster存储库资源。# yum install centos-release-gluster

centos7快速安装gluster

3、每台机器上有用来做存储的磁盘。/dev/sdb(如果没有也没有关系,直接用本地一个目录来测试操作)

centos7快速安装gluster

4、格式化磁盘# mkfs.xfs -i size=512 /dev/sdb

centos7快速安装gluster

5、创建本地目录,并挂载上磁盘。#mkdir -p /test/bk1编辑文件#vi /et罕铞泱殳c/fstab添瑕铆幌约加以下一行。/dev/sdb /test/bk1 xfs defaults 1 2执行命令挂载#mount -a你可以直接mount挂载,但是当机器重启后挂载点就掉了,所以修改配置文件,永久挂载。#df -h 查看是否挂载。

centos7快速安装gluster

6、安装gluster server端# yum --enablerepo=centos-gluster*-test install glusterfs-server

centos7快速安装gluster

7、启动gluster#systemctl start glusterd#systemctl status glusterd #查看状态#systemctl enable glusterd #设置开机启动

centos7快速安装gluster

8、在x1机器上执行。#gluster peer probe x2或者在x2上执行#gluster peer probe x1

centos7快速安装gluster

9、创建卷。#mkdir /test/bk1/v1#gluster volume create volume1 replica 2 x1:/test/bk1/v1 x2:/test/bk1/v1 其中replica 2是副本数,一般是3副本。这里设置的2副本,会提示,是否继续,选择y

centos7快速安装gluster

10、启动卷。#gluster volume start volume1

centos7快速安装gluster

11、查看卷的信息#gluster volume info在两台机器上都可以看到该卷。

centos7快速安装gluster

12、将卷挂载到一个本地目录。(一般是在client端操作,这里直接在server端执行测试了)#mkdir /brick1#mount -t glusterfs x1:/volume1 /brick1/#df 查看同样在x2上也可以执行该操作。

centos7快速安装glustercentos7快速安装gluster

13、在x1往目录下写数据。# for i in `seq -w 1 100`; do 罕铞泱殳cp -rp /var/log/messages /brick1/copy-test-$i; done然后查看/brick1目录里面的数据。同样可以在x2的/brick1目录下看到这些数据。因为数据会写两份。

centos7快速安装gluster
猜你喜欢