分类: 服务器与存储
2014-08-28 09:58:08
存储端
yum安装
wget -P /etc/yum.repos.d
# yum -y install fuse fuse-libs glusterfs glusterfs-rdma glusterfs-server glusterfs-devel glusterfs-fuse glusterfs-extra-xlators
验证fuse安装:
# modprobe fuse //载入fuse模块
# dmesg | grep -i fuse //看到版本号就OK
源码安装
#tar zxvf tar zxvfglusterfs-3.2.5.tar.gz
# cdglusterfs-3.2.5
#./configure --prefix=/ //加上prefix配置文件在/etc下,不加会在/usr/local/etc下
#make&& make install
#ldconfig //如果不执行会报错:libglusterfs.so.0 找不到。
#glusterfs -V //查看版本,看是否安装完成。
/etc/init.d/glusterd start
/etc/init.d/glusterd stop
服务自启动
Red Hat-based Systems
chkconfig glusterd on
Debian-based Systems
update-rc.d glusterd defaults
Systems Other than Red Hat and Debain
echo "/etc/init.d/glusterd start" >> /etc/rc.local
添加节点到存储池
# glusterpeer probe SERVERNAME/IP
For example:
# gluster peer probe g2
Probe successful
# gluster peer probe g3
Probe successful
# gluster peer probe g4
Probe successful
察看状态
# gluster peer status
Number of Peers: 3
Hostname: g2
Uuid: 0fd210c8-60d5-4ef2-9120-e5f23923fbfe
State: Peer in Cluster (Connected)
Hostname: g3
Uuid: cf76a23b-11d4-4553-925e-6f7244091332
State: Peer in Cluster (Connected)
Hostname: g4
Uuid: 02418e07-0bd9-4f86-8d4c-e485837648e5
State: Peer in Cluster (Connected)
删除节点
# glusterpeer detach server
For example:
# gluster peer detach g4
Detach successful
卷分为以下几种类型:
Distributed
Replicated
Striped
Distributed Striped
Distributed Replicated
Distributed Striped Replicated
Striped Replicated
命令格式:
# gluster volume create NEW-VOLNAME [stripe COUNT] [replica COUNT]
[transport [tcp | rdma | tcp,rdma]] NEW-BRICK...
For example:创建 DistributedStriped Replicated Volumes 卷
# gluster volume create DSR-volume stripe 2 replica 2 transport tcp g1:/DSR1
g2:/DSR2 g3:/DSR3 g4:/DSR4 g1:/DSR5 g2:/DSR6 g3:/DSR7 g4:/DSR8
# 文件将会被分割为2份 stripe ,其中一个存储在g1:/DSR1和 g2:/DSR2 中,另外一个存储在 g3:/DSR3和g4:/DSR4 中,其中g1:/DSR1 和 g2:/DSR2 中的内容各自互为备份;g3:/DSR3 和g4:/DSR4 中的内容各自互为备份。
# gluster volume info
VolumeName: DSR-volume
Type:Distributed-Striped-Replicate
VolumeID: d27a7519-4a3c-444b-933f-d166924b94be
Status:Created
Numberof Bricks: 2 x 2 x 2 = 8 #第一个2代表distribute的数量;第二个2代表
stripe的数量;第三个则代表replica的数量。
Transport-type:tcp
Bricks:
Brick1:g1:/DSR1
Brick2:g2:/DSR2
Brick3:g3:/DSR3
Brick4:g4:/DSR4
Brick5:g1:/DSR5
Brick6:g2:/DSR6
Brick7:g3:/DSR7
Brick8:g4:/DSR8
# gluster volume start VOLNAME
Forexample:
# glustervolume start/stop DSR-volume
# 卷在启动后client才可以访问使用。