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服务器搭建完成后。基本的环境配置已经完成。下面就是存储服务器的安装了、
查看状态:
[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在需要使用挂载的机器上进行挂载!