- Trusted storage pools (Trusted Storage Pool)
- Create a storage pool
For example, to create a storage pool with 3 servers, you need to add two additional servers to the storage pool from the first server server1:
# Gluster peer probe Server2probe successful# Gluster Pool Peer Server3probe successful
To view the storage pool status:
# Gluster Peer Statusnumber of peers:2hostname:server2.quenywell.comuuid:86bd7b96-1320-4cd5-b3e1-e537d06dd5f7state: Peer in Cluster (Connected) Hostname:server3.quenywell.comuuid:c191b17b-ab9d-4b15-a70d-dcc92be067c9state:peer in Cluster (Connected)
Removing a server from a storage pool
Suppose you want to remove Server3 from the storage pool, you can use the following command:
# Gluster Peer Detach Server3detach Successful
Glusterfs Logical Volume (Volume)
A logical volume consists of one or more storage blocks (Brick), each corresponding to a directory in the storage pool.
There are three basic types of glusterfs, namely, distributed storage (distributed, placing different files in different storage blocks), mirrored storage (replicated, the same file is stored in more than two storage blocks, equivalent to RAID1) and shard storage (striped, Divides a file into multiple fixed-length data, scattered across all storage blocks, equivalent to RAID0. In addition, distributed can be combined with replicated and striped to form new types.
Basic syntax for establishing a glusterfs logical volume:
# Gluster Volume Create[stripe] [replica] [device VG] [transport] ...
- Creating distributed logical Volumes
Create a distributed logical volume with a name of Dis-volume, two storage blocks, and a TCP protocol:
# Gluster Volume Create Dis-volume server1:/data server2:/datacreation of Dis-volume has been successfulplease start the V Olume to access data.
To view the status of a logical volume:
# Gluster Volume Info volume name:dis-volumetype:distributevolume Id:5429d6c1-44e5-43ad-a495-0a1f5b6d774bstatus: Startednumber of bricks:1 x 2 = 2transport-type:tcpbricks:brick1:server1.quenywell.com:/databrick2:server2.quenywell . com:/data
Creating replicated logical Volumes
Create a replicated logical volume with a name of Rep-volume that contains two storage blocks that use the TCP protocol:
# gluster Volume Create Rep-volume Replica 2 transport TCP Server1:/data server2:/datacreation of Rep-volume has been succ Essfulplease start the volume to access data.
Creating striped logical Volumes
Create a striped logical volume with a name of Strip-volume that contains two storage blocks that use the TCP protocol:
# gluster Volume Create Strip-volume Stripe 2 Transport TCP Server1:/data server2:/datacreation of Strip-volume has been s Uccessfulplease start the volume to access data.
Glusterfs Logical Volume permission control (optional, not required)
You can set access permissions for Gluster logical volumes to increase security. You can use Auth.allow and auth.reject to allow or disallow access to logical volumes for specific IP addresses, and to support * wildcard characters. For example: 192.168.0.*, 192.168.*, and 192.* are all rules-compliant.
For example, allow host access to the 192.168.0.* network segment Rep-volume:
# Gluster Volume set Rep-volume auth.allow 192.168.0.*
Start Glusterfs Logical Volume
Note: Logical volumes must be started before they can be used!
Basic syntax:
# Gluster Volume start
For example, to start Rep-volume:
# Gluster Start Rep-volumestarting Rep-volume has been successful
View Glusterfs Logical Volume status
Basic syntax:
# Gluster Volume Info
For example, to view the Rep-volume status:
# Gluster Volume Info rep-volume volume Name:rep-volumetype:replicatevolume ID: 5429d6c1-44e5-43ad-a495-0a1f5b6d774bstatus:startednumber of bricks:1 x 2 = 2transport-type:tcpbricks:brick1: Server1.quenywell.com:/databrick2:server2.quenywell.com:/data
Stop Glusterfs Logical volumes
# Gluster Volume Stop rep-volumestopping volume would make it data inaccessible. Want to continue? (y/n)
Enter Y and press ENTER, and the following message will appear:
Stopping volume Rep-volume has been successful
Delete a glusterfs logical volume
# Gluster Volume Delete rep-volumedeleting volume would erase all information about the volume. Want to continue? (y/n)
Enter Y and press ENTER, and the following message will appear:
Deleting Volume Test-volume has been successful
Storage Block Brick Operations Command
- Increase Brick
Add a storage block server3:/data to the Rep-volume volume:
# Gluster Volume Add-brick Rep-volume server3:/dataadd Brick Successful
Important: The rebalance command must be executed once each time the storage block is manipulated!
# Gluster Volume rebalance Rep-volume startstarting rebalancing on volume rep-volume have been successful
Delete Brick
Delete the storage block Server3:/data in the Rep-volume volume:
# Gluster Volume Remove-brick Rep-volume server3:/dataremoving Brick (s) can result in data loss. Want to Continue? (y/n)
Enter Y and press ENTER, and the following message will appear:
Remove Brick Successful
Execute the rebalance command:
# Gluster Volume rebalance Rep-volume startstarting rebalancing on volume rep-volume have been successful
This article is from the "Elephant" blog, make sure to keep this source http://zlyang.blog.51cto.com/1196234/1760927
Glusterfs Common Settings commands