注:使用源码安装的原因主要是使用yum安装glusterfs服务端时出现一些依赖库问题
10.85.3.113 glusterfs-1.example.com 10.85.3.114 glusterfs-2.example.com 10.85.3.115 glusterfs-3.example.com
# yum install autoconf automake bison cmockery2-devel dos2unix flex fuse-devel glib2-devel libacl-devel libaio-devel libattr-devel libcurl-devel libibverbs-devel librdmacm-devel libtirpc-devel libtool libxml2-devel lvm2-devel make openssl-devel pkgconfig pyliblzma python-devel python-eventlet python-netifaces python-paste-deploy python-simplejson python-sphinx python-webob pyxattr readline-devel rpm-build sqlite-devel systemtap-sdt-devel tar userspace-rcu-devel
# cd userspace-rcu-master # ./bootstrap # ./configure # make && make install # ldconfig
# cd /home/glusterfs-5.7
# cp -r libglusterfs/src /usr/local/include/glusterfs
# cp -r /home/glusterfs-xlators-master/xlators/glupy/ /home/glusterfs-5.7/xlators/features/
# cd /home/glusterfs-5.7
# ./autogen.sh # ./configure --without-libtirpc # ./configure --enable-gnfs # make # make install
在make的时候可能会遇到如下错误
../../../../contrib/userspace-rcu/rculist-extra.h:33:6: error: redefinition of ‘cds_list_add_tail_rcu‘ void cds_list_add_tail_rcu(struct cds_list_head *newp, ^ In file included from glusterd-rcu.h:15:0, from glusterd-sm.h:26, from glusterd.h:28, from glusterd.c:19: /usr/local/include/urcu/rculist.h:44:6: note: previous definition of ‘cds_list_add_tail_rcu‘ was here void cds_list_add_tail_rcu(struct cds_list_head *newp,
给下述文件的cds_list_add_tail_rcu函数加上条件编译即可
/usr/local/include/urcu/rculist.h /home/glusterfs-5.7/contrib/userspace-rcu/rculist-extra.h
#ifndef CDS_LIST_ADD_TAIL_CRU #define CDS_LIST_ADD_TAIL_CRU static inline void cds_list_add_tail_rcu(struct cds_list_head *newp, struct cds_list_head *head) { newp->next = head; newp->prev = head->prev; rcu_assign_pointer(head->prev->next, newp); head->prev = newp; } #endif
mkfs.xfs -i size=512 /dev/vdb mkdir -p /data/brick echo ‘/dev/vdb /data/brick xfs defaults 1 2‘ >> /etc/fstab mount -a && mount
# chkconfig glusterd on
# glusterd
# gluster peer probe glusterfs-1.example.com
# gluster peer probe glusterfs-2.example.com
# gluster peer probe glusterfs-3.example.com
# gluster peer status
gluster volume create volume-5G replica 3 glusterfs-1.example.com:/data/brick/glusterfs1 glusterfs-2.example.com:/data/brick/glusterfs2 glusterfs-3.example.com:/data/brick/glusterfs3 gluster volume start volume-5G
使用如下命令查看volume
gluster volume status
gluster volume info
容器环境下推荐Replicated 模式,更多信息参见官方文档,注意部分模式已经废弃
# yum install glusterfs-client -y
mount -t glusterfs glusterfs-1.example.com:/volume-5G /data/mounttest/ glusterfs --volfile-id=volume-5G --volfile-server=glusterfs-1.example.com /data/glusterfsclient
PS:
# rm -rf /data/brick/glusterfs1/.glusterfs/ # setfattr -x trusted.glusterfs.volume-id /data/brick/glusterfs1/
参考:
https://www.cnblogs.com/jicki/p/5801712.html
https://www.ibm.com/developerworks/cn/opensource/os-cn-glusterfs-docker-volume/index.html
https://jimmysong.io/kubernetes-handbook/practice/using-glusterfs-for-persistent-storage.html
原文:https://www.cnblogs.com/charlieroro/p/11204250.html