CentOS 6 yum 安装 GlusterFS 3.6

GlusterFS 安装至 o2o-gluster-1,o2o-gluster-2
============================================================
两台机组成GlusterFS Server集群。
1、安装依赖包
# yum -y install wget
# cd /etc/yum.repos.d/
# wget http://download.gluster.org/pub/gluster/glusterfs/3.6/LATEST/CentOS/glusterfs-epel.repo
# yum -y install epel-release

2、安装服务端 (o2o-gluster-1,o2o-gluster-2)
# yum install glusterfs-server
# service glusterd start 或 # /etc/init.d/glusterd start
# chkconfig glusterfsd on

**如果是o2o-gluster-1,o2o-gluster-2集群**
-----------------------------------------------
下面这行命令在一台服务器上执行即可,状态将同步到其他服务器
例如在o2o-gluster-1上执行
# gluster peer probe o2o-gluster-2
-----------------------------------------------

查看状态
# gluster peer status

注:已挂载独立硬盘分区到/gfs_data目录
在o2o-gluster-1和o2o-gluster-2中分别执行
# mkdir -p /gfs_data/glusterfs/brick1

**如果是o2o-gluster-1,o2o-gluster-2集群**
-----------------------------------------------
在o2o-gluster-1和o2o-gluster-2其中一台机器上执行
replica 指定副本数量
# gluster volume create gv0 replica 2 o2o-gluster-1:/gfs_data/glusterfs/brick1 o2o-gluster-2:/gfs_data/glusterfs/brick1
-----------------------------------------------

**如果是o2o-gluster-1单机**
-----------------------------------------------
gluster volume create gv0 o2o-gluster-1:/gfs_data/glusterfs/brick1
-----------------------------------------------

启动volume
# gluster volume start gv0

若要使用Cache
# gluster volume set gv0 performance.cache-size 1GB

# 可选项:配置ACL只允许指定IP访问集群,例如:
gluster volume set gv0 auth.allow 10.10.0.1,10.10.0.2
查看volume状态
# gluster volume status
# gluster volume info

3、**客户端**挂载远程文件系统 (以o2o-proxy-1为例)
查找 glusterfs 命令
# which glusterfs
/usr/sbin/glusterfs

如果glusterfs命令**不存在**,则安装glusterfs-client
# yum install glusterfs-client

挂载目录
# mkdir -p /data/gfs_data
# chown -R prod:prod /data/gfs_data

在客户机(例如o2o-proxy-1)上执行挂载命令(读写模式):
mount -t glusterfs -o rw o2o-gluster-1:/gv0 /data/gfs_data
注:ro:只读模式 rw:读写模式

设置为开机自动挂载
# vi /etc/fstab
追加
o2o-gluster-1:/gv0 /data/gfs_data glusterfs defaults,_netdev 0 0