设为首页 收藏本站
查看: 1050|回复: 0

[经验分享] CentOS7下分布式系统GlusterFS安装配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-2-17 08:37:14 | 显示全部楼层 |阅读模式
一、主机规划
操作系统版本为CentOS 7.2.1511
node1:172.17.0.1 gfs1
node2:172.17.0.2 gfs2
node3:172.17.0.3 gfs3
node4:172.17.0.4 gfs
client:172.17.0.5

二、安装:
1.在node1-4上安装glusterfs-server
yum install -y centos-release-gluster38
yum install -y glusterfs glusterfs-server glusterfs-fuse

设置开机自启动并启动
systemctl enable glusterd.service
systemctl start glusterd.service

2.在gfs1-gfs4节点上配置整个GlusterFS集群,把各个节点加入到集群
vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.17.0.1  gfs1
172.17.0.2  gfs2
172.17.0.3  gfs3
172.17.0.4  gfs4

[iyunv@gfs1 ~]# gluster peer probe gfs1
[iyunv@gfs1 ~]# gluster peer probe gfs2
[iyunv@gfs1 ~]# gluster peer probe gfs3
[iyunv@gfs1 ~]# gluster peer probe gfs4

3.查看节点状态
[iyunv@gfs1 ~]#gluster peer status

4.在gfs{1-4}上创建数据存储目录
# mkdir -p  /usr/local/share/models

5.在gfs1上创建GlusterFS磁盘
注意:
加上replica 4就是4个节点中,每个节点都要把数据存储一次,就是一个数据存储4份,每个节点一份
如果不加replica 4,就是4个节点的磁盘空间整合成一个硬盘,
[iyunv@gfs1 ~]#gluster volume create models replica 4 gfs1:/usr/local/share/models gfs2:/usr/local/share/models gfs3:/usr/local/share/models gfs4:/usr/local/share/models force

6.启动
[iyunv@gfs1 ~]# gluster volume start models

客户端
1.部署GlusterFS客户端并mount GlusterFS文件系统
[iyunv@client ~]# yum install -y centos-release-gluster38
[iyunv@client ~]# yum install -y glusterfs glusterfs-fuse
[iyunv@client ~]# mkdir -p /mnt/models
[iyunv@client ~]# mount -t glusterfs -o ro gfs1:models /mnt/models/

2.查看效果
[iyunv@client ~]# df -h

3.观察分布式文件系统的效果
umount /mnt/models
mount -t glusterfs -o rw gfs1:models /mnt/models/
[iyunv@client ~]# cd /mnt/models/
[iyunv@client mnt]# for i in `seq -w 10`; do mkdir $i ; done
[iyunv@client models]# for i in `seq -w 10`; do mkdir $i ; done
[iyunv@client models]# ll
total 40
drwxr-xr-x 2 root root 4096 Feb 14 21:56 01
drwxr-xr-x 2 root root 4096 Feb 14 21:59 02
drwxr-xr-x 2 root root 4096 Feb 14 21:56 03
drwxr-xr-x 2 root root 4096 Feb 14 21:56 04
drwxr-xr-x 2 root root 4096 Feb 14 21:56 05
drwxr-xr-x 2 root root 4096 Feb 14 21:56 06
drwxr-xr-x 2 root root 4096 Feb 14 21:59 07
drwxr-xr-x 2 root root 4096 Feb 14 21:56 08
drwxr-xr-x 2 root root 4096 Feb 14 21:56 09
drwxr-xr-x 2 root root 4096 Feb 14 21:59 10

分别在4台Server上查看新建的文件夹同步情况
[iyunv@gfs1 ~]# ls /usr/local/share/models/ -l
total 0
drwxr-xr-x 2 root root 6 Feb 14 21:56 01
drwxr-xr-x 2 root root 6 Feb 14 21:59 02
drwxr-xr-x 2 root root 6 Feb 14 21:56 03
drwxr-xr-x 2 root root 6 Feb 14 21:56 04
drwxr-xr-x 2 root root 6 Feb 14 21:56 05
drwxr-xr-x 2 root root 6 Feb 14 21:56 06
drwxr-xr-x 2 root root 6 Feb 14 21:59 07
drwxr-xr-x 2 root root 6 Feb 14 21:56 08
drwxr-xr-x 2 root root 6 Feb 14 21:56 09
drwxr-xr-x 2 root root 6 Feb 14 21:59 10

可以看到4台服务器都同步过来了。

当单台Server出现故障,比如服务器断开连接的情况,创建一个文件需要比较长的时间。
但是当Server重新连上之后,文件可以及时的同步过来。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-343177-1-1.html 上篇帖子: GlusterFS 3.7.20发布说明 下篇帖子: CentOS 7 安装 GlusterFS
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表