基于docker部署glusterfs

作者:【吴业亮】

博客:https://wuyeliang.blog.csdn.net/

源代码

https://github.com/gluster/gluster-containers

下载代码

# git clone git@github.com:gluster/gluster-containers.git

# git checkout branch  分支

切换目录

cd gluster-containers-gluster

编译镜像

Fedora:
# docker pull gluster/gluster-fedora
CentOS:
# docker pull gluster/gluster-centos

创建目录

# mkdir -p /var/log/glusterfs /var/lib/glusterd /etc/glusterfs

启动容器

# docker run -v /etc/glusterfs:/etc/glusterfs:z -v /var/lib/glusterd:/var/lib/glusterd:z -v /var/log/glusterfs:/var/log/glusterfs:z -v /sys/fs/cgroup:/sys/fs/cgroup:ro -d --privileged=true --net=host -v /dev/:/dev gluster/gluster-centos

查看容器

# docker ps -a | grep gluster-centos   
a37063bef1d3        gluster/gluster-centos                                   "/usr/local/bin/upda…"   About a minute ago   Up About a minute                            thirsty_williamson

进入容器内部

$ docker exec -ti a37063bef1d3 bash
-bash-4.3# ps aux |grep glusterd
root 34 0.0 0.0 448092 15800 ? Ssl 06:01 0:00 /usr/sbin/glusterd -p /var/run/glusterd.pid
root 159 0.0 0.0 112992 2224 pts/0 S+ 06:22 0:00 grep --color=auto glusterd

-bash-4.3# gluster peer status
Number of Peers: 0

-bash-4.3# gluster --version


-bash-4.3# gluster peer probe  10.130.70.23
-bash-4.3# gluster peer probe  10.130.70.42
-bash-4.3# gluster volume create vol_distributed transport tcp \
10.130.70.15:/var/lib/glusterd/data \
10.130.70.23:/var/lib/glusterd/data \
10.130.70.42:/var/lib/glusterd/data force
-bash-4.3#  gluster volume start vol_distributed 
volume start: vol_distributed: success
-bash-4.3# gluster volume info 
 
Volume Name: vol_distributed
Type: Distribute
Volume ID: bc3fb891-f5c3-4db8-8a0c-94741ecb23ba
Status: Started
Snapshot Count: 0
Number of Bricks: 3
Transport-type: tcp
Bricks:
Brick1: 10.130.70.15:/var/lib/glusterd/data
Brick2: 10.130.70.23:/var/lib/glusterd/data
Brick3: 10.130.70.42:/var/lib/glusterd/data
Options Reconfigured:
transport.address-family: inet
nfs.disable: on

客户端:

yum -y install centos-release-gluster*
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-4.1.repo
yum install  -y  glusterfs-4.1.8  glusterfs-fuse-4.1.8
mount -t glusterfs 10.130.70.12:/vol_distributed /mnt
上一篇:GlusterFS-分布式存储集群部署


下一篇:GlusterFS分布式存储学习笔记