├── .gitignore ├── web-ui-screenshot.png ├── docker-compose.yml ├── docker-entrypoint.sh ├── swarm-stack.yml ├── Dockerfile ├── configure.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.gitignore.* 2 | -------------------------------------------------------------------------------- /web-ui-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/katharostech/docker_lizardfs/HEAD/web-ui-screenshot.png -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | mfsmaster: 4 | image: katharostech/lizardfs 5 | command: master 6 | restart: on-failure 7 | volumes: 8 | - /var/lib/mfs 9 | mfsmaster-shadow: 10 | image: katharostech/lizardfs 11 | command: master 12 | restart: on-failure 13 | environment: 14 | MFSMASTER_PERSONALITY: shadow 15 | volumes: 16 | - /var/lib/mfs 17 | metalogger: 18 | image: katharostech/lizardfs 19 | command: metalogger 20 | restart: on-failure 21 | volumes: 22 | - /var/lib/mfs 23 | chunkserver: 24 | image: katharostech/lizardfs 25 | command: chunkserver 26 | restart: on-failure 27 | environment: 28 | # This lets you run the chunkserver with less available disk space 29 | MFSCHUNKSERVER_HDD_LEAVE_SPACE_DEFAULT: 20Mi # 4Gi is the default 30 | MFSHDD_1: /mnt/mfshdd 31 | volumes: 32 | - /mnt/mfshdd 33 | cgiserver: 34 | image: katharostech/lizardfs 35 | command: cgiserver 36 | restart: on-failure 37 | ports: 38 | - 8080:80 39 | client1: 40 | image: katharostech/lizardfs 41 | command: client /mnt/mfs 42 | restart: on-failure 43 | # Required permissions and devices for container to mount filesystem 44 | cap_add: 45 | - SYS_ADMIN 46 | devices: 47 | - /dev/fuse:/dev/fuse 48 | security_opt: 49 | - apparmor:unconfined 50 | client2: 51 | image: katharostech/lizardfs 52 | command: client /mnt/mfs 53 | restart: on-failure 54 | # Required permissions and devices for container to mount filesystem 55 | cap_add: 56 | - SYS_ADMIN 57 | devices: 58 | - /dev/fuse:/dev/fuse 59 | security_opt: 60 | - apparmor:unconfined 61 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$DEBUG" = "true" ]; then set -x; fi 4 | 5 | usage_message="usage: docker run kadimasolutions/lizardfs [master|metalogger|chunkserver|cgiserver|client]" 6 | 7 | # Configure LizardFS 8 | if [ ! "$SKIP_CONFIGURE" = "true" ]; then 9 | /configure.sh $@ 10 | fi 11 | 12 | if [ "$1" = "master" ]; then 13 | extra_options="" 14 | if [ "$2" = "ha" ]; then 15 | echo "Starting uRaft" 16 | lizardfs-uraft -d 17 | extra_options="-o ha-cluster-managed -o initial-personality=${3-master}" 18 | fi 19 | echo "Starting LizardFS master" 20 | exec mfsmaster $extra_options -d 21 | 22 | elif [ "$1" = "metalogger" ]; then 23 | echo "Starting LizardFS Metalogger" 24 | exec mfsmetalogger -d 25 | 26 | elif [ "$1" = "chunkserver" ]; then 27 | echo "Starting LizardFS Chunkserver" 28 | exec mfschunkserver -d 29 | 30 | elif [ "$1" = "cgiserver" ]; then 31 | echo "Starting LizardFS CGI Server" 32 | 33 | if [ "$MASTER_HOST" != "" ]; then 34 | # Proxy localhost:9421 to the actual master and port so that you don't have to add 35 | # the master host and port to the query string. 36 | ncat --sh-exec "ncat $MASTER_HOST ${MASTER_PORT:-9421}" -l 9421 --keep-open > /dev/null 2>&1 & 37 | fi 38 | 39 | exec lizardfs-cgiserver -v -P ${2-80} 40 | 41 | elif [ "$1" = "client" ]; then 42 | if [ "$2" = "--help" -o "$2" = "-h" ]; then 43 | echo "Displaying help for 'mfsmount'" 44 | exec mfsmount --help 45 | fi 46 | echo "Mounting filesystem using LizardFS client" 47 | mountpoint=${2:-/mnt/mfs} 48 | mkdir -p $mountpoint 49 | mfsmount $mountpoint ${@:3} 50 | if [ $? -eq 0 ]; then 51 | trap "echo 'Termination signal caught: Unmounting and exiting.'; umount $mountpoint; exit \$?" SIGTERM SIGINT 52 | while true; do sleep 1; done 53 | else 54 | exit 1 55 | fi 56 | 57 | elif [ "$1" = "--help" -o "$1" = "-h" ]; then 58 | echo $usage_message 59 | 60 | else 61 | echo "Unknown option -- $@" 62 | echo $usage_message 63 | fi 64 | -------------------------------------------------------------------------------- /swarm-stack.yml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | services: 3 | mfsmaster-1: 4 | image: katharostech/lizardfs 5 | command: master ha master 6 | restart: on-failure 7 | networks: 8 | - hostnet 9 | environment: 10 | MFSMASTER_PERSONALITY: ha-cluster-managed 11 | MFSMASTER_ADMIN_PASSWORD: password 12 | MFSMASTER_MASTER_HOST: 192.168.0.100 13 | MFSMASTER_MATOML_LISTEN_PORT: 9419 14 | MFSMASTER_MATOCS_LISTEN_PORT: 9420 15 | MFSMASTER_MATOCL_LISTEN_PORT: 9421 16 | MFSMASTER_MATOTS_LISTEN_PORT: 9424 17 | LIZARDFS_URAFT_URAFT_NODE_ADDRESS: localhost:9420 18 | LIZARDFS_URAFT_URAFT_NODE_ADDRESS: localhost:9520 19 | LIZARDFS_URAFT_URAFT_NODE_ADDRESS: localhost:9620 20 | LIZARDFS_URAFT_URAFT_ID: 0 21 | LIZARDFS_URAFT_URAFT_FLOATING_IP: 192.168.0.100 22 | LIZARDFS_URAFT_URAFT_FLOATING_NETMASK: 255.255.255.0 23 | LIZARDFS_URAFT_URAFT_FLOATING_IFACE: eth0 24 | volumes: 25 | - /var/lib/mfs 26 | metalogger: 27 | image: katharostech/lizardfs 28 | command: metalogger 29 | restart: on-failure 30 | networks: 31 | - hostnet 32 | environment: 33 | MFSMETALOGGER_MASTER_HOST: 192.268.0.100 34 | volumes: 35 | - /var/lib/mfs 36 | chunkserver: 37 | image: katharostech/lizardfs 38 | command: chunkserver 39 | restart: on-failure 40 | networks: 41 | - hostnet 42 | environment: 43 | # This lets you run the chunkserver with less available disk space 44 | MFSCHUNKSERVER_HDD_LEAVE_SPACE_DEFAULT: 20Mi # 4Gi is the default 45 | MFSCHUNKSERVER_MASTER_HOST: 192.168.0.100 46 | MFSHDD_1: /mnt/mfshdd 47 | volumes: 48 | - /mnt/mfshdd 49 | cgiserver: 50 | image: katharostech/lizardfs 51 | command: cgiserver 52 | restart: on-failure 53 | networks: 54 | - hostnet 55 | client1: 56 | image: katharostech/lizardfs 57 | command: client /mnt/mfs 58 | restart: on-failure 59 | networks: 60 | - hostnet 61 | # Required permissions and devices for container to mount filesystem 62 | cap_add: 63 | - SYS_ADMIN 64 | devices: 65 | - /dev/fuse:/dev/fuse 66 | security_opt: 67 | - apparmor:unconfined 68 | client2: 69 | image: katharostech/lizardfs 70 | command: client /mnt/mfs -H 192.168.99.100 71 | restart: on-failure 72 | networks: 73 | - hostnet 74 | # Required permissions and devices for container to mount filesystem 75 | cap_add: 76 | - SYS_ADMIN 77 | devices: 78 | - /dev/fuse:/dev/fuse 79 | security_opt: 80 | - apparmor:unconfined 81 | 82 | networks: 83 | hostnet: 84 | external: true 85 | name: host 86 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | # Install wget and busybox ( for vi ) 4 | RUN apt-get update && \ 5 | apt-get install -y busybox nmap unzip wget && \ 6 | apt-get clean && \ 7 | rm -rf /var/lib/apt/lists/* 8 | 9 | # Alias to busybox for vi 10 | RUN echo 'alias vi="busybox vi"' >> /root/.bashrc 11 | 12 | # Install LizardFS from the release candidate 1.13-rc1 13 | RUN set -x && \ 14 | wget -qO /tmp/lizardfs.tar https://lizardfs.com/wp-content/uploads/2018/07/lizardfs-bundle-Ubuntu-16.04.tar && \ 15 | wget -qO /tmp/fuse3.zip https://lizardfs.com/wp-content/uploads/2018/07/FUSE3-Ubuntu-16.04.zip && \ 16 | cd /tmp && \ 17 | tar -xf lizardfs.tar && \ 18 | unzip fuse3.zip && \ 19 | apt-get update && \ 20 | apt-get install -y \ 21 | ./ubuntu16/*fuse*.deb \ 22 | ./lizardfs*/lizardfs-adm*.deb \ 23 | ./lizardfs*/lizardfs-cgiserv*.deb \ 24 | ./lizardfs*/lizardfs-chunkserver*.deb \ 25 | ./lizardfs*/lizardfs-client*.deb \ 26 | ./lizardfs*/lizardfs-master*.deb \ 27 | ./lizardfs*/lizardfs-metalogger*.deb \ 28 | ./lizardfs*/lizardfs-uraft*.deb && \ 29 | apt-get clean && \ 30 | rm -rf /var/lib/apt/lists/* && \ 31 | rm -rf lizardfs* ubuntu16 lizardfs.tar fuse3.zip 32 | 33 | # Ensure the `mfs` user and group has a consistent uid/gid 34 | RUN usermod -u 9421 mfs 35 | RUN groupmod -g 9421 mfs 36 | 37 | #### LIZARDFS MASTER CONFIG #### 38 | 39 | # Copy empty metadata file to a spot that will not be overwritten by a volume 40 | RUN cp /var/lib/mfs/metadata.mfs.empty /metadata.mfs.empty 41 | 42 | # Setup mfsmaster.cfg 43 | ## Default to a master 44 | ENV MFSMASTER_PERSONALITY=master 45 | 46 | # Setup mfsexports.cfg defaults 47 | ## Allow everything but "meta". 48 | ENV MFSEXPORTS_1="* / rw,alldirs,maproot=0" 49 | ## Allow "meta". 50 | ENV MFSEXPORTS_2="* . rw" 51 | 52 | # Setup mfsgoals.cfg defaults 53 | ENV MFSGOALS_1="1 1 : _" 54 | ENV MFSGOALS_2="2 2 : _ _" 55 | ENV MFSGOALS_3="3 3 : _ _ _" 56 | ENV MFSGOALS_4="4 4 : _ _ _ _" 57 | ENV MFSGOALS_5="5 5 : _ _ _ _ _" 58 | 59 | #### LIZARDFS METALOGGER CONFIG #### 60 | RUN echo "# LizardFS Metalogger config" >> /etc/mfs/mfsmetalogger.cfg 61 | 62 | #### LIZARDFS CHUNKSERVER CONFIG #### 63 | RUN echo "# LizardFS Chunkserver config" >> /etc/mfs/mfschunkserver.cfg 64 | 65 | # Copy in configuration script 66 | COPY configure.sh /configure.sh 67 | RUN chmod 744 /configure.sh 68 | 69 | # Copy in command script 70 | COPY docker-entrypoint.sh /docker-entrypoint.sh 71 | RUN chmod 744 /docker-entrypoint.sh 72 | 73 | # Expose Ports 74 | EXPOSE 9419 9420 9421 9424 75 | 76 | # Set the Docker entrypoint and default command 77 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 78 | CMD [ "master" ] 79 | 80 | -------------------------------------------------------------------------------- /configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Configure LizardFS master 4 | if [ "$1" = "master" ]; then 5 | # Copy the empty metadata file to /var/lib/mfs if it does not exist 6 | if [ ! -e /var/lib/mfs/metadata.mfs ]; then 7 | cp /metadata.mfs.empty /var/lib/mfs/metadata.mfs 8 | fi 9 | 10 | # Add config for mfsmaster.cfg 11 | # For each vairable that starts with `MFSMASTER_`, remove the 12 | # prefix and add the value to the `mfsmaster.cfg` file. 13 | rm -f /etc/mfs/mfsmaster.cfg # We remove the config file to reset config 14 | configs=${!MFSMASTER_*} 15 | for var in $configs; do 16 | config_name=${var#*_} 17 | echo "${config_name} = ${!var}" >> /etc/mfs/mfsmaster.cfg 18 | done 19 | 20 | if [ "$2" = "ha" ]; then 21 | # Add lines for lizardfs-uraft.cfg 22 | # For each variable that starts with `LIZARDFS_URAFT_`, add the value 23 | # to `lizardfs-uraft.cfg` file. 24 | rm -f /etc/mfs/lizardfs-uraft.cfg # We remove the config file to reset config 25 | configs=${!LIZARDFS_URAFT_*} 26 | for var in $configs; do 27 | config_name=${var#*_*_} 28 | 29 | if [ `echo $config_name | grep 'URAFT_NODE_ADDRESS_[0-9]*'` ]; then 30 | # Allow setting multiple values for URAFT_NODE_ADRESS 31 | echo "URAFT_NODE_ADDRESS = ${!var}" >> /etc/mfs/lizardfs-uraft.cfg 32 | else 33 | # For all other settings just set the value normally 34 | echo "${config_name} = ${!var}" >> /etc/mfs/lizardfs-uraft.cfg 35 | fi 36 | done 37 | fi 38 | 39 | # Add lines for mfsexports.cfg 40 | # For each variable that starts with `MFSEXPORTS_`, add the value 41 | # to `mfsexports.cfg` file. 42 | rm -f /etc/mfs/mfsexports.cfg # We remove the config file to reset config 43 | configs=${!MFSEXPORTS_*} 44 | for var in $configs; do 45 | echo "${!var}" >> /etc/mfs/mfsexports.cfg 46 | done 47 | 48 | # Add lines for mfsgoals.cfg 49 | # For each variable that starts with `MFSGOALS_`, add the value 50 | # to `mfsexports.cfg` file. 51 | rm -f /etc/mfs/mfsgoals.cfg # We remove the config file to reset config 52 | configs=${!MFSGOALS_*} 53 | for var in $configs; do 54 | echo "${!var}" >> /etc/mfs/mfsgoals.cfg 55 | done 56 | 57 | # Add lines for mfstopology.cfg 58 | # For each variable that starts with `MFSTOPOLOGY_`, add the value 59 | # to `mfsexports.cfg` file. 60 | rm -f /etc/mfs/mfstopology.cfg # We remove the config file to reset config 61 | configs=${!MFSTOPOLOGY_*} 62 | for var in $configs; do 63 | echo "${!var}" >> /etc/mfs/mfstopology.cfg 64 | done 65 | 66 | # Configure LizardFS Metalogger 67 | elif [ "$1" = "metalogger" ]; then 68 | # Add config for mfsmetalogger.cfg 69 | # For each vairable that starts with `MFSMETALOGGER_`, remove the 70 | # prefix and add the value to the `mfsmaster.cfg` file. 71 | rm -f /etc/mfs/mfsmetalogger.cfg # We remove the config file to reset config 72 | configs=${!MFSMETALOGGER_*} 73 | for var in $configs; do 74 | config_name=${var#*_} 75 | echo "${config_name} = ${!var}" >> /etc/mfs/mfsmetalogger.cfg 76 | done 77 | 78 | # Configure LizardFS Chunkserver 79 | elif [ "$1" = "chunkserver" ]; then 80 | # Add config for mfschunkserver.cfg 81 | # For each vairable that starts with `MFSCHUNKSERVER_`, remove the 82 | # prefix and add the value to the `mfsmaster.cfg` file. 83 | rm -f /etc/mfs/mfschunkserver.cfg # We remove the config file to reset config 84 | configs=${!MFSCHUNKSERVER_*} 85 | for var in $configs; do 86 | config_name=${var#*_} 87 | echo "${config_name} = ${!var}" >> /etc/mfs/mfschunkserver.cfg 88 | done 89 | 90 | # Add lines for mfshdd.cfg 91 | # For each variable that starts with `MFSHDD_`, add the value 92 | # to `mfsexports.cfg` file. 93 | rm -f /etc/mfs/mfshdd.cfg # We remove the config file to reset config 94 | configs=${!MFSHDD_*} 95 | for var in $configs; do 96 | # Add line to config 97 | echo "${!var}" >> /etc/mfs/mfshdd.cfg 98 | 99 | # Make sure dir exists and owner is correct if not prefixed with a `*` 100 | # to indicate that the drive should be evacuated. 101 | if [ ! $(echo ${!var} | grep '^\*.*') ]; then 102 | mkdir -p ${!var} 103 | chown -R mfs:mfs ${!var} 104 | fi 105 | done 106 | fi 107 | 108 | # Ensure proper ownership of the /var/lib/mfs directory 109 | chown -R mfs:mfs /var/lib/mfs 110 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker LizardFS 2 | 3 | A Docker image that can be used to build a fully functional [LizardFS](https://lizardfs.com) cluster. 4 | 5 | ## Usage 6 | 7 | The same Docker image is used to run each different kind of LizardFS service: `master`, `metalogger`, `chunkserver`, `cgiserver`, and `client`. You tell the container which service to run by setting the Docker command, or by passing in the service name after the image name on the commandline. 8 | 9 | **docker-compose.yml** 10 | ```yaml 11 | version: '3' 12 | services: 13 | mfsmaster: 14 | image: katharostech/lizardfs 15 | command: master 16 | metalogger: 17 | image: katharostech/lizardfs 18 | command: metalogger 19 | ... 20 | ``` 21 | 22 | Or on the commandline: 23 | 24 | ```bash 25 | $ docker run -d --name mfsmaster katharostech/lizardfs master 26 | ``` 27 | 28 | ### Services 29 | 30 | #### Master, Metalogger, and Chunkserver 31 | 32 | The `master`, `metalogger`, and `chunkserver` services are configured using environment variables ( see [configuration](#Configuration) ). 33 | 34 | #### CGI Server 35 | 36 | The CGI Server, by default, starts a webserver inside the container running on port `80`. You can set the `MASTER_HOST` and `MASTER_PORT` environment variables and the container will proxy the internal port 9421 to that master host and port. The web UI will then, by default, connect to that internal proxy when connecting to the master. Alternatively, when accessing the web UI you can put the master host ( and port as well, if it is not `9421` ) in the url: `http://192.168.99.100:8080/mfs.cgi?masterhost=mfsmaster&masterport=19421`. 37 | 38 | If you would, for any reason, like to change the port that the CGI server is running on *inside* the container, you can specify the port after `cgiserver` in the Docker command. For example: 39 | 40 | docker run -d --name cgiserver katharostech/lizardfs cgiserver 8080 41 | 42 | #### Client 43 | 44 | You can run the container with the `client` command and it will look for and connect to the `mfsmaster` and mount the filesystem into the container at `/mnt/mfs`. You can change which path the filesystem is mounted to by passing it in after `client`. The container will also need to be run as privileged and linked to the master container. For example: 45 | 46 | ```bash 47 | $ docker run -d --name mymaster katharostech/lizardfs master 48 | $ docker run -d --name myclient --link mymaster:mfsmaster --privileged katharostech/lizardfs client /mnt/my-alternate-moutpoint 49 | ``` 50 | 51 | All arguments passed in after `client` and the moutpoint will be passed directly to the `mfsmount` command. You can see all available options with `--help`. 52 | 53 | ```bash 54 | $ docker run --privileged katharostech/lizardfs client --help 55 | ``` 56 | 57 | After the client has connected, you can access the LizardFS filesystem by `exec`ing into the container. 58 | 59 | ```bash 60 | $ docker exec -it myclient bash 61 | root@contianerid:/$ cd /mnt/mfs 62 | root@containerid:/mnt/mfs$ echo "LizardFS file" > lizardfsfile.txt 63 | root@containerid:/mnt/mfs$ cat lizardfsfile.txt 64 | LizardFS file 65 | ``` 66 | 67 | ## Deployment 68 | 69 | The LizardFS Docker image is deployed easiest through [Docker Compose](https://docs.docker.com/compose/overview) or [Docker Swarm](https://docs.docker.com/engine/swarm/). We have provided a [docker-compose.yml](/docker-compose.yml) file that can be used to test a LizardFS cluster on a local Docker installation such as [Docker Machine](https://docs.docker.com/machine/overview/). 70 | 71 | ### Docker Compose 72 | 73 | Docker Compose is the easiest way to deploy a test LizardFS cluster on a single machine. This is a great way to test the features of LizardFS. Because it only runs on a single machine this setup not useful in production. For running in production use Docker Swarm. 74 | 75 | This repository comes with a Docker Compose file that can be used to run a test cluster. To get started just clone this repository and run `docker-compose up` in the repository root directory. 76 | 77 | ```bash 78 | $ cd docker_lizardfs 79 | $ docker-compose up -d --scale mfsmaster-shadow=2 --scale chunkserver=3 --scale metalogger=4 80 | ``` 81 | 82 | You can then hit the web interface on `8080` at the IP address of the server running Docker. On the "Servers" tab of the web interface you should be able to see that you have a cluster consisting of 1 master, 2 shadow masters, 3 chunkservers, and 4 metaloggers. Congratulations you are running a full LizardFS cluster! 83 | 84 | You can experiment with the cluster by creating some files. Exec into one of the client containers and copy `/etc` inside the container to the LizardFS mountpoint at `/mnt/mfs`. 85 | 86 | ```bash 87 | $ docker-compose exec client1 bash 88 | root@containerid:/$ cd /mnt/mfs 89 | root@containerid:/mnt/mfs$ cp -R /etc . 90 | ``` 91 | 92 | The web UI will show that you now have 218 chunks in your cluster. 93 | 94 | ![web-ui-screenshot](/web-ui-screenshot.png) 95 | 96 | `exec`ing into the other client container will prove that you successfully mounted your LizardFS filesystem on two clients at the same time. 97 | 98 | ```bash 99 | $ docker-compose exec client2 bash 100 | root@containerid:/$ cd /mnt/mfs 101 | root@containerid:/mnt/mfs$ ls 102 | etc 103 | ``` 104 | 105 | ### Docker Swarm 106 | 107 | TODO 108 | 109 | ## Configuration 110 | 111 | All of the LizardFS services can be completely configured through envronment variables. The container will generate the required config files based on the passed in environment variables. 112 | 113 | ### Skipping Configuration Generation 114 | 115 | If you would instead prefer to mount in configuration files, you can disable config file generation by setting the `SKIP_CONFIGURE` environment variable to `"true"`. 116 | 117 | > **Note:** Part of the configuration step is changing the owner of the storage directories to `mfs:mfs` so that LizardFS can access them. If you set `SKIP_CONFIGURE=true` this step will be skipped as well. You will have to make sure that the owner of the data directories is uid 9421 and gid 9421. For example: `chown -R 9421:9421 /data/dir`. 118 | 119 | ### Master Configuration 120 | 121 | #### mfsmaster.cfg 122 | 123 | The [mfsmaster.cfg](https://docs.lizardfs.com/man/mfsmaster.cfg.5.html) file is the primary config file for the LizardFS master. It is made up of a list of key-value pairs that are explained in the [documentation](https://docs.lizardfs.com/man/mfsmaster.cfg.5.html). You can add any key-value pair to the `mfsmaster.cfg` file by adding an environment variable in the format of `MFSMASTER_KEY_NAME=value`. For example, if you wanted to run a LizardFS shadow master you could do the following: 124 | 125 | ```bash 126 | $ docker run -d --name shadow -e MFSMASTER_PERSONALITY=shadow katharostech/lizardfs 127 | ``` 128 | 129 | This you can do for any key-value pairs you want to add to the `mfsmaster.cfg` file. 130 | 131 | #### mfsexports.cfg 132 | 133 | The [mfsexports.cfg](https://docs.lizardfs.com/man/mfsexports.cfg.5.html) file configures access to the LizardFS filesystem. Each line in the file allows access to a portion of the filesystem according to the given rules. You set the lines in the file by adding environment variables in the format of `MFSEXPORTS_LINE_NUMBER='line contents'`. The first two lines, `MFSEXPORTS_1` and `MFSEXPORTS_2`, are preset to the LizardFS defaults: 134 | 135 | ```ini 136 | * / rw,alldirs,maproot=0 137 | * . rw 138 | ``` 139 | 140 | This exports the root filesystem and the metadata path to any ip address and gives read-write access. These lines can be overwritten by setting the values of `MFSEXPORTS_1` and `MFSEXPORTS_2`. Additional lines can also be added by setting `MFSEXPORTS_3`, `MFSEXPORTS_4`, and so on for however many rules are desired. 141 | 142 | #### mfsgoals.cfg 143 | 144 | The [mfsgoals.cfg](https://docs.lizardfs.com/man/mfsgoals.cfg.5.html) file configures replication goals for LizardFS. More information about configuring replication goals can be found in the [LizardFS documentation](https://docs.lizardfs.com/adminguide/replication.html). 145 | 146 | The lines of this file can be configured using environment variables ( see [mfsexports.cfg](#mfsexports.cfg) ). The first five lines are preset to the LizardFS defaults: 147 | 148 | ``` 149 | 1 1 : _ 150 | 2 2 : _ _ 151 | 3 3 : _ _ _ 152 | 4 4 : _ _ _ _ 153 | 5 5 : _ _ _ _ _ 154 | ``` 155 | 156 | > **Warning:** When setting goals that require the use of the `$` sign, such as erasure coding rules. Be sure to escape the `$` sign if setting the value in a Docker Compose file. To put a literal `$` in an environment variable in a compose file you use `$$`. For example: 157 | > 158 | > ```yaml 159 | > ... 160 | > environment: 161 | > MFSGOALS_5: "5 erasure_coding_rule : $$ec(3,1)" 162 | > ... 163 | > ``` 164 | 165 | #### mfstopology.cfg 166 | 167 | The [mfstopology.cfg](https://docs.lizardfs.com/man/mfstopology.cfg.5.html) file allows you to optionally assign different IP addresses to different network locations. 168 | 169 | The lines of this file can be configured using environment variables ( see [mfexports.cfg](#mfsexports.cfg) ). This file has no entries by default. 170 | 171 | ### Metalogger Configuration 172 | 173 | #### mfsmetalogger.cfg 174 | 175 | The [mfsmetalogger.cfg](https://docs.lizardfs.com/man/mfsmetalogger.cfg.5.html) file is made up of a list of key-value pairs used to configure the Metalogger service. 176 | 177 | This file can be configured using environment variables ( see [mfsmaster.cfg](#mfsmaster.cfg) ). 178 | 179 | ### Chunkserver Configuration 180 | 181 | #### mfschunkserver.cfg 182 | 183 | The [mfschunkserver.cfg](https://docs.lizardfs.com/man/mfschunkserver.cfg.5.html) is made up of a list of key-value pairs used to configure the Chunkserver service. 184 | 185 | This file can be configured using environment variables ( see [mfsmaster.cfg](#mfsmaster.cfg) ). 186 | 187 | #### mfshdd.cfg 188 | 189 | The [mfshdd.cfg](https://docs.lizardfs.com/man/mfshdd.cfg.5.html) file is a list of mountpoints or directories that LizardFS will use for storage. In general these should be dedicated drives formatted as either XFS or ZFS. Each line should be a path that will be used for storage. A path prefixed with a `*` will be evacuated and all data will be replicated to different drives. 190 | 191 | The lines of this file can be configured using environment variables ( see [mfexports.cfg](#mfsexports.cfg) ). This file has no entries by default. 192 | --------------------------------------------------------------------------------