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

[经验分享] CentOS 6.5安装部署Glusterfs

[复制链接]

尚未签到

发表于 2019-2-1 10:32:07 | 显示全部楼层 |阅读模式
  环境介绍:
Server:10.10.0.200 kvm200
Client1:10.10.0.201    kvm201
Client1:10.10.0.202    kvm202
  

  1、首先部署Server端
  主机名、网络配置、SELinux
[root@kvm200 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=kvm200.test.com[root@kvm200 ~]# vi /etc/idmapd.conf
[General]
#Verbosity = 0# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
Domain = test.com[root@kvm200 ~]# hostname kvm200.test.com
kvm200.test.com[root@kvm200 ~]# hostname --fqdn
kvm200.test.com  如果--fqdn能得到完整域名,即表示主机配置成功。
  

  2、关闭SELinux
[root@kvm200 network-scripts]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled    #将此处设置为permissive或者disable都是可以的。
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted[root@kvm200 network-scripts]# setenforce 0     #立即生效  Client1、Client2同样操作设置主机名、Seliux
  

  3、NTP服务器
  如果你的server可以连网,并且可以同步时间,这个步骤可以忽略。如果是本地的环境,那则需要有一台NTP服务器,用来同步主机间的时间。
  此处将kvm200设置为NTP服务器
root@kvm200 network-scripts]# vi /etc/ntp.conf
# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1restrict -6 ::1restrict 0.0.0.0 mask 0.0.0.0  nomodify notrap  noquery  
restrict 192.168.166.0 mask 255.255.255.0 nomodify# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburstserver 210.72.145.44 prefer
server  127.127.1.0
fudge   127.127.1.0 stratum 8
#图中红色部分的字体是新添加的。保存后重启ntp服务[root@kvm200 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]  

  客户端修改配置文件并手动同步:
[root@kvm201 ~]# vi /etc/ntp.conf
......
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst192.168.30.200 iburst    #此处为ntp服务器的IP地址,要求能通信。如果不能通信则是服务器的iptables问题,后续我们将开放iptables端口。[root@kvm201 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ][root@kvm201 ~]# ntpdate -u 192.168.30.200  #手动同步时间,或者等待系统自动同步也可,但等待时间可能较长,同步机制可谷歌NTP服务器介绍  NTP服务器搭建完成后。基本的环境配置已经完成。下面就是存储服务器的安装了、
  

  4、IPtables防火墙设置以及修改挂载文件和创建挂载文件夹
  4.1、修改每台防火墙设置为
root@kvm200 ~]# iptables -I INPUT 1 -s 10.10.0.0/16 -j ACCEPT
[root@kvm200 ~]# service iptables save
[root@kvm200 ~]# service iptables restart  4.2 修改挂载文件:/etc/fstab  在此文件中最后添加两行(此处建设时已规划好,在后续就使用此文件夹来挂载存储系统)
[root@kvm200 ~]# vi /etc/fstab
10.12.0.200:/Mian       /primary               glusterfs       defaults,_netdev       0 0  4.3 存储服务器
  搭建Gluster服务器之前,我们先配置Gluster源,之后去下载安装包
[root@kvm200 ~]# cd /etc/yum.repos.d/
[root@kvm200 yum.repos.d]# wget http://download.gluster.org/pub/gluster/glusterfs/3.6/LATEST/CentOS/glusterfs-epel.repo
[root@kvm200 yum.repos.d]# cd ~
[root@kvm200 ~]# wget http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
[root@kvm200 ~]# rpm -ivh epel-release-latest-6.noarch.rpm
[root@kvm200 ~]# yum -y install glusterfs-server
[root@kvm200 ~]# /etc/init.d/glusterfsd restart  

  安装完成之后,下面安装其它2台客户端:(注意:其它三台也需要先安装下面的才可以继续进行去。主要安装:glusterfs glusterfs-server glusterfs-fuse三个软件包)
[root@kvm201 ~]# cd /etc/yum.repos.d/[root@kvm201 yum.repos.d]# wget -P
[root@kvm201 yum.repos.d]# cd ~[root@kvm201 ~]# wget ftp://ftp.pbone.net/mirror/dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm
[root@kvm201 ~]# rpm -ivh epel-release-6-8.noarch.rpm
[root@kvm201 ~]# yum install glusterfs glusterfs-fuse glusterfs-server
[root@kvm200 ~]# /etc/init.d/glusterfsd restart  

  上面的步骤做完后,我们回到kvm200机器上,将它们(200、201)加入gluster节点,并创建存储卷:
[root@kvm200 ~]# gluster peer probe 10.12.0.201
[root@kvm200 ~]# gluster peer probe 10.12.0.202
[root@kvm200 ~]# gluster volume create Mian stripe 2 10.12.0.201:/storage 10.12.0.202:/storage force
[root@kvm200 ~]# gluster volume start Mian  (如果加节点时报错,可能跟防火墙有关,请检查各个主机的防火墙设置。)

  

  查看状态:
[root@kvm200 ~]# gluster volume status
Status of volume: Mian
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick 10.12.0.200:/storage                  49152     0          Y       3512
Brick 10.12.0.201:/storage                  49152     0          Y       3417
Task Status of Volume Mian
------------------------------------------------------------------------------
There are no active volume tasks
[root@kvm200 ~]# gluster peer status
Number of Peers: 4Hostname: 10.12.0.204
Uuid: 23194295-4168-46d5-a0b3-8f06766c58b4
State: Peer in Cluster (Connected)
Hostname: 10.12.0.202
Uuid: de10fd85-7b85-4f28-970b-339977a0bcf6
State: Peer in Cluster (Connected)
Hostname: 10.12.0.201
Uuid: 0cd18fe2-62dd-457a-9365-a7c2c1c5c4b2
State: Peer in Cluster (Connected)
Hostname: 10.12.0.203
Uuid: d160b7c3-89de-4169-b04d-bb18712d75c5
State: Peer in Cluster (Connected)  到此Glusterfs就已经全部部署完毕,使用mount在需要使用挂载的机器上进行挂载!
  

  

  

  

  

  





运维网声明 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-670354-1-1.html 上篇帖子: Centos 6.5 部署 GlusterFS 下篇帖子: CentOS 7 搭建GlusterFS
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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