GlusterFS測試報告-01

一、GlusterFS基礎環境的介紹

1、關于GlusterFS文件系統和架構的介紹

http://jingyan.baidu.com/article/046a7b3ef65250f9c27fa9d9.html

2、實驗的目的

a. 利用多臺性能較低并且老舊的服務器,實現企業的云盤功能

b. GlusterFS服務端和客戶端的部署和配置

c. 實現GlusterFS多節點的負載均衡功能

3、測試環境說明

操作系統:CentOS 6.7 X64

內核版本:2.6.32-573.el6.x86_64

軟件版本:glusterfs 3.7.10

使用4臺服務器創卷GlusterFS的DHT功能,客戶端win10使用samba進行連接配置

二、GlusterFS服務端的配置(server01)

1、GlusterFS無中心化概念,很多關于GlusterFS的配置僅需要在其中一臺主機設置

2、配置NTP服務器同步(這里也可以在crontab腳本里面,添加一個定時任務)

[root@server01 ~]# ntpdate -u 10.203.10.20
18 Apr 14:16:15 ntpdate[2700]: adjust time server 10.203.10.20 offset 0.008930 sec
[root@server01 ~]# hwclock -w

3、查看hosts表的記錄

[root@server01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.11server01
192.168.1.12server02
192.168.1.13server03
192.168.1.14server04

4、單獨添加一塊磁盤作為共享卷使用(這里也可以配置LVM)

[root@server01 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x0ef88f22.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0ef88f22
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 
Using default value 2610
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@server01 ~]# partx /dev/sdb
# 1:        63- 41929649 ( 41929587 sectors,  21467 MB)
# 2:         0-       -1 (        0 sectors,      0 MB)
# 3:         0-       -1 (        0 sectors,      0 MB)
# 4:         0-       -1 (        0 sectors,      0 MB)
[root@server01 ~]# fdisk -l |grep /dev/sdb
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
/dev/sdb1               1        2610    20964793+  83  Linux
[root@server01 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

5、創建掛載目錄,并設置開機掛載

[root@server01 ~]# mkdir -p /glusterfs-xfs-mount
[root@server01 ~]# mount /dev/sdb1 /glusterfs-xfs-mount/
[root@server01 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       193G  7.2G  176G   4% /
tmpfs           932M     0  932M   0% /dev/shm
/dev/sda1       190M   41M  139M  23% /boot
/dev/sdb1        20G   44M   19G   1% /glusterfs-xfs-mount

6、修改自動掛載

[root@server01 ~]# echo '/dev/sdb1 /glusterfs-xfs-mount xfs defaults 0 0' >> /etc/fstab

7、添加外部源

[root@server01 ~]#  cd /etc/yum.repos.d/
[root@server01 yum.repos.d]# wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo

8、安裝glusterfs服務端軟件,并啟動服務

[root@server01 yum.repos.d]#  yum -y install glusterfs-server
[root@server01 yum.repos.d]#  /etc/init.d/glusterd start
Starting glusterd:                                         [  OK  ]
[root@server01 yum.repos.d]# chkconfig glusterd on
[root@server01 yum.repos.d]# chkconfig --list glusterd
glusterd       0:off1:off2:on3:on4:on5:on6:off
[root@server01 yum.repos.d]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       193G  7.2G  176G   4% /
tmpfs           932M     0  932M   0% /dev/shm
/dev/sda1       190M   41M  139M  23% /boot
/dev/sdb1        20G   44M   19G   1% /glusterfs-xfs-mount

9、添加集群對象(server02以及server03)

[root@server01 yum.repos.d]# gluster peer status
Number of Peers: 0
[root@server01 yum.repos.d]# gluster peer probe server02
peer probe: success. 
[root@server01 yum.repos.d]# gluster peer status
Number of Peers: 1
Hostname: server02
Uuid: c58d0715-32ff-4962-90d9-4275fa65793a
State: Peer in Cluster (Connected)
[root@server01 yum.repos.d]# gluster peer probe server03
peer probe: success. 
[root@server01 yum.repos.d]# gluster peer status
Number of Peers: 2
Hostname: server02
Uuid: c58d0715-32ff-4962-90d9-4275fa65793a
State: Peer in Cluster (Connected)
Hostname: server03
Uuid: 5110d0af-fdd9-4c82-b716-991cf0601b53
State: Peer in Cluster (Connected)

10、創建Gluster Volume

[root@server01 yum.repos.d]# gluster volume create dht-volume01 server01:/glusterfs-xfs-mount server02:/gluste
rfs-xfs-mount server03:/glusterfs-xfs-mount
volume create: dht-volume01: failed: The brick server01:/glusterfs-xfs-mount is a mount point. Please create a
 sub-directory under the mount point and use that as the brick directory. Or use 'force' at the end of the com
mand if you want to override this behavior.
[root@server01 yum.repos.d]# echo $?
1
[root@server01 yum.repos.d]# gluster volume create dht-volume01 server01:/glusterfs-xfs-mount server02:/gluste
rfs-xfs-mount server03:/glusterfs-xfs-mount force
volume create: dht-volume01: success: please start the volume to access data
[root@server01 yum.repos.d]# gluster volume start dht-volume01
volume start: dht-volume01: success
[root@server01 yum.repos.d]# gluster volume status
Status of volume: dht-volume01
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick server01:/glusterfs-xfs-mount         49152     0          Y       2948 
Brick server02:/glusterfs-xfs-mount         49152     0          Y       2910 
Brick server03:/glusterfs-xfs-mount         49152     0          Y       11966
NFS Server on localhost                     N/A       N/A        N       N/A  
NFS Server on server02                      N/A       N/A        N       N/A  
NFS Server on server03                      N/A       N/A        N       N/A  
 
Task Status of Volume dht-volume01
------------------------------------------------------------------------------
There are no active volume tasks

11、測試寫入一個512M的文件

[root@server01 yum.repos.d]# cd /glusterfs-xfs-mount/
[root@server01 glusterfs-xfs-mount]# dd if=/dev/zero of=test.img bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 5.20376 s, 103 MB/s
[root@server01 glusterfs-xfs-mount]# ls
lost+found  test.img

三、GlusterFS服務端的配置(server02與server03上的配置類似)

1、配置時間同步,這里的ntp服務器IP地址為10.203.10.20

[root@server02 ~]# ntpdate -u 10.203.10.20
18 Apr 14:27:58 ntpdate[2712]: adjust time server 10.203.10.20 offset -0.085282 sec
[root@server02 ~]# hwclock -w

2、查看host表的信息

[root@server02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.11server01
192.168.1.12server02
192.168.1.13server03
192.168.1.14server04

3、在本地設置一塊單獨的盤,組成GlusterFS卷的一部分

[root@server02 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x927b5e72.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x927b5e72
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 
Using default value 2610
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

4、更新磁盤分區表信息,使磁盤分區和格式化

[root@server02 ~]# partx /dev/sdb
# 1:        63- 41929649 ( 41929587 sectors,  21467 MB)
# 2:         0-       -1 (        0 sectors,      0 MB)
# 3:         0-       -1 (        0 sectors,      0 MB)
# 4:         0-       -1 (        0 sectors,      0 MB)
[root@server02 ~]# fdisk -l|grep /dev/sdb
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
/dev/sdb1               1        2610    20964793+  83  Linux
[root@server02 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@server02 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       193G  7.3G  176G   4% /
tmpfs           932M     0  932M   0% /dev/shm
/dev/sda1       190M   41M  139M  23% /boot

5、創建掛載目錄,并配置掛載信息

[root@server02 ~]# mkdir -p /glusterfs-xfs-mount
[root@server02 ~]# mount /dev/sdb1 /glusterfs-xfs-mount/
[root@server02 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       193G  7.3G  176G   4% /
tmpfs           932M     0  932M   0% /dev/shm
/dev/sda1       190M   41M  139M  23% /boot
/dev/sdb1        20G   44M   19G   1% /glusterfs-xfs-mount
[root@server02 ~]# echo '/dev/sdb1 /glusterfs-xfs-mount xfs defaults 0 0' >> /etc/fstab

6、配置yum源,并安裝GlusterFS服務端軟件

[root@server02 ~]#  cd /etc/yum.repos.d/
[root@server02 yum.repos.d]#  wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glust
erfs-epel.repo
--2016-04-18 14:32:22--  http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.
repo
Resolving download.gluster.org... 23.253.208.221, 2001:4801:7824:104:be76:4eff:fe10:23d8
Connecting to download.gluster.org|23.253.208.221|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1049 (1.0K)
Saving to: “glusterfs-epel.repo”
100%[==============================================================>] 1,049       --.-K/s   in 0s      
2016-04-18 14:32:23 (36.4 MB/s) - “glusterfs-epel.repo” saved [1049/1049]
[root@server02 yum.repos.d]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noa
rch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.gaJCKd: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@server02 yum.repos.d]# yum -y install glusterfs-server

7、啟動glusterd服務

[root@server02 yum.repos.d]# /etc/init.d/glusterd start
Starting glusterd:                                         [  OK  ]
[root@server02 yum.repos.d]# chkconfig glusterd on
[root@server02 yum.repos.d]# chkconfig --list glusterd
glusterd       0:off1:off2:on3:on4:on5:on6:off

8、查看gluster集群節點和卷的信息

[root@server02 yum.repos.d]# gluster peer status
Number of Peers: 1
Hostname: server01
Uuid: e90a3b54-5a9d-4e57-b502-86f9aad8b576
State: Peer in Cluster (Connected)
[root@server02 yum.repos.d]# gluster volume status
Status of volume: dht-volume01
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick server01:/glusterfs-xfs-mount         49152     0          Y       2948 
Brick server02:/glusterfs-xfs-mount         49152     0          Y       2910 
Brick server03:/glusterfs-xfs-mount         49152     0          Y       11966
NFS Server on localhost                     2049      0          Y       2932 
NFS Server on server01                      2049      0          Y       2968 
NFS Server on server03                      2049      0          Y       11986
 
Task Status of Volume dht-volume01
------------------------------------------------------------------------------
There are no active volume tasks
[root@server02 yum.repos.d]# ll /glusterfs-xfs-mount/
total 16
drwx------ 2 root root 16384 Apr 18 14:29 lost+found
[root@server02 yum.repos.d]# cd /glusterfs-xfs-mount/
[root@server02 glusterfs-xfs-mount]# dd if=/dev/zero of=server02.img bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 5.85478 s, 91.7 MB/s
[root@server02 glusterfs-xfs-mount]# ls
lost+found  server02.img

由于我這里配置的是DHT的模式,所以集群在server01與server02的數據信息是不同的,除非人為寫入相同文件

四、手動添加和刪除brick卷的卷節點的信息(任意一個gluster服務端節點上的操作都可以)

1、添加server04節點

[root@server01 glusterfs-xfs-mount]# gluster peer probe server04
peer probe: success. 
[root@server01 glusterfs-xfs-mount]# gluster peer status
Number of Peers: 3
Hostname: server02
Uuid: c58d0715-32ff-4962-90d9-4275fa65793a
State: Peer in Cluster (Connected)
Hostname: server03
Uuid: 5110d0af-fdd9-4c82-b716-991cf0601b53
State: Peer in Cluster (Connected)
Hostname: server04
Uuid: d653b5c2-dac4-428c-bf6f-eea393adbb16
State: Peer in Cluster (Connected)

2、添加一個節點卷的信息到dht-volume的brick中

[root@server01 glusterfs-xfs-mount]# gluster volume add-brick
Usage: volume add-brick <VOLNAME> [<stripe|replica> <COUNT>] <NEW-BRICK> ... [force]
[root@server01 glusterfs-xfs-mount]# gluster volume add-brick dht-volume01 server04:/glusterfs-xfs-mount
volume add-brick: failed: Pre Validation failed on server04. The brick server04:/glusterfs-xfs-mount is a moun
t point. Please create a sub-directory under the mount point and use that as the brick directory. Or use 'forc
e' at the end of the command if you want to override this behavior.
[root@server01 glusterfs-xfs-mount]# gluster volume add-brick dht-volume01 server04:/glusterfs-xfs-mount force
volume add-brick: success
[root@server01 glusterfs-xfs-mount]# gluster volume status
Status of volume: dht-volume01
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick server01:/glusterfs-xfs-mount         49152     0          Y       2948 
Brick server02:/glusterfs-xfs-mount         49152     0          Y       2910 
Brick server03:/glusterfs-xfs-mount         49152     0          Y       11966
Brick server04:/glusterfs-xfs-mount         49152     0          Y       2925 
NFS Server on localhost                     2049      0          Y       3258 
NFS Server on server02                      2049      0          Y       3107 
NFS Server on server03                      2049      0          Y       12284
NFS Server on server04                      2049      0          Y       2945 
 
Task Status of Volume dht-volume01
------------------------------------------------------------------------------
There are no active volume tasks

3、從brick中移除一個節點卷

[root@server01 ~]# gluster volume remove-brick dht-volume01 server04:/glusterfs-xfs-mount/ 
Usage: volume remove-brick <VOLNAME> [replica <COUNT>] <BRICK> ... <start|stop|status|commit|force>
[root@server01 ~]# gluster volume remove-brick dht-volume01 server04:/glusterfs-xfs-mount/ commit
Removing brick(s) can result in data loss. Do you want to Continue? (y/n) y
volume remove-brick commit: success
Check the removed bricks to ensure all files are migrated.
If files with data are found on the brick path, copy them via a gluster mount point before re-purposing the re
moved brick. 
[root@server01 ~]# gluster volume status
Status of volume: dht-volume01
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick server01:/glusterfs-xfs-mount         49152     0          Y       2948 
Brick server02:/glusterfs-xfs-mount         49152     0          Y       2910 
Brick server03:/glusterfs-xfs-mount         49152     0          Y       11966
NFS Server on localhost                     2049      0          Y       3336 
NFS Server on server02                      2049      0          Y       3146 
NFS Server on server04                      2049      0          Y       2991 
NFS Server on server03                      2049      0          Y       12323
 
Task Status of Volume dht-volume01
------------------------------------------------------------------------------
There are no active volume tasks

五、配置負載均衡(文件均衡分布-rebalance)

[root@server01 ~]# gluster volume rebalance dht-volume01
Usage: volume rebalance <VOLNAME> {{fix-layout start} | {start [force]|stop|status}}
[root@server01 ~]# gluster volume rebalance dht-volume01 fix-layout start
volume rebalance: dht-volume01: success: Rebalance on dht-volume01 has been started successfully. Use rebalanc
e status command to check status of the rebalance process.
ID: 6ce8fd86-dd1e-4ce3-bb44-82532b5055dd
[root@server01 ~]# gluster volume rebalance dht-volume01 fix-layout status
Usage: volume rebalance <VOLNAME> {{fix-layout start} | {start [force]|stop|status}}
[root@server01 ~]# gluster
gluster> volume rebalance dht-volume01 status
                                    Node Rebalanced-files          size       scanned      failures       skip
ped               status  run time in h:m:s
                               ---------      -----------   -----------   -----------   -----------   --------
---         ------------     --------------
                               localhost                0        0Bytes             0             0           
  0 fix-layout completed        0:0:0
                                server02                0        0Bytes             0             0           
  0 fix-layout completed        0:0:0
                                server03                0        0Bytes             0             0           
  0 fix-layout completed        0:0:0
volume rebalance: dht-volume01: success
[root@server01 glusterfs-xfs-mount]# cd /glusterfs-xfs-mount/
[root@server01 glusterfs-xfs-mount]# gluster volume set dht-volume01 nfs.disable on
volume set: success
[root@server01 glusterfs-xfs-mount]# gluster volume status
Status of volume: dht-volume01
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick server01:/glusterfs-xfs-mount         49152     0          Y       2948 
Brick server02:/glusterfs-xfs-mount         49152     0          Y       2910 
Brick server03:/glusterfs-xfs-mount         49152     0          Y       11966
 
Task Status of Volume dht-volume01
------------------------------------------------------------------------------
Task                 : Rebalance           
ID                   : 6ce8fd86-dd1e-4ce3-bb44-82532b5055dd
Status               : completed

創建文件進行測試:

[root@server01 glusterfs-xfs-mount]# touch {1..100}.txt
[root@server01 glusterfs-xfs-mount]# ls
100.txt  12.txt  16.txt  20.txt  25.txt  3.txt   55.txt  65.txt  70.txt  75.txt  92.txt       lost+found
10.txt   14.txt  18.txt  21.txt  2.txt   43.txt  57.txt  67.txt  71.txt  77.txt  client2.iso  test.img
11.txt   15.txt  1.txt   22.txt  30.txt  47.txt  61.txt  6.txt   72.txt  88.txt  client.iso
[root@server02 glusterfs-xfs-mount]# ls
13.txt  23.txt  28.txt  34.txt  39.txt  46.txt  52.txt  66.txt  76.txt  81.txt  8.txt   93.txt
17.txt  26.txt  29.txt  35.txt  41.txt  4.txt   58.txt  68.txt  79.txt  83.txt  90.txt  94.txt
19.txt  27.txt  33.txt  37.txt  42.txt  51.txt  62.txt  73.txt  80.txt  86.txt  91.txt  97.txt
[root@server03 ~]# cd /glusterfs-xfs-mount/
[root@server03 glusterfs-xfs-mount]# ls
24.txt  36.txt  44.txt  49.txt  54.txt  5.txt   64.txt  78.txt  84.txt  89.txt  98.txt  lost+found
31.txt  38.txt  45.txt  50.txt  56.txt  60.txt  69.txt  7.txt   85.txt  95.txt  99.txt  server03.img
32.txt  40.txt  48.txt  53.txt  59.txt  63.txt  74.txt  82.txt  87.txt  96.txt  9.txt   server04.iso
[root@client01 ~]# cd /glusterFS-mount/
[root@client01 glusterFS-mount]# ls
100.txt  18.txt  26.txt  34.txt  42.txt  50.txt  59.txt  67.txt  75.txt  83.txt  91.txt  9.txt
10.txt   19.txt  27.txt  35.txt  43.txt  51.txt  5.txt   68.txt  76.txt  84.txt  92.txt  client2.iso
11.txt   1.txt   28.txt  36.txt  44.txt  52.txt  60.txt  69.txt  77.txt  85.txt  93.txt  client.iso
12.txt   20.txt  29.txt  37.txt  45.txt  53.txt  61.txt  6.txt   78.txt  86.txt  94.txt  lost+found
13.txt   21.txt  2.txt   38.txt  46.txt  54.txt  62.txt  70.txt  79.txt  87.txt  95.txt  server03.img
14.txt   22.txt  30.txt  39.txt  47.txt  55.txt  63.txt  71.txt  7.txt   88.txt  96.txt  server04.iso
15.txt   23.txt  31.txt  3.txt   48.txt  56.txt  64.txt  72.txt  80.txt  89.txt  97.txt  test.img
16.txt   24.txt  32.txt  40.txt  49.txt  57.txt  65.txt  73.txt  81.txt  8.txt   98.txt
17.txt   25.txt  33.txt  41.txt  4.txt   58.txt  66.txt  74.txt  82.txt  90.txt  99.txt

文件均衡分布的功能實現了

六、配置gluster客戶端

[root@client01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.11server01
192.168.1.12server02
192.168.1.13server03
192.168.1.14server04
[root@client01 ~]# mkdir -p /glusterFS-mount
[root@client01 ~]# mount -t glusterfs server01:/dht-volume01 /glusterFS-mount/
[root@client01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             193G  7.6G  176G   5% /
tmpfs                 932M   76K  932M   1% /dev/shm
/dev/sda1             190M   41M  139M  23% /boot
server01:/dht-volume01
                       59G  1.7G   55G   3% /glusterFS-mount
[root@client01 ~]# cd /glusterFS-mount/
[root@client01 glusterFS-mount]# LS
-bash: LS: command not found
[root@client01 glusterFS-mount]# ls
lost+found  server02.img  server03.img  test.img
[root@client01 glusterFS-mount]# dd if=/dev/zero of=client.iso bs=1M count=123
123+0 records in
123+0 records out
128974848 bytes (129 MB) copied, 1.52512 s, 84.6 MB/s
[root@client01 glusterFS-mount]# ls
client.iso  lost+found  server02.img  server03.img  test.img
[root@client01 glusterFS-mount]# dd if=/dev/zero of=client2.iso bs=1M count=456
456+0 records in
456+0 records out
478150656 bytes (478 MB) copied, 8.76784 s, 54.5 MB/s
[root@client01 glusterFS-mount]# ls
client2.iso  client.iso  lost+found  server02.img  server03.img  test.img
[root@client01 glusterFS-mount]# ls
client2.iso  client.iso  lost+found  server02.img  server03.img  test.img
[root@client01 glusterFS-mount]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             193G  7.2G  176G   4% /
tmpfs                 932M   76K  932M   1% /dev/shm
/dev/sda1             190M   41M  139M  23% /boot
server01:/dht-volume01
                       40G  1.7G   36G   5% /glusterFS-mount
[root@client01 glusterFS-mount]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             193G  7.6G  176G   5% /
tmpfs                 932M   80K  932M   1% /dev/shm
/dev/sda1             190M   41M  139M  23% /boot
server01:/dht-volume01
                       59G  2.2G   54G   4% /glusterFS-mount
[root@client01 glusterFS-mount]# cd ~
[root@client01 ~]# mount -a
Mount failed. Please check the log file for more details.
Mount failed. Please check the log file for more details.
[root@client01 ~]# ls
anaconda-ks.cfg  Documents  install.log         Music     Public     Videos
Desktop          Downloads  install.log.syslog  Pictures  Templates
[root@client01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             193G  7.6G  176G   5% /
tmpfs                 932M   80K  932M   1% /dev/shm
/dev/sda1             190M   41M  139M  23% /boot
server01:/dht-volume01
                       79G  2.3G   72G   4% /glusterFS-mount

通過容量差別可以發現,節點的卷已經添加成功

原創文章,作者:Net21-冰凍vs西瓜,如若轉載,請注明出處:http://www.www58058.com/24776

(0)
Net21-冰凍vs西瓜Net21-冰凍vs西瓜
上一篇 2016-07-22
下一篇 2016-07-22

相關推薦

  • Ubuntu 葵花寶典入門篇——要練此功,可能得自宮?

        此文章給初入ubuntu的小伙伴們寫一篇裝機篇和使用心得。第二期會給小伙伴介紹軟件安裝篇。如題目所說,烏班圖確實是葵花寶典,練好了天下無敵。只是如果要安裝UBUNTU系統,只是在虛擬機上跑跑是不夠的,你必須在實際的桌面環境和服務器環境上才能體會到它的運行方式,而桌面環境和服務器環境幾乎差不多。所以安裝桌面版可以更好的理解…

    Linux干貨 2017-03-26
  • Linux獲取命令幫助方法全攬

    Linux獲取命令幫助方法全攬 Linux命令分類 內置命令:shell程序自帶的命令 外部命令:獨立的可執行程序,在linux系統中存在與命令名稱相同的可執行文件,需要shell程序通過環境變量解析到對應的可執行性文件后才可執行 可使用type COMMAND查看命令的分類 獲取幫助的方法 內置命令獲取幫助 命令格式:help COMMAND 外部命令獲取…

    Linux干貨 2017-07-02
  • linux發展史

    Linux 發展史 說明 此前對linux認識模糊一知半解,近期通過學習將自己對于linux的發展總結一下方便大家日后的學習。那Linux是目前一款非常火熱的開源操作系統,可是linux是什么時候出現的,又是因為什么樣的原因被開發出來的呢。以下將對linux的發展歷程進行詳細的講解。    目錄 一、Linux發展背景 二、UINIX的誕…

    Linux干貨 2016-10-14
  • 計算機;GPL等開源協議;Linux 哲學思想的煉成;MBR & GPT—fazion in magedu 20.July

    入門Linux的基礎知識 fazionlan blog in 178Linux.July 22nd. 第一臺計算機 1946第一臺計算機ENIAC(electronic numerical integrator and calculator)在美國濱州大學誕生,是美國奧伯丁武器試驗場為了滿足計算彈道而研制的 馮諾依曼體系結構:1946年數學家提出運算器、控制…

    Linux干貨 2016-07-29
  • 我與Linux的第一次親密接觸

        作為一個新手,經過一周的學習,我對Linux目前有了些許的了解,從Linux的發展史中,開源共享精神深深的感染了我,也使得我對Linux的興趣更加濃厚。對于一個一直翹計算機課的我來說,入門和基礎是一項非常艱巨的任務,初期為了搭建學習的環境,也是費了不小的功夫,相信許多萌也對此有很大的感觸,在這里,我來和大家分享一下如何去構建環境。…

    Linux干貨 2017-03-26
  • Linux下的LVM管理命令

    一. 何為LVM?     Logical Volume Manager的縮寫,它可以把多個分區、硬盤甚至RAID組合成一個存儲設備來使用,并可以擴展或縮減空間。LVM有三層組成組成:底層的PV,中間的VG,上層的LV,如圖所示         &n…

    Linux干貨 2015-12-06
欧美性久久久久