Install MooseFS Master

And now you can install the Master with CGI using the following command:

apt install moosefs-master moosefs-cgi moosefs-cgiserv moosefs-cli

To start the master server simply type:

mfsmaster

We don’t recommend to automatically start MooseFS Master, so you will need run it manually on every restart.

To enable autostart of MooseFS CGI run these commands:

systemctl enable moosefs-cgiserv
systemctl start moosefs-cgiserv

Look at MooseFS CGI

If you open in browser htttp://MASTER-EXTERNAL-IP:9425 (replace MASTER-EXTERNAL-IP with the external IP address of your MooseFS master machine), you should be able to see CGI:

MooseFS CGI Google Cloud

The grid with the goals in Info tab will be empty and after you create some files you will see chunks status there. The default goal is set to 2, so each chunk of the file should be on two servers. If all chunks are in cell 2/2 it means all the files are synced and the cluster is balanced. In Servers tab you will see later the status of your three chunkservers and disk space available.

Create Chunkserver instance

In contrast to the master server, for the chunkserver machines, we will use n1-standard-1 (1 vCPU, 3.75 GB memory) with 100GB SSD disks.

Install MooseFS Chunkserver

To install chunkserver type the following:

apt install moosefs-chunkserver

Configure MooseFS Chunkserver

To run chunkserver we will need to define disks for MooseFS. Chunkserver reads disks configuration from /etc/mfs/mfshdd.cfg file. We will configure it to use all of the space on the disk leaving 5GB free:

Autostart vs instance template

Warning! If you want to create chunkserver instance template – don’t start MooseFS Chunkserver process! It will register to Master server and it won’t connect to any other master servers. If you want to create snapshot/image with an autostarting Chunkserver process, turn off MooseFS Master instance, run next two lines and create the image.

MooseFS Chunkservers from the template

Create chunkserver-1 instance. Choose the same zone as before because of low latency.

And create another instance chunkserver-2 in the same zone as before. As a result, you should be able to see 3 chunkservers and master machine.

MooseFS instances in Google Cloud

CGI status with 3 chunkservers

We will check MooseFS status after adding two chunkservers.

MooseFS CGI with 3 chunkservers

Connect to the MooseFS storage

In order to mount the storage, you will obviously need a machine. You can create a new VM instance and install the MooseFS repository or connect to chunkserver. In both cases, you will need to install MooseFS Client with the following command as the superuser:

apt install moosefs-client

You should now be able to mount MooseFS, so we will create /mnt/moosefs directory and mount storage there.

mkdir /mnt/moosefs
mfsmount /mnt/moosefs/

MooseFS mounts in CGI

You can check how many mounts exist with the CGI

MooseFS Mounts in CGI

Create a file

Now we will create a file in MooseFS and we will check where the file is written. We will also shut down one of the servers to check redundancy. To create a 10GB file we will use the dd command:

Now you should see a new 1GB file in /mnt/moosefs. You can check MooseFS status in MooseFS CGI

MooseFS CGI Goals after creating 1GB file

Shutdown one of chunkservers

You can shut down one of the chunkservers to see how MooseFS will react. You should be able to see that some of the chunks are now only on one of the servers. These chunks are labeled as undergoal because they are in fewer instances than the goal. The server will be temporarily flagged as in maintenance – you can remove server completely in Servers tab to start the data replication process.

MooseFS CGI Goals after creating 10GB file

Summary

You just learn how to easily set up the MooseFS cluster in Google Cloud!