A replicated GlusterFS volume is the direct choice when a shared volume must keep serving data after one brick or server fails. Each file is stored on every brick in the replica set, so the volume creation step must pair bricks across separate failure domains rather than simply list any empty directories.
The gluster volume create command writes the volume definition into the trusted storage pool, but the volume remains inaccessible until it is started. The replica count controls how many full copies are stored, and the listed bricks form the replica set for this focused non-distributed layout.
Use dedicated brick filesystems and consistent node names before creating the volume. A two-way replica can keep serving data after one replica member is unavailable, but it has less split-brain protection than a three-way or arbiter design, so choose the replica count before client data is written.
$ sudo gluster peer status Number of Peers: 1 Hostname: node2 Uuid: 0f8b8d42-8d5f-4d19-9a1f-2c1d4d7b9b10 State: Peer in Cluster (Connected)
$ sudo mkdir -p /srv/gluster/volume1/brick
Use an empty directory on a dedicated brick filesystem. Creating a brick on the system root filesystem can fill the operating system volume and may require unsafe force usage.
$ sudo gluster volume create volume1 replica 2 transport tcp node1:/srv/gluster/volume1/brick node2:/srv/gluster/volume1/brick volume create: volume1: success: please start the volume to access data
Keep every brick in the replica set on a different server or failure domain. GlusterFS can reject same-peer replica layouts unless force is appended, and forcing that layout reduces fault tolerance.
$ sudo gluster volume start volume1 volume start: volume1: success
$ sudo gluster volume info volume1 Volume Name: volume1 Type: Replicate Status: Started Number of Bricks: 1 x 2 = 2 Transport-type: tcp Bricks: Brick1: node1:/srv/gluster/volume1/brick Brick2: node2:/srv/gluster/volume1/brick
$ sudo gluster volume status volume1 Status of volume: volume1 Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node1:/srv/gluster/volume1/brick 49152 0 Y 2148 Brick node2:/srv/gluster/volume1/brick 49153 0 Y 1987 Self-heal Daemon on node1 N/A N/A Y 1763 Self-heal Daemon on node2 N/A N/A Y 1814 Task Status of Volume volume1 ------------------------------------------------------------------------------ There are no active volume tasks
Related: How to check GlusterFS volume status
$ sudo mkdir -p /mnt/volume1
$ sudo mount -t glusterfs node1:/volume1 /mnt/volume1
$ sudo touch /mnt/volume1/replica-test.txt
$ ls -l /mnt/volume1/replica-test.txt -rw-r--r-- 1 root root 0 Jun 16 10:30 /mnt/volume1/replica-test.txt
$ sudo rm /mnt/volume1/replica-test.txt
$ sudo umount /mnt/volume1
$ sudo rmdir /mnt/volume1