5.5. Creating Replicated Volumes
gluster volume createto create different types of volumes, and
gluster volume infoto verify successful volume creation.
- A trusted storage pool has been created, as described in Section 4.1, “Adding Servers to the Trusted Storage Pool”.
- Understand how to start and stop volumes, as described in Section 5.10, “Starting Volumes”.
5.5.1. Creating Three-way Replicated Volumes
Figure 5.2. Illustration of a Three-way Replicated Volume
- Run the
gluster volume createcommand to create the replicated volume.The syntax is
# gluster volume create NEW-VOLNAME [replica COUNT] [transport tcp | rdma (Deprecated) | tcp,rdma] NEW-BRICK...The default value for transport is
tcp. Other options can be passed such as
auth.reject. See Section 11.1, “Configuring Volume Options” for a full list of parameters.
Example 5.3. Replicated Volume with Three Storage ServersThe order in which bricks are specified determines how bricks are replicated with each other. For example, every
3is the replica count forms a replica set. This is illustrated in Figure 5.2, “Illustration of a Three-way Replicated Volume”.
# gluster volume create test-volume replica 3 transport tcp server1:/rhgs/brick1 server2:/rhgs/brick2 server3:/rhgs/brick3 Creation of test-volume has been successful Please start the volume to access data.
# gluster volume start VOLNAMEto start the volume.
# gluster volume start test-volume Starting test-volume has been successful
gluster volume infocommand to optionally display the volume information.
5.5.2. Creating Sharded Replicated Volumes
.sharddirectory, and are named with the GFID and a number indicating the order of the pieces. For example, if a file is split into four pieces, the first piece is named GFID and stored normally. The other three pieces are named GFID.1, GFID.2, and GFID.3 respectively. They are placed in the
.sharddirectory and distributed evenly between the various bricks in the volume.
18.104.22.168. Supported use cases
Example 5.4. Example: Three-way replicated sharded volume
- Set up a three-way replicated volume, as described in the Red Hat Gluster Storage Administration Guide: https://access.redhat.com/documentation/en-US/red_hat_gluster_storage/3.5/html/Administration_Guide/sect-Creating_Replicated_Volumes.html#Creating_Three-way_Replicated_Volumes.
- Before you start your volume, enable sharding on the volume.
# gluster volume set test-volume features.shard enable
- Start the volume and ensure it is working as expected.
# gluster volume test-volume start # gluster volume info test-volume
22.214.171.124. Configuration Options
- Enables or disables sharding on a specified volume. Valid values are
disable. The default value is
# gluster volume set volname features.shard enableNote that this only affects files created after this command is run; files created before this command is run retain their old behaviour.
- Specifies the maximum size of the file pieces when sharding is enabled. The supported value for this parameter is 512MB.
# gluster volume set volname features.shard-block-size 32MBNote that this only affects files created after this command is run; files created before this command is run retain their old behaviour.
126.96.36.199. Finding the pieces of a sharded file
# getfattr -d -m. -e hex path_to_file
# ls /rhgs/*/.shard -lh | grep GFID