env vars: size, label; volumes as hdds

This commit is contained in:
Karol Majek
2018-11-29 14:41:08 +01:00
parent adc3330076
commit f56ab1a6e0
18 changed files with 208 additions and 322 deletions

125
README.md
View File

@@ -1,45 +1,63 @@
# MooseFS Docker Cluster # MooseFS Docker Cluster
This is a sample configuration of a multiple node MooseFS cluster on Docker using Ubuntu 14.04 LTS. It consists of a master server with a management GUI, 5 chunkservers and one client machine. After a successful installation you have a fully working MooseFS cluster to play with its amazing features. This is a sample configuration of a multiple node MooseFS cluster on Docker using Ubuntu 14.04 LTS. It consists of a master server with a CGI, 5 chunkservers and one client machine. After a successful installation you have a fully working MooseFS cluster to play with its amazing features.
## Cluster configurations # Updates
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
# Cluster configurations
In this repository you will find 2 sample configurations which you can run to try MooseFS.
## 4 Chunkservers + Client
Build and run in background:
```
docker-compose build
docker-compose up -d
```
**File docker-compose.yml** **File docker-compose.yml**
- master with management GUI [http://172.20.0.2:9425](http://172.20.0.2:9425) - master with CGI [http://172.20.0.2:9425](http://172.20.0.2:9425)
- chunkserver1 **172.20.0.11** with **10 GiB** of storage - chunkserver1 **172.20.0.11**, **10 GiB** storage, label: **M**
- chunkserver2 **172.20.0.12** with **10 GiB** of storage - chunkserver2 **172.20.0.12**, **10 GiB** storage, label: **M**,**B**
- chunkserver3 **172.20.0.13** with **10 GiB** of storage - chunkserver3 **172.20.0.13**, **10 GiB** storage, label: **M**,**B**
- chunkserver4 **172.20.0.14** with **10 GiB** of storage - chunkserver4 **172.20.0.14**, **10 GiB** storage, label: **B**
- chunkserver5 **172.20.0.15** with **10 GiB** of storage
- client **172.168.20.0.5** - client **172.168.20.0.5**
## 4 Chunkservers + 4 Clients
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** **File docker-compose-chunkserver-client.yml**
- master with CGI [http://172.20.0.2:9425](http://172.20.0.2:9425) - master with CGI [http://172.20.0.2:9425](http://172.20.0.2:9425)
- chunkserver1 **172.20.0.11** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) - chunkserver1 **172.20.0.11**, **10 GiB** storage, label: **M** (mount point: `/mnt/moosefs`)
- chunkserver2 **172.20.0.12** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) - chunkserver2 **172.20.0.12**, **10 GiB** storage, label: **M,B** (mount point: `/mnt/moosefs`)
- chunkserver3 **172.20.0.13** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) - chunkserver3 **172.20.0.13**, **10 GiB** storage, label: **M,B** (mount point: `/mnt/moosefs`)
- chunkserver4 **172.20.0.14** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) - chunkserver4 **172.20.0.14**, **10 GiB** storage, label: **B** (mount point: `/mnt/moosefs`)
- chunkserver5 **172.20.0.15** with **10 GiB** of storage and client (mount point: `/mnt/mfs`)
![MooseFS CGI](https://github.com/moosefs/moosefs-docker-cluster/raw/master/images/cgi.png) # Setup
## Setup Install Docker with Docker Composer from [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
Install Docker with composer from [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
Clone MooseFS docker config files: Clone MooseFS docker config files:
``` ```
git clone https://github.com/moosefs/moosefs-docker-cluster git clone https://github.com/moosefs/moosefs-docker-cluster
```
### Start MooseFS cluster:
Go to repo directory:
```
cd moosefs-docker-cluster cd moosefs-docker-cluster
``` ```
@@ -50,18 +68,26 @@ docker-compose build
docker-compose up -d docker-compose up -d
``` ```
"-d" is for running Docker nodes in background, so Docker console output is invisible. or
Check if instances are running with: ```
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 docker ps
``` ```
You should have 1 master, 5 chunkservers and 1 client running. Expected output should be similar to:
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 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2fe620447b37 dockermoosefscluster_client "/home/start-clien..." 5 minutes ago Up 5 minutes client 2fe620447b37 dockermoosefscluster_client "/home/start-clien..." 5 minutes ago Up 5 minutes client
1951d867c078 dockermoosefscluster_chunkserver5 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver5
204c115cd8ad dockermoosefscluster_chunkserver2 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver2 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 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 30ca217fa862 dockermoosefscluster_master "/home/start.sh -d" 5 minutes ago Up 5 minutes 9420-9425/tcp master
@@ -69,54 +95,37 @@ CONTAINER ID IMAGE COMMAND
c83c70580795 dockermoosefscluster_chunkserver3 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver3 c83c70580795 dockermoosefscluster_chunkserver3 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver3
``` ```
# Attach/detach to/from container
You can **attach** to the client node (press "Enter" twice): You can **attach** to the client node (press "Enter" twice):
``` ```
docker container attach mfsclient #press the "Enter" key twice docker container attach mfsclient
``` ```
To **detach** from container use the escape sequence `Ctrl + p`, `Ctrl + q`. To **detach** from container use the escape sequence `Ctrl + p`, `Ctrl + q`.
Now MooseFS filesystem is mounted as `/mnt/mfs`. If everything is ok you should see our welcome message with: Now MooseFS filesystem is mounted as `/mnt/moosefs`. If everything is ok you should see our welcome message with:
``` ```
cd /mnt/mfs cd /mnt/moosefs
cat welcome_to_moosefs.txt cat welcome_to_moosefs.txt
``` ```
The management GUI is available here: [http://172.20.0.2:9425](http://172.20.0.2:9425) (be aware of a local 172.20.0.* network).
To stop all (all means ALL, not just MooseFS's) your Docker containers: # CGI
```
docker stop $(docker ps -aq)
```
Your MooseFS Docker cluster is persistent. It means all files you created in the /mnt/mfs folder will remain there even after turning containers off. The CGI is available here: [http://172.20.0.2:9425](http://172.20.0.2:9425) (be aware of a local 172.20.0.* network).
### Stop the cluster ![MooseFS CGI](https://github.com/moosefs/moosefs-docker-cluster/raw/master/images/cgi.png)
`docker-compose stop`
### Restart the stopped cluster # Persistence
`docker-compose start`
### Remove containers 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.
`docker-compose rm -f` MooseFS disks are now mounted in host `./data` directory.
# Change configuration # Warning
If you want to change storage size modify the chunkserver start script [moosefs-chunkserver/start-chunkserver.sh](https://github.com/moosefs/moosefs-docker-cluster/blob/master/moosefs-chunkserver/start-chunkserver.sh) 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.
Default configuration is stored in [docker-compose.yml](https://github.com/moosefs/moosefs-docker-cluster/blob/master/docker-compose.yml)
**Other configurations**
If you want to use other than default compose yml file (`docker-compose.yml`) use following commands:
```
docker-compose -f docker-compose-chunkserver-client.yml build
docker-compose -f docker-compose-chunkserver-client.yml up -d
```
When using `docker-compose-chunkserver-client.yml` you will have 5 chunkserver/client machines so you can attach to mfschunkserverclient1, ..., mfschunkserverclient5.
# Docker Hub # Docker Hub

View File

@@ -1,6 +0,0 @@
#!/bin/bash
PROGNAME=$(basename $0)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/build_cluster.sh build

View File

@@ -1,93 +0,0 @@
#!/bin/bash
PROGNAME=$(basename $0)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
print_usage() {
echo "Usage: $0 [launch|destroy]"
echo ""
echo " launch : Launch moosefs cluster on docker"
echo " destroy : Remove moosefs cluster on docker"
echo " build : Build docker images with local moosefs binary"
echo ""
echo " Options:"
echo " -h, --help : Print usage"
echo " -s, --chunkservers : Specify the number of chunkservers"
echo ""
}
if [ $# -eq 0 ]; then
print_usage
fi
DATANODE_NUM=3
CLUSTER_NAME=default_cluster
for OPT in "$@"
do
case "$OPT" in
'-h'|'--help' )
print_usage
exit 1
;;
'-s'|'--chunkservers' )
if [[ -z "$2" ]] || [[ "$2" =~ ^-+ ]]; then
echo "$PROGNAME: option requires an argument -- $1" 1>&2
exit 1
fi
DATANODE_NUM="$2"
shift 2
;;
'-c'|'--cluster' )
CLUSTER_NAME="$2"
shift 2
;;
-*)
echo "$PROGNAME: illegal option -- '$(echo $1 | sed 's/^-*//')'" 1>&2
exit 1
;;
*)
;;
esac
done
launch_cluster() {
if ! docker network inspect moosefs-network > /dev/null ; then
echo "Creating moosefs-network"
docker network create --driver bridge moosefs-network
fi
echo "Launching master server"
docker run -d -p 9870:9870 -p 8088:8088 -p 19888:19888 -p 8188:8188 --net moosefs-network --name master -h master karolmajek/moosefs-master:latest
echo "Launching chunkservers"
for i in `seq 1 $DATANODE_NUM`; do
docker run -d -p 990${i}:9864 -p 804${i}:8042 --name chunkserver${i} -h chunkserver${i} --net moosefs-network karolmajek/moosefs-chunkserver:latest
done
}
destroy_cluster() {
docker kill master; docker rm master
for i in `seq 1 $DATANODE_NUM`; do
docker kill chunkserver${i}; docker rm chunkserver${i}
done
docker network rm moosefs-network
}
build_images() {
# cd $DIR/../moosefs-base
# docker build -f Dockerfile-local -t karolmajek/moosefs-base:latest .
cd $DIR/../moosefs-master
docker build -t karolmajek/moosefs-master:latest .
cd $DIR/../moosefs-chunkserver
docker build -t karolmajek/moosefs-chunkserver:latest .
}
case $1 in
launch) launch_cluster
;;
destroy) destroy_cluster
;;
build) build_images
;;
esac
exit 0

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
PROGNAME=$(basename $0)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/build_cluster.sh -s $1 destroy

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
PROGNAME=$(basename $0)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/build_cluster.sh -s $1 launch

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env python
import sys
import subprocess
import json
def exec_process(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout_data, stderr_data = p.communicate()
return p.returncode, stdout_data, stderr_data
def get_ipaddress(host):
(code, out, err) = exec_process('sudo docker inspect {}'.format(host))
conf = json.loads(out)
return conf[0]['NetworkSettings']['IPAddress']
if __name__ == "__main__":
argvs = sys.argv
for h in range(0, int(argvs[1])):
print("{}\tdn{}".format(get_ipaddress('dn' + str(h + 1)), h + 1))
print("{}\tdn{}.bridge".format(get_ipaddress('dn' + str(h + 1)), h + 1))

View File

@@ -1,119 +1,112 @@
version: '2' version: '2'
services: services:
mfsmaster: mfsmaster:
image: moosefs/master # image: moosefs/master
# build: ./moosefs-master build: ./moosefs-master
container_name: "mfsmaster" container_name: "mfsmaster"
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.2" ipv4_address: "172.20.0.2"
ports:
- "9425:9425"
mfschunkserverclient1: mfschunkserverclient1:
image: moosefs/chunkserver-client # image: moosefs/chunkserver-client
# build: ./moosefs-chunkserver-client build: ./moosefs-chunkserver-client
container_name: "mfschunkserverclient1" container_name: "mfschunkserverclient1"
hostname: mfschunkserverclient1 environment:
- LABELS=M
- SIZE=10
cap_add: cap_add:
# Needed for mount.
- SYS_ADMIN - SYS_ADMIN
devices: devices:
# Needed for mount.
- /dev/fuse:/dev/fuse - /dev/fuse:/dev/fuse
security_opt: security_opt:
# Needed for mount.
- apparmor:unconfined - apparmor:unconfined
stdin_open: true stdin_open: true
tty: true tty: true
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.11" ipv4_address: "172.20.0.11"
volumes:
- ./data/cs1_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserverclient2: mfschunkserverclient2:
image: moosefs/chunkserver-client # image: moosefs/chunkserver-client
# build: ./moosefs-chunkserver-client build: ./moosefs-chunkserver-client
container_name: "mfschunkserverclient2" container_name: "mfschunkserverclient2"
hostname: mfschunkserverclient2 environment:
- LABELS=MB
- SIZE=10
cap_add: cap_add:
# Needed for mount.
- SYS_ADMIN - SYS_ADMIN
devices: devices:
# Needed for mount.
- /dev/fuse:/dev/fuse - /dev/fuse:/dev/fuse
security_opt: security_opt:
# Needed for mount.
- apparmor:unconfined - apparmor:unconfined
stdin_open: true stdin_open: true
tty: true tty: true
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.12" ipv4_address: "172.20.0.12"
volumes:
- ./data/cs2_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserverclient3: mfschunkserverclient3:
image: moosefs/chunkserver-client # image: moosefs/chunkserver-client
# build: ./moosefs-chunkserver-client build: ./moosefs-chunkserver-client
container_name: "mfschunkserverclient3" container_name: "mfschunkserverclient3"
hostname: mfschunkserverclient3 environment:
- LABELS=MB
- SIZE=10
cap_add: cap_add:
# Needed for mount.
- SYS_ADMIN - SYS_ADMIN
devices: devices:
# Needed for mount.
- /dev/fuse:/dev/fuse - /dev/fuse:/dev/fuse
security_opt: security_opt:
# Needed for mount.
- apparmor:unconfined - apparmor:unconfined
stdin_open: true stdin_open: true
tty: true tty: true
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.13" ipv4_address: "172.20.0.13"
volumes:
- ./data/cs3_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserverclient4: mfschunkserverclient4:
image: moosefs/chunkserver-client # image: moosefs/chunkserver-client
# build: ./moosefs-chunkserver-client build: ./moosefs-chunkserver-client
container_name: "mfschunkserverclient4" container_name: "mfschunkserverclient4"
hostname: mfschunkserverclient4 environment:
- LABELS=B
- SIZE=10
cap_add: cap_add:
# Needed for mount.
- SYS_ADMIN - SYS_ADMIN
devices: devices:
# Needed for mount.
- /dev/fuse:/dev/fuse - /dev/fuse:/dev/fuse
security_opt: security_opt:
# Needed for mount.
- apparmor:unconfined - apparmor:unconfined
stdin_open: true stdin_open: true
tty: true tty: true
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.14" ipv4_address: "172.20.0.14"
mfschunkserverclient5: volumes:
image: moosefs/chunkserver-client - ./data/cs4_hdd0:/mnt/hdd0
# build: ./moosefs-chunkserver-client depends_on:
container_name: "mfschunkserverclient5"
hostname: mfschunkserverclient5
cap_add:
# Needed for mount.
- SYS_ADMIN
devices:
# Needed for mount.
- /dev/fuse:/dev/fuse
security_opt:
# Needed for mount.
- apparmor:unconfined
stdin_open: true
tty: true
links:
- mfsmaster - mfsmaster
networks:
mfsnet:
ipv4_address: "172.20.0.15"
networks: networks:
mfsnet: moosefsnet:
driver: bridge driver: bridge
ipam: ipam:
config: config:

View File

@@ -1,79 +1,99 @@
version: '2' version: '2'
services: services:
mfsmaster: mfsmaster:
image: moosefs/master #use GitHub version # image: moosefs/master #use GitHub version
#build: ./moosefs-master #use local version build: ./moosefs-master #use local version
container_name: "mfsmaster" container_name: "mfsmaster"
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.2" ipv4_address: "172.20.0.2"
ports:
- "9425:9425"
mfsclient: mfsclient:
image: moosefs/client #use GitHub version # image: moosefs/client #use GitHub version
#build: ./moosefs-client #use local version build: ./moosefs-client #use local version
container_name: "mfsclient" container_name: "mfsclient"
cap_add: cap_add:
# Needed for mount.
- SYS_ADMIN - SYS_ADMIN
devices: devices:
# Needed for mount.
- /dev/fuse:/dev/fuse - /dev/fuse:/dev/fuse
security_opt: security_opt:
# Needed for mount.
- apparmor:unconfined - apparmor:unconfined
stdin_open: true stdin_open: true
tty: true tty: true
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.5" ipv4_address: "172.20.0.5"
depends_on:
- mfsmaster
mfschunkserver1: mfschunkserver1:
image: moosefs/chunkserver #use GitHub version # image: moosefs/chunkserver #use GitHub version
#build: ./moosefs-chunkserver #use local version build: ./moosefs-chunkserver #use local version
container_name: "mfschunkserver1" container_name: "mfschunkserver1"
environment:
- LABELS=M
- SIZE=10
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.11" ipv4_address: "172.20.0.11"
volumes:
- ./data/cs1_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserver2: mfschunkserver2:
image: moosefs/chunkserver #use GitHub version # image: moosefs/chunkserver #use GitHub version
#build: ./moosefs-chunkserver #use local version build: ./moosefs-chunkserver #use local version
container_name: "mfschunkserver2" container_name: "mfschunkserver2"
environment:
- LABELS=MB
- SIZE=10
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.12" ipv4_address: "172.20.0.12"
volumes:
- ./data/cs2_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserver3: mfschunkserver3:
image: moosefs/chunkserver #use GitHub version # image: moosefs/chunkserver #use GitHub version
#build: ./moosefs-chunkserver #use local version build: ./moosefs-chunkserver #use local version
container_name: "mfschunkserver3" container_name: "mfschunkserver3"
environment:
- LABELS=MB
- SIZE=10
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.13" ipv4_address: "172.20.0.13"
volumes:
- ./data/cs3_hdd0:/mnt/hdd0
depends_on:
- mfsmaster
mfschunkserver4: mfschunkserver4:
image: moosefs/chunkserver #use GitHub version # image: moosefs/chunkserver #use GitHub version
#build: ./moosefs-chunkserver #use local version build: ./moosefs-chunkserver #use local version
container_name: "mfschunkserver4" container_name: "mfschunkserver4"
environment:
- LABELS=B
- SIZE=10
links: links:
- mfsmaster - mfsmaster
networks: networks:
mfsnet: moosefsnet:
ipv4_address: "172.20.0.14" ipv4_address: "172.20.0.14"
mfschunkserver5: volumes:
image: moosefs/chunkserver #use GitHub version - ./data/cs4_hdd0:/mnt/hdd0
#build: ./moosefs-chunkserver #use local version depends_on:
container_name: "mfschunkserver5"
links:
- mfsmaster - mfsmaster
networks:
mfsnet:
ipv4_address: "172.20.0.15"
networks: networks:
mfsnet: moosefsnet:
driver: bridge driver: bridge
ipam: ipam:
config: config:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -1,11 +1,11 @@
FROM ubuntu:14.04 FROM debian:stretch
# Install wget, lsb-release and curl # Install wget, lsb-release, curl, fuse and tree
RUN apt-get update && apt-get install -y wget lsb-release curl fuse libfuse2 tree RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl fuse libfuse2 net-tools gnupg2 systemd tree
# Add key # Add key
RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add -
RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list
# Install MooseFS chunkserver and client # Install MooseFS chunkserver and client
RUN apt-get update && apt-get install -y moosefs-chunkserver moosefs-client RUN apt-get update && apt-get install -y moosefs-chunkserver moosefs-client

View File

@@ -1,29 +1,32 @@
#!/bin/bash #!/bin/bash
cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg
mkdir -p /mnt/sdb1 mkdir -p /mnt/hdd0
chmod -R 777 /mnt/sdb1 chmod -R 777 /mnt/hdd0
echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg chown -R mfs:mfs /mnt/hdd0
ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' #Default size if not set
SIZE="${SIZE:- 10}"
echo "/mnt/hdd0 "$SIZE"GiB" >> /etc/mfs/mfshdd.cfg
echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg
sed -i '/# LABELS =/c\LABELS = DOCKER' /etc/mfs/mfschunkserver.cfg
sed -i '/MFSCHUNKSERVER_ENABLE=false/c\MFSCHUNKSERVER_ENABLE=true' /etc/default/moosefs-chunkserver
mfschunkserver start mfschunkserver start
# wait for mfsmaster startup # wait for mfsmaster startup
ping -c 10 mfsmaster ping -c 10 mfsmaster
mkdir -p /mnt/mfs mkdir -p /mnt/moosefs
# mount mfs # mount mfs
mfsmount /mnt/mfs -H mfsmaster mfsmount /mnt/moosefs -H mfsmaster
# create example file to MooseFS # create example file to MooseFS
echo "If you can find this file in /mnt/mfs/SUCCESS on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/mfs/welcome_to_moosefs.txt echo "If you can find this file in /mnt/moosefs/welcome_to_moosefs.txt on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/moosefs/welcome_to_moosefs.txt
# list files in MooseFS # list files in MooseFS
ls /mnt/mfs/ ls /mnt/moosefs/
tree /mnt/moosefs/
if [[ $1 == "-d" ]]; then if [[ $1 == "-d" ]]; then
while true; do sleep 1000; done while true; do sleep 1000; done

View File

@@ -1,11 +1,11 @@
FROM ubuntu:14.04 FROM debian:stretch
# Install wget, lsb-release and curl # Install wget, lsb-release and curl
RUN apt-get update && apt-get install -y wget lsb-release curl RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl net-tools gnupg2 systemd
# Add key # Add key
RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add -
RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list
# Install MooseFS chunkserver # Install MooseFS chunkserver
RUN apt-get update && apt-get install -y moosefs-chunkserver RUN apt-get update && apt-get install -y moosefs-chunkserver

View File

@@ -1,14 +1,16 @@
#!/bin/bash #!/bin/bash
cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg
mkdir -p /mnt/sdb1 mkdir -p /mnt/hdd0
chown -R mfs:mfs /mnt/sdb1 chmod -R 777 /mnt/hdd0
echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg chown -R mfs:mfs /mnt/hdd0
ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' #Default size if not set
SIZE="${SIZE:- 10}"
echo "/mnt/hdd0 "$SIZE"GiB" >> /etc/mfs/mfshdd.cfg
echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg
sed -i '/# LABELS =/c\LABELS = DOCKER' /etc/mfs/mfschunkserver.cfg
sed -i '/MFSCHUNKSERVER_ENABLE=false/c\MFSCHUNKSERVER_ENABLE=true' /etc/default/moosefs-chunkserver
mfschunkserver start mfschunkserver start
if [[ $1 == "-d" ]]; then if [[ $1 == "-d" ]]; then

View File

@@ -1,11 +1,11 @@
FROM ubuntu:14.04 FROM debian:stretch
# Install wget, lsb-release and curl # Install wget, lsb-release, curl, fuse and tree
RUN apt-get update && apt-get install -y wget lsb-release curl fuse libfuse2 tree RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl fuse libfuse2 net-tools gnupg2 systemd tree
# Add key # Add key
RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add -
RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list
# Install MooseFS client # Install MooseFS client
RUN apt-get update && apt-get install -y moosefs-client RUN apt-get update && apt-get install -y moosefs-client

View File

@@ -3,16 +3,17 @@
# wait for mfsmaster startup # wait for mfsmaster startup
ping -c 10 mfsmaster ping -c 10 mfsmaster
mkdir -p /mnt/mfs mkdir -p /mnt/moosefs
# mount mfs # mount mfs
mfsmount /mnt/mfs -H mfsmaster mfsmount /mnt/moosefs -H mfsmaster
# create example file to MooseFS # create example file to MooseFS
echo "If you can find this file in /mnt/mfs/ on your client machine - it means MooseFS is working correctly, congratulations!" > /mnt/mfs/welcome_to_moosefs.txt echo "If you can find this file in /mnt/moosefs/welcome_to_moosefs.txt on your client machine - it means MooseFS is working correctly, congratulations!" > /mnt/moosefs/welcome_to_moosefs.txt
# list files in MooseFS # list files in MooseFS
ls /mnt/mfs/ ls /mnt/moosefs/
tree /mnt/moosefs/
if [[ $1 == "-d" ]]; then if [[ $1 == "-d" ]]; then
while true; do sleep 1000; done while true; do sleep 1000; done

View File

@@ -1,17 +1,20 @@
FROM ubuntu:14.04 FROM debian:stretch
# Install wget, lsb-release and curl # Install wget, lsb-release and curl
RUN apt-get update && apt-get install -y wget lsb-release curl RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl net-tools gnupg2 systemd python
# Add key # Add key
RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add -
RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list
# Install MooseFS master and CGI # Install MooseFS master and CGI
RUN apt-get update && apt-get install -y moosefs-master moosefs-cgi moosefs-cgiserv RUN apt-get update && apt-get install -y moosefs-master moosefs-cgi moosefs-cgiserv
#Enable CGI Serv #Enable CGI server autostart
ADD moosefs-cgiserv /etc/default/moosefs-cgiserv RUN systemctl enable moosefs-cgiserv
#Enable master server autostart
RUN systemctl enable moosefs-master
# Expose ports # Expose ports
EXPOSE 9420 9421 9422 9423 9424 9425 EXPOSE 9420 9421 9422 9423 9424 9425

View File

@@ -1,12 +0,0 @@
# /etc/default/moosefs-cgiserv
# Start mfscgiserv from init.d script on boot.
# Only allowed values are "true" and "false".
# Undefined values default to "false".
MFSCGISERV_ENABLE=true
# user and group used to run mfscgiserv
MFSCGISERV_USER=nobody
MFSCGISERV_GROUP=nogroup
DAEMON_OPTS=""

View File

@@ -8,7 +8,7 @@ echo " mfsmaster" >> /etc/hosts
ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'
mfsmaster start -a mfsmaster start -a
service moosefs-cgiserv start mfscgiserv
if [[ $1 == "-d" ]]; then if [[ $1 == "-d" ]]; then
while true; do sleep 1000; done while true; do sleep 1000; done