0.实验前的环境检查与配置
[student@workstation ~]$ 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查看文件系统。
[root@workstation ~]# 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
[root@workstation ~]# mkdir /mnt/finance
[root@workstation ~]# echo "servera:/finance /mnt/finance glusterfs _netdev,acl 0 0" >> /etc/fstab
[root@workstation ~]# tail -1 /etc/fstab
servera:/finance /mnt/finance glusterfs _netdev,acl 0 0
[root@workstation ~]# mount /mnt/finance
[root@workstation ~]# mount | grep finance
servera:/finance on /mnt/finance type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# 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确认权限。
[root@workstation ~]# mkdir /mnt/finance/profits
[root@workstation ~]# chgrp accountants /mnt/finance/profits
[root@workstation ~]# chmod 2770 /mnt/finance/profits
[root@workstation ~]# 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信息。
[root@workstation ~]# setfacl -R -m g:accountants:rwX /mnt/finance/profits
[root@workstation ~]# 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信息。
[root@workstation ~]# setfacl -R -m g:directors:rX /mnt/finance/profits
[root@workstation ~]# setfacl -R -m d:g:directors:rX /mnt/finance/profits
[root@workstation ~]# 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列出限制清单。
[root@workstation ~]# umount /mnt/finance
[root@servera ~]# gluster volume quota finance enable
volume quota : success
[root@servera ~]# gluster volume quota finance limit-usage /profits 1GB 85%
volume quota : success
[root@servera ~]# 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查看文件系统。
[root@servera ~]# gluster volume quota finance soft-timeout 30s
volume quota : success
[root@servera ~]# gluster volume quota finance hard-timeout 5s
volume quota : success
[root@workstation ~]# mount /mnt/finance
[root@workstation ~]# mount | grep finance
servera:/finance on /mnt/finance type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# df -Th | grep finance
servera:/finance fuse.glusterfs 4.0G 66M 4.0G 2% /mnt/finance
7.任务测评
lab aclsquotas grade进行测评。主要包括:挂载目录,挂载配置,挂载与取消挂载,配置ACL,配置quota等。
[student@workstation ~]$ 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