MooseFS Docker Cluster

This commit is contained in:
Karol Majek
2018-08-23 11:50:36 +02:00
commit 313bde27e9
19 changed files with 753 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
FROM ubuntu:14.04
# Install wget, lsb-release and curl
RUN apt-get update && apt-get install -y wget lsb-release curl fuse libfuse2 tree
# Add key
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
# Install MooseFS chunkserver and client
RUN apt-get update && apt-get install -y moosefs-chunkserver moosefs-client
# Expose ports
EXPOSE 9419 9420 9422
# Add and run start script
ADD start-chunkserver-client.sh /home/start-chunkserver-client.sh
RUN chown root:root /home/start-chunkserver-client.sh
RUN chmod 700 /home/start-chunkserver-client.sh
CMD ["/home/start-chunkserver-client.sh", "-bash"]

View File

@@ -0,0 +1,34 @@
#!/bin/bash
cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg
mkdir -p /mnt/sdb1
chmod -R 777 /mnt/sdb1
echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg
ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'
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
# wait for mfsmaster startup
ping -c 10 mfsmaster
mkdir -p /mnt/mfs
# mount mfs
mfsmount /mnt/mfs -H mfsmaster
# 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
# list files in MooseFS
ls /mnt/mfs/
if [[ $1 == "-d" ]]; then
while true; do sleep 1000; done
fi
if [[ $1 == "-bash" ]]; then
/bin/bash
fi