天天看點

ClusterStorage-5-配置ACLs與Quotas實驗

0.實驗前的環境檢查與配置

[[email protected] ~]$ lab aclsquotas setup

1.配置挂載

yum -y install glusterfs-fuse安裝軟體包。mkdir /mnt/finance建立挂載目錄。echo "servera:/finance /mnt/finance glusterfs _netdev,acl 0 0" >> /etc/fstab将挂載資訊寫入配置檔案。tail -1 /etc/fstab确認配置檔案已寫入資訊。mount /mnt/finance進行挂載。mount | grep finance确認挂載成功。df -Th | grep finance檢視檔案系統。

[[email protected] ~]# yum -y install glusterfs-fuse

Loaded plugins: langpacks, search-disabled-repos

Package glusterfs-fuse-3.7.1-16.el7.x86_64 already installed and latest version

Nothing to do

[[email protected] ~]# mkdir /mnt/finance

[[email protected] ~]# echo "servera:/finance /mnt/finance glusterfs _netdev,acl 0 0" >> /etc/fstab

[[email protected] ~]# tail -1 /etc/fstab

servera:/finance /mnt/finance glusterfs _netdev,acl 0 0

[[email protected] ~]# mount /mnt/finance

[[email protected] ~]# mount | grep finance

servera:/finance on /mnt/finance type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)

[[email protected] ~]# df -Th | grep finance

servera:/finance fuse.glusterfs  4.0G   66M  4.0G   2% /mnt/finance

2.配置權限

mkdir /mnt/finance/profits建立子目錄。chgrp accountants /mnt/finance/profits修改屬組。chmod 2770 /mnt/finance/profits修改權限。 ll -d /mnt/finance/profits确認權限。

[[email protected] ~]# mkdir /mnt/finance/profits

[[email protected] ~]# chgrp accountants /mnt/finance/profits

[[email protected] ~]# chmod 2770 /mnt/finance/profits

[[email protected] ~]# ll -d /mnt/finance/profits

drwxrws---. 2 root accountants 12 Jan 27 13:10 /mnt/finance/profits

3.配置ACL

setfacl -R -m g:accountants:rwX /mnt/finance/profits遞歸設定檔案屬組。setfacl -R -m d:g:accountants:rwX /mnt/finance/profits遞歸設定目錄屬組。getfacl /mnt/finance/profits | grep accountants擷取acl資訊。

[[email protected] ~]# setfacl -R -m g:accountants:rwX /mnt/finance/profits

[[email protected] ~]# setfacl -R -m d:g:accountants:rwX /mnt/finance/profits

[root@workstation ~]# getfacl /mnt/finance/profits | grep accountants

getfacl: Removing leading '/' from absolute path names

# group: accountants

group:accountants:rwx

default:group:accountants:rwx

4.配置ACL

setfacl -R -m g:directors:rX /mnt/finance/profits遞歸設定檔案屬組。setfacl -R -m d:g:directors:rX /mnt/finance/profits遞歸設定目錄屬組。getfacl /mnt/finance/profits | grep directors擷取acl資訊。

[[email protected] ~]# setfacl -R -m g:directors:rX /mnt/finance/profits

[[email protected] ~]# setfacl -R -m d:g:directors:rX /mnt/finance/profits

[ro[email protected] ~]# getfacl /mnt/finance/profits | grep directors

getfacl: Removing leading '/' from absolute path names

group:directors:r-x

default:group:directors:r-x

5.配置quota

umount /mnt/finance取消挂載。gluster volume quota finance enable啟動quota功能。 gluster volume quota finance limit-usage /profits 1GB 85%設定限制值。gluster volume quota finance list列出限制清單。

[[email protected] ~]# umount /mnt/finance

[[email protected] ~]# gluster volume quota finance enable

volume quota : success

[[email protected] ~]# gluster volume quota finance limit-usage /profits 1GB 85%

volume quota : success

[[email protected] ~]# gluster volume quota finance list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?

-------------------------------------------------------------------------------------------------------------------------------

/profits                                   1.0GB     85%(870.4MB)   0Bytes   1.0GB              No                   No

6.配置quota

gluster volume quota finance soft-timeout 30s設定軟體逾時。gluster volume quota finance hard-timeout 5s設定硬體逾時。mount /mnt/finance進行挂載。mount | grep finance确認挂載。df -Th | grep finance檢視檔案系統。

[[email protected] ~]# gluster volume quota finance soft-timeout 30s

volume quota : success

[[email protected] ~]# gluster volume quota finance hard-timeout 5s

volume quota : success

[[email protected] ~]# mount /mnt/finance

[[email protected] ~]# mount | grep finance

servera:/finance on /mnt/finance type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)

[[email protected] ~]# df -Th | grep finance

servera:/finance fuse.glusterfs  4.0G   66M  4.0G   2% /mnt/finance

7.任務測評

lab aclsquotas grade進行測評。主要包括:挂載目錄,挂載配置,挂載與取消挂載,配置ACL,配置quota等。

[[email protected] ~]$ lab aclsquotas grade

Grading the student's work:

 · Testing if all hosts are reachable..........................  SUCCESS

 · Checking for current mount on /mnt/finance on workstation...  PASS

 · Checking if /mnt/finance on workstation is in use...........  PASS

 · Unmounting /mnt/finance.....................................  PASS

 · Mounting /mnt/finance.......................................  PASS

 · Checking for current mount on /mnt/finance on workstation...  PASS

 · Checking mount options for /mnt/finance in /etc/fstab.......  PASS

 · Checking if /mnt/finance/profits exists as a directory......  PASS

 · Checking owner on /mnt/finance/profits on workstation.......  PASS

 · Checking permissions on /mnt/finance/profits................  PASS

 · Checking ACLs on /mnt/finance/profits.......................  PASS

 · Testing if quotas are enabled for finance...................  PASS

 · Testing quota limits........................................  PASS

 · Checking soft timeouts......................................  PASS

 · Checking hard timeouts......................................  PASS

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

繼續閱讀