首先需要关闭CentOS的防火墙和selinux,否则glusterfs将可能无法正常工作。
/etc/init.d/iptables status
会得到一系列信息,说明防火墙开着。
/etc/init.d/iptables stop
永久关闭:
chkconfig --level 35 iptables off
永久关闭SELinux
查看当前SELinux状态:/usr/bin/setstatus -v
编辑/etc/selinux/config,找到SELINUX 行修改成为:SELINUX=disabled:
# 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 - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
重启系统。
1,将glusterfs的yum源加入到本机中 wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/glusterfs-epel.repo2,通过glusterfs的yum源进行安装 yum -y install glusterfs{-fuse,-server,-geo-replication}3,启动glusterfs服务 service glusterd start4,将机器加入到glusterfs集群中 gluster peer probe ip 5,单机环境准备 mkdir -p /home/glusterfs6,创建分布式卷,两副本 gluster volume create gfs replica 2 10.10.10.1:/home/glusterfs 10.10.10.2:/home/glusterfs 7,启动分布式卷 gluster volume start gfs8,查看状态 gluster volume info9,挂载分布式存储 mount -t glusterfs 10.10.10.1:/gfs /home/share10,扩容(注意扩容的机器数量需要是副本数的整数倍) gluster volume add-brick gfs 10.10.10.3:/home/glusterfs 10.10.10.4:/home/glusterfs 11,ACK控制(需要用逗号隔开) gluster volume set gfs auth.allow 10.10.10.5,10.10.10.612,开启quota gluster volume quotagfs enable/disable13,对某一分区开启quota限制1GB的空间,如果达到quota,则会直接报错Disk quota exceeded,无法继续写入 gluster volume quota gfs limit-usage /test-quota 1GB14,查询quota gluster volume quotagfs list15,删除quota gluster volume quotagfs remove/test-quota16,开启profile工具 gluster volume profile gfs start/stop17,profile常用命令介绍 gluster volume profile gfs info18,删除卷 gluster volume stop gfs && gluster volume delete gfs