# server
sudo yum install glusterfs-server
# client
sudo yum install glusterfs
之后使用systemctl 启动服务器端即可:
sudo service glusterd restart
注意:第一次启动 glusterd 的时候需要注意修改glusterd 在 sysconfig 下的配置文件:
vi /etc/sysconfig/glusterd
GLUSTERD_LOGFILE="/var/log/glusterfs/glusterd.log"
GLUSTERD_LOGLEVEL="INFO"
注意: Log level 在 glusterfs v3.2.x 使用 INFO, 没有沿用 glusterfs v.3.1.x 里的默认值 NORMAL
你还需要增加 iptables 规则来允许客户端连接 gluster 服务器:
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 24007:24011 -j ACCEPT
比如你有机器 A (ip: 192.168.0.100) 和 B(ip: 192.168.0.101) 来做 glusterfs 服务器,在客户端上执行如下命令:
sudo gluster peer probe 192.168.0.100
sudo gluster peer probe 192.168.0.101
你可以使用 peer status 来查看状态:
sudo gluster peer status
你可以创建一个叫做 test-vol 的存储卷,在A 和 B 上各复制一份:
sudo gluster volume create test-vol replicate 2 192.168.0.100:/data 192.168.0.101:/data
启用并挂载即可使用 test-vol:
sudo gluster volume start test-vol
sudo mount.glusterfs 192.168.0.100:/test-vol /mnt/glusterfs
0 评论:
发表评论