ClusterStorage-2-配置Cluster Storage实验

0.实验前的环境检查

lab basicconfig setup检查环境,网络配置和主机的启动情况检查。

[student@workstation ~]$ lab basicconfig setup

Testing if serverc and serverd are ready for lab exercise work:

 · Testing if serverc is reachable.............................  PASS
 · Testing if glusterd is active on serverc....................  PASS
 · Testing if glusterd is active on serverc....................  PASS
 · Testing if serverd is reachable.............................  PASS
 · Testing if glusterd is active on serverd....................  PASS
 · Testing if glusterd is active on serverd....................  PASS

1.配置存储池

在serverc上, firewall-cmd --add-service=glusterfs放行glusterfs, firewall-cmd --permanent --add-service=glusterfs永久放行。serverd类似操作。gluster peer probe serverd.lab.example.com在serverc与serverd间建立可信任的存储池。

[root@serverc ~]# firewall-cmd --add-service=glusterfs
success
[root@serverc ~]# firewall-cmd --permanent --add-service=glusterfs
success
[root@serverd ~]# firewall-cmd --add-service=glusterfs
success
[root@serverd ~]# firewall-cmd --permanent --add-service=glusterfs
success
[root@serverc ~]# gluster peer probe serverd.lab.example.com
peer probe: success. 

2.配置brick

在serverc上,lvcreate -L 10G -T vg_bricks/labpool创建逻辑卷, lvcreate -V 2G -T vg_bricks/labpool -n brick-c1分配空间给brick-c1, mkfs -t xfs -i size=512 /dev/vg_bricks/brick-c1将空间格式化,mkdir -p /bricks/brick-c1创建目录,echo "/dev/vg_bricks/brick-c1 /bricks/brick-c1 xfs defaults 1 2" >> /etc/fstab编辑挂载配置文件, tail -1 /etc/fstab确认内容已写入,mount /bricks/brick-c1进行挂载,mkdir /bricks/brick-c1/brick创建目录,semanage fcontext -a -t glusterd_brick_t /bricks/brick-c1/brick编辑安全上下文,restorecon -Rv /bricks/brick-c1递归重载安全上下文。serverd类似操作。

[root@serverc ~]# lvcreate -L 10G -T vg_bricks/labpool
  Logical volume "labpool" created.
[root@serverc ~]# lvcreate -V 2G -T vg_bricks/labpool -n brick-c1
  Logical volume "brick-c1" created.
[root@serverc ~]# mkfs -t xfs -i size=512 /dev/vg_bricks/brick-c1
meta-data=/dev/vg_bricks/brick-c1 isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverc ~]# mkdir -p /bricks/brick-c1
[root@serverc ~]# echo "/dev/vg_bricks/brick-c1 /bricks/brick-c1 xfs defaults 1 2" >> /etc/fstab
[root@serverc ~]# tail -1 /etc/fstab
/dev/vg_bricks/brick-c1 /bricks/brick-c1 xfs defaults 1 2

[root@serverc ~]# mount /bricks/brick-c1
[root@serverc ~]# mkdir /bricks/brick-c1/brick
[root@serverc ~]# semanage fcontext -a -t glusterd_brick_t /bricks/brick-c1/brick
[root@serverc ~]# restorecon -Rv /bricks/brick-c1
restorecon reset /bricks/brick-c1/brick context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:glusterd_brick_t:s0

[root@serverd ~]# lvcreate -L 10G -T vg_bricks/labpool
  Logical volume "labpool" created.
[root@serverd ~]# lvcreate -V 2G -T vg_bricks/labpool -n brick-d1
  Logical volume "brick-d1" created.
[root@serverd ~]# mkfs -t xfs -i size=512 /dev/vg_bricks/brick-d1
meta-data=/dev/vg_bricks/brick-d1 isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverd ~]# mkdir -p /bricks/brick-d1
[root@serverd ~]# echo "/dev/vg_bricks/brick-d1 /bricks/brick-d1 xfs defaults 1 2" >> /etc/fstab
[root@serverd ~]# tail -1 /etc/fstab
/dev/vg_bricks/brick-d1 /bricks/brick-d1 xfs defaults 1 2

[root@serverd ~]# mount /bricks/brick-d1
[root@serverd ~]# mkdir /bricks/brick-d1/brick
[root@serverd ~]# semanage fcontext -a -t glusterd_brick_t /bricks/brick-d1/brick
[root@serverd ~]# restorecon -Rv /bricks/brick-d1
restorecon reset /bricks/brick-d1/brick context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:glusterd_brick_t:s0

3.配置volume

gluster volume create labvol serverc:/bricks/brick-c1/brick serverd:/bricks/brick-d1/brick使用serverc和serverd的brick创建volume。gluster volume start labvol启动volume。 gluster volume info labvol确认volume信息。

[root@serverc ~]# glgluster volume start labvoluster volume create labvol serverc:/bricks/brick-c1/brick serverd:/bricks/brick-d1/brick
volume create: labvol: success: please start the volume to access data
[root@serverc ~]# gluster volume start labvol
volume start: labvol: success
[root@serverc ~]# gluster volume info labvol
 
Volume Name: labvol
Type: Distribute
Volume ID: 53d8bf84-e239-4395-9f32-3035db957038
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: serverc:/bricks/brick-c1/brick
Brick2: serverd:/bricks/brick-d1/brick
Options Reconfigured:
performance.readdir-ahead: on

4.任务测评

lab basicconfig grade对任务进行测评。包括:建立存储池,确认大小/状态,挂载文件并确认文件类型,编辑安全上下文,检查volume是否创建,确认brick数量和状态,确认serverc和serverd的brick,及volume的状态。

[student@workstation ~]$ lab basicconfig grade

Grading the student's work:

 · Testing if both serverc and serverd are in pool.............  PASS
 · Testing for thinly provisioned pool on serverc..............  PASS
 · Testing for thinly provisioned pool size on serverc.........  PASS
 · Testing for mounted file system and type on serverc.........  PASS
 · Testing for brick SELinux context on serverc................  PASS
 · Testing for thinly provisioned pool on serverd..............  PASS
 · Testing for thinly provisioned pool size on serverd.........  PASS
 · Testing for mounted file system and type on serverd.........  PASS
 · Testing for brick SELinux context on serverd................  PASS
 · Checking if volume labvol exists............................  PASS
 · Checking number of bricks in labvol.........................  PASS
 · Checking presence of serverc brick..........................  PASS
 · Checking presence of serverd brick..........................  PASS
 · Checking if labvol is started...............................  PASS

Overall lab grade..............................................  PASS
 

5.清除数据

对workstation,servera,serverb,serverc,serverd的数据进行清除,恢复环境初始状态。

[kiosk@foundation0 ~]$ rht-vmctl reset workstation
Are you sure you want to reset workstation? (y/n) y
Powering off workstation..
Resetting workstation.
Creating virtual machine disk overlay for rh236-workstation-vda.qcow2
Starting workstation.
[kiosk@foundation0 ~]$ rht-vmctl reset servera
Are you sure you want to reset servera? (y/n) y
Powering off servera..
Resetting servera.
Creating virtual machine disk overlay for rh236-servera-vda.qcow2
Creating virtual machine disk overlay for rh236-servera-vdb.qcow2
Starting servera.
[kiosk@foundation0 ~]$ rht-vmctl reset serverb
Are you sure you want to reset serverb? (y/n) y
Powering off serverb..
Resetting serverb.
Creating virtual machine disk overlay for rh236-serverb-vda.qcow2
Creating virtual machine disk overlay for rh236-serverb-vdb.qcow2
Starting serverb.
[kiosk@foundation0 ~]$ rht-vmctl reset serverc
Are you sure you want to reset serverc? (y/n) y
Powering off serverc..
Resetting serverc.
Creating virtual machine disk overlay for rh236-serverc-vda.qcow2
Creating virtual machine disk overlay for rh236-serverc-vdb.qcow2
Starting serverc.
[kiosk@foundation0 ~]$ rht-vmctl reset serverd
Are you sure you want to reset serverd? (y/n) y
Powering off serverd..
Resetting serverd.
Creating virtual machine disk overlay for rh236-serverd-vda.qcow2
Creating virtual machine disk overlay for rh236-serverd-vdb.qcow2
Starting serverd.
 

猜你喜欢

转载自blog.csdn.net/ligan1115/article/details/86574208