This is a sample configuration of a multiple node MooseFS cluster on Docker using Debian Stretch. It consists of a master server with a CGI, 4 chunkservers and one client machine. After a successful installation you have a fully working MooseFS cluster to play with its amazing features.
New features:
- specify storage size per chunkserver (env: SIZE, default: 10)
- specify label per chunkserver (env: LABEL, default: empty)
- switched to debian:stretch as base image
- example with 4 chunkservers (labels: M, MB, MB, B)
- MooseFS disks are now mounted as volumes
In this repository you will find 2 sample configurations which you can run to try MooseFS.
Build and run in background:
docker-compose build
docker-compose up -d
File docker-compose.yml
- master with CGI http://172.20.0.2:9425
- chunkserver1 172.20.0.11, 10 GiB storage, label: M
- chunkserver2 172.20.0.12, 10 GiB storage, label: M,B
- chunkserver3 172.20.0.13, 10 GiB storage, label: M,B
- chunkserver4 172.20.0.14, 10 GiB storage, label: B
- client 172.168.20.0.5
Build and run in background:
docker-compose -f docker-compose-chunkserver-client.yml build
docker-compose -f docker-compose-chunkserver-client.yml up -d
File docker-compose-chunkserver-client.yml
- master with CGI http://172.20.0.2:9425
- chunkserver1 172.20.0.11, 10 GiB storage, label: M (mount point:
/mnt/moosefs
) - chunkserver2 172.20.0.12, 10 GiB storage, label: M,B (mount point:
/mnt/moosefs
) - chunkserver3 172.20.0.13, 10 GiB storage, label: M,B (mount point:
/mnt/moosefs
) - chunkserver4 172.20.0.14, 10 GiB storage, label: B (mount point:
/mnt/moosefs
)
Install Docker with Docker Composer from https://docs.docker.com/compose/install/
Clone MooseFS docker config files:
git clone https://github.com/moosefs/moosefs-docker-cluster
cd moosefs-docker-cluster
Build and run in background:
docker-compose build
docker-compose up -d
or
docker-compose -f docker-compose-chunkserver-client.yml build
docker-compose -f docker-compose-chunkserver-client.yml up -d
"-d" is detached - running Docker nodes in background, so Docker console output is invisible.
You can check if instances are running:
docker ps
You should have 1 master, 4 chunkservers and 1 client running (first configuration). Expected output should be similar to:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2fe620447b37 dockermoosefscluster_client "/home/start-clien..." 5 minutes ago Up 5 minutes client
204c115cd8ad dockermoosefscluster_chunkserver2 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver2
48343721de4f dockermoosefscluster_chunkserver4 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver4
30ca217fa862 dockermoosefscluster_master "/home/start.sh -d" 5 minutes ago Up 5 minutes 9420-9425/tcp master
28e2a64d0fb9 dockermoosefscluster_chunkserver1 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver1
c83c70580795 dockermoosefscluster_chunkserver3 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver3
You can attach to the client node (press "Enter" twice):
docker container attach mfsclient
To detach from container use the escape sequence Ctrl + p
, Ctrl + q
.
Now MooseFS filesystem is mounted as /mnt/moosefs
. If everything is ok you should see our welcome message with:
cd /mnt/moosefs
cat welcome_to_moosefs.txt
The CGI is available here: http://172.20.0.2:9425 (be aware of a local 172.20.0.* network).
Your MooseFS Docker cluster is persistent. It means all files you created in the /mnt/moosefs folder will remain there even after turning containers off.
MooseFS disks are now mounted in host ./data
directory.
Chunkservers are paired with Master server, so if you destroy the machine with master server you will not be able to access your data. Data will still be there in volumes (./data
directory) but chunkservers will not want to connect to the new Master server.
Image name | Pulls | Stars | Build |
---|---|---|---|
moosefs/master | |||
moosefs/client | |||
moosefs/chunkserver | |||
moosefs/chunkserver-client |
Scripts are based on Kai Sasaki's Lewuathe/docker-hadoop-cluster. Thank you Kai!