How to create GlusterFS volume
A GlusterFS volume is a virtual disk that comprises bricks. A brick is a directory on the servers within the Trusted Pool dedicated to being joined into a GlusterFS volume.
A GlusterFS volume would then be exported and mounted by remote clients. There are multiple types of GlusterFS volume, and each provides a different level of scalability and performance.
Steps to create GlusterFS volume:
-
Allow network access for volume communication from the firewall on all nodes.
$ sudo firewall-cmd --zone=public --add-port=24009/tcp --permanent && sudo firewall-cmd --reload # CentOS, Fedora, Red Hat
$ sudo ufw allow 24009 # Ubuntu and Debian variance Rules updated Rules updated (v6) # Ubuntu and Debian
Each volume requires a dedicated port, starting from 24009. If you're to create more than one volume, also allow access to port 24010, 24011 and so on accordingly.
-
Create directory for our GlusterFS volume on all nodes.
$ sudo mkdir -p /var/data/gluster/brick
For the production server, it’s recommended to create the brick or GlusterFS volume on dedicated partition instead of in a system directory.
XFS is the recommended filesystem type for GlusterFS volume though other filesystem types can still be used.
-
Create GlusterFS volume from first node.
$ sudo gluster volume create volume1 replica 2 transport tcp node1:/var/data/gluster/brick node2:/var/data/gluster/brick force volume create: volume1: success: please start the volume to access data
Related: Types of GlusterFS volumes
Recommended to use more than 3 nodes to prevent split brain.
-
Enable the newly created volume from first node.
$ sudo gluster volume start volume1 volume start: volume1: success
-
Verify if the GlusterFS volume was created successfully from first node.
$ sudo gluster volume info all Volume Name: volume1 Type: Replicate Volume ID: 19550419-3495-45d7-bdc6-cab4fa4fb516 Status: Started Snapshot Count: 0 Number of Bricks: 1 x 2 = 2 Transport-type: tcp Bricks: Brick1: node1:/var/data/gluster/brick Brick2: node2:/var/data/gluster/brick Options Reconfigured: cluster.granular-entry-heal: on storage.fips-mode-rchecksum: on transport.address-family: inet nfs.disable: on performance.client-io-threads: off