Last active
January 31, 2017 00:01
-
-
Save djmaze/6413373a8cf4408fb8f6 to your computer and use it in GitHub Desktop.
Docker w/GlusterFS volume driver on Scaleway C1 servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. For the server, use the "Docker" base image from the ImageHub (https://www.scaleway.com/de/imagehub/docker/) | |
# 1. Install https://github.com/calavera/docker-volume-glusterfs | |
# Alternatively, just download the prebuilt executable from https://gobuilder.me/get/github.com/calavera/docker-volume-glusterfs/docker-volume-glusterfs_master_linux-arm.zip | |
apt-get -y install golang | |
export GOPATH=~/go | |
go get github.com/calavera/docker-volume-glusterfs | |
mv go/bin/docker-volume-glusterfs /usr/local/bin/ | |
# 2. Install GlusterFS | |
apt-get install -y glusterfs-server | |
# 3. Now, start the docker-volume-glusterfs plugin | |
modprobe fuse | |
docker-volume-glusterfs -servers 127.0.0.1 | |
# Repeat steps 1-3 on as many servers as you like. | |
# 4. Create Gluster volume | |
LOCAL_IP=$(ip a show dev eth0 scope global | grep inet | awk -F '[ /]*' '{print $3}') | |
gluster volume create datastore ${LOCAL_IP}:/datastore force | |
gluster volume set datastore nfs.disable true | |
gluster volume set datastore auth.allow 127.0.0.1 | |
# 5. Adding a second GlusterFS server | |
# From the first server: | |
glustr peer probe <INTERNAL IP OF 2ND SERVER> | |
gluster volume add-brick datastore replica 2 <INTERNAL IP OF 2ND SERVER>:/datastore force | |
# 6. Done! Try out the volume on each server: | |
@server1 $ docker run --volume-driver glusterfs --volume datastore:/data armhfbuild/alpine:3.1 echo hello >/data/test | |
@server2 $ docker run --volume-driver glusterfs --volume datastore:/data armhfbuild/alpine:3.1 cat /data/test | |
# To come: SSL for GlusterFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment