创建云存储卷:
(1)先要创建一个信赖的存储池使用以下命令:
# gluster peer probe SERVERNAME(SERVER IP) (注:添加云存储池,一次添加一台)
(2)查看云存储池的列表信息:
# gluster peer status
(3)创建云存储共享池:
# gluster volume create Cloud-volume server1(IP):/mnt/Brick1 server2(IP):/mnt/Brick2……..
(4)启动云存储卷:
#gluster volume start Cloud-volume
(5)查看云存储信息:
#gluster volume info Cloud-volume/all (all是显示所有的卷信息)
(6)客户端挂载使用云存储,以nfs或glusterfs两种挂载方式:
# mount –t nfs ric:/Cloud /mnt
# mount –t glusterfs ric:/Cloud /mnt
(注:客户端需要加入DNS解析,否则请使用IP地址进行挂载)
扩展云存储容量:
(1)在集群存储中要添加新的存储节点时使用命令:
# gluster peer probe NewServerName(NewServerIP)
Probe successful
(2)添加新存储块使用以下命令:(存储块所在的存储节点需先加到存储节点池中)
# gluster volume add-brick Cloud-volume server7(IP):/brick1
Add Brick successful
(3)检查卷信息使用以下命令:
# gluster volume info
Volume Name: Cloud
Type: Distribute
Status: Started
Number of Bricks: 5
Transport-type: tcp
Bricks:
Brick1: 192.168.1.3:/mnt/brick1
Brick2: 192.168.1.5:/mnt/brick1
Brick13: 192.168.1.3:/mnt/brick2
Brick14: 192.168.1.5:/mnt/brick2
Brick3: 192.168.1.7:/mnt/brick1
删除云存储块:
(1)删除云存储块要先停止云存储工作使用以下:
# gluster volume stop Cloud
(2)删除云存储块使用以下:
# gluster volume remove-brick Cloud-volume server7:/brick1
Removing brick(s) can result in data loss. Do you want to Continue? (y/n)
输入“Y”来确认操作。该命令显示以下内容:
Remove Brick successful
(3)检查卷信息使用以下命令:
# gluster volume info
Volume Name: Cloud
Type: Distribute
Status: Started
Number of Bricks: 4
T ransport-type: tcp
Bricks:
Brick1: 192.168.1.3:/mnt/brick1
Brick2: 192.168.1.5:/mnt/brick1
Brick13: 192.168.1.3:/mnt/brick2
Brick14: 192.168.1.5:/mnt/brick2
(4)启动Cloud云存储:
# gluster volume start Cloud
迁移卷数据块:
(1)您可以把云存储中的数据从一个存储块中迁移到另一个存储块,且集群是在线并正常使用。
迁移从server3:/mnt/brick1 到server7:/mnt/brick1
# gluster volume replace-brick Cloud-volume server3:/brick1 server7:/brick1 start
Replace brick start operation successful
(2)如果需要暂停迁移操作,请使用以下命令:
# gluster volume replace-brick Cloud-volume server3:/brick1 server7:/brick1 pause
Replace brick pause operation successful
(3)如果需要中止迁移操作,请使用以下命令:
# gluster volume replace-brick Cloud-volume server3:/brick1 server7:/brick1 abort
Replace brick abort operation successful
(4)使用以下命令检查迁移运行状态:
# gluster volume replace-brick Cloud-volume server3:/brick1 server7:/brick1 status
Current File = /usr/src/linux-headers-2.6.31-14/block/Makefile
Number of files migrated = 10567 Migration complete
显示当前文件正在迁移与目前迁移的文件总数。迁移完成后,它会显示迁移完成。
# gluster volume replace-brick Cloud-volume server3:/brick1 server7:/brick1 commit (commit命令完成新卷数据迁移)
Replace-brick commit successful
(5)使用以下命令验证查看迁移卷信息:
# gluster volume info Cloud-volume
Volume Name: Cloud-volume
Type: Replicate
Status: Started
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: 192.168.1.7:/mnt/brick1
Brick2: 192.168.1.5:/mnt/brick1
Brick13: 192.168.1.3:/mnt/brick2
Brick14: 192.168.1.5:/mnt/brick2
重新平衡卷:
扩大或缩小云存储卷后,则需要重新平衡服务器之间的数据,这样再新写入数据将被自动均匀分布到云存储中。
(1)检查平衡运行状态,使用以下命令:
# gluster volume rebalance Cloud-volume status
Rebalance in progress: rebalanced 399 files of size 302047 (total files
scanned 765)
# gluster volume rebalance test-volume status
Rebalance completed!
(2)根据需要暂停重新平衡操作,使用下面的命令:
# gluster volume rebalance test-volume stop
Stopping rebalance on volume test-volume has been successful
(3)重新平衡修复云存储布局变化:
# gluster volume rebalance Cloud-volume fix-layout start
Starting rebalance on volume test-volume has been successful
云存储中目录配额:
(1)要先启用磁盘配额,使用以下命令:
gluster volume quota Cloud enable
Quota is enabled on /Cloud
(2)设置磁盘限额使用以下命令:(设置存储目录下DDD,限额500MB)
gluster volume quota Cloud limit-usage /DDD 500MB
limit set on /DDD
(3)显示硬盘限额信息使用以下命令:
# gluster volume quota Cloud list
path limit_set size
-----------------------------------------------------------------
/DDD 524288000 525074432
/UserHomes/FILM/xiao 524288000 1049608192
(3)删除硬盘目录限额使用以下命令:
# gluster volume quota Cloud remove /UserHomes/FILM/xiao
Removed quota limit on /UserHomes/FILM/xiao
(4)随着需求量的扩大,要重新设置目录限额使用如下命令:
# gluster volume quota Cloud limit-usage /DD 1GB
limit set on /DD
(5)查看磁盘重新限额信息使用以下命令:
# gluster volume quota Cloud list
path limit_set size
--------------------------------------------------------------------
/DD 1073741824 525074432
(6)禁用硬盘配额使用以下命令:
# gluster volume quota Cloud disable
Disabling quota has been successful
云存储日志文件:
日志路径 :
# cd /var/log/glusterfs/
bricks/ etc-glusterfs-glusterd.vol.log mnt-cloudshare.log tmp-mntJFCe8q.log
cli.log geo-replication/
nfs.log tmp-mntk44Tx9.log
.cmd_log_history geo-replication-slaves/ tmp-mntdxpiye.log tmp-mntqWJ5OB.log
etc-glusterd-mount-Cloud.log mnt-cloudshare-.log tmp-mntefTB2H.log tmp-mntqxyKF8.log
当出现故障时首先要先查看日志信息,然后再进行故障排除,具体以情况来定。