1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
4、构建主从DNS域名解析环境
5、主从DNS都可将www.study.com域名解析为192.168.200.113
6、客户机可通过浏览器访问www.study.com得到WEB服务器相应内容
7、主域名服务器要同时担任缓存域名服务器功能
8、客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析结果
创建三个内存相等的分区
为sdb1,sdb2,sdb3
将这三个分区组成RAID5
[root@ns1 ~]# mdadm -C /dev/md5 -l 5 -n 3 /dev/sdb1 /dev/sdb2 /dev/sdb3 //创建RAID5 ,3块活动硬盘
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@ns1 ~]# fdisk -l /dev/md5 //查看
磁盘 /dev/md5:21.5 GB, 21458059264 字节,41910272 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):524288 字节 / 1048576 字节
构建md5为物理卷
[root@ns1 ~]# pvcreate /dev/md5
Physical volume "/dev/md5" successfully created
[root@ns1 ~]# pvdisplay /dev/md5
"/dev/md5" is a new physical volume of "19.98 GiB"
--- NEW Physical volume ---
PV Name /dev/md5
VG Name
PV Size 19.98 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID IdVTjI-oDcr-FmXN-ECI2-myNJ-ssXe-J4b49e
卷组
[root@ns1 ~]# vgcreate myvg /dev/md5
Volume group "myvg" successfully created
[root@ns1 ~]# vgdisplay myvg
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 19.98 GiB
PE Size 4.00 MiB
Total PE 5115
Alloc PE / Size 0 / 0
Free PE / Size 5115 / 19.98 GiB
VG UUID 4x4UqB-FbLZ-rWjQ-zJDg-hHZp-b8Gw-PpihfO
逻辑卷
[root@ns1 ~]# lvcreate -L 10G -n mylv myvg
Logical volume "mylv" created.
[root@ns1 ~]# lvdisplay /dev/myvg/mylv
--- Logical volume ---
LV Path /dev/myvg/mylv
LV Name mylv
VG Name myvg
LV UUID hUJ15W-JCqC-orEC-8hZy-V9zH-vift-eKeW03
LV Write Access read/write
LV Creation host, time ns1.yuan.com, 2019-08-19 09:09:09 +0800
LV Status available
# open 0
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
格式化逻辑卷
[root@ns1 ~]# mkfs.xfs /dev/myvg/mylv
log stripe unit (524288 bytes) is too large (maximum is 256KiB)
log stripe unit adjusted to 32KiB
meta-data=/dev/myvg/mylv isize=256 agcount=16, agsize=163712 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=2619392, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
DNS解析综合学习案例
1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
[root@ns1 ~]# mount /dev/myvg/mylv /usr/local/apache/htdocs/
[root@ns1 ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 38G 9.2G 29G 25% /
devtmpfs devtmpfs 985M 0 985M 0% /dev
tmpfs tmpfs 994M 80K 994M 1% /dev/shm
tmpfs tmpfs 994M 8.9M 985M 1% /run
tmpfs tmpfs 994M 0 994M 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 107M 391M 22% /boot
/dev/mapper/myvg-mylv xfs 10G 33M 10G 1% /usr/local/apache/htdocs
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、
文件数量软限制为80个;硬限制为100个。
[root@ns1 ~]# useradd zhangsan
[root@ns1 ~]# vi /etc/fstab //手动添加
/dev/mapper/centos-root / xfs defaults 0 0
UUID=a220eccb-2c0f-485d-bca4-f3659f3326e8 /boot xfs defaults 0
0
/dev/mapper/centos-swap swap swap defaults 0 0
/dev/mapper/myvg-mylv /usr/local/apache/htdocs xfs defaults,usrquota 0 0
[root@ns1 ~]# umount /usr/local/apache/htdocs
[root@ns1 ~]# mount -a //挂载fstab文件内的磁盘
[root@ns1 ~]# mount |grep /usr/local/apache/htdocs //挂载并查看类型
/dev/mapper/myvg-mylv on /usr/local/apache/htdocs type xfs (rw,relatime,seclabel,attr2,inode64,sunit=1024,swidth=2048,usrquota)
[root@ns1 ~]# quotacheck -avug
[root@ns1 ~]# quotaon -avug
[root@ns1 ~]# setquota -u zhangsan 80000 100000 80 100 /usr/local/apache/htdocs //设置zhangsan用户的磁盘配额
[root@ns1 ~]# quota -uvs zhangsan
Disk quotas for user zhangsan (uid 8905):
Filesystem space quota limit grace files quota limit grace
/dev/mapper/myvg-mylv
0K 80000K 100000K 0 80 100
4、构建主从DNS域名解析环境
5、主从DNS都可将www.study.com域名解析为192.168.200.113
6、主域名服务器要同时担任缓存域名服务器功能
[root@ns1 ~]# yum -y install bind //yum安装bind软件包
[root@ns1 ~]# vim /etc/named.conf //修改配置主配置文件
options {
listen-on port 53 { 192.168.50.112; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
};
zone "." IN {
type hint;
file "named.ca";
};
zone "study.com" IN {
type master;
file "yxh.zheng";
allow-transfer { 192.168.50.111; };
};
zone "50.168.192.in-addr.arpa" IN {
type master;
file "yxh.fan"
allow-transfer { 192.168.50.111; };
};
[root@ns1 ~]# vim /var/named/yxh.zheng //配置区域配置文件
$TTL 1D
@ IN SOA study.com. admin.study.com. (
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
ns1 IN A 192.168.50.112
ns2 IN A 192.168.50.111
www IN A 192.168.50.112
[root@ns1 ~]# vim /var/named/yxh.fan //配置反向解析配置文件
$TTL 1D
@ IN SOA study.com. admin.yuan.com. (
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.yuan.com.
112 IN PTR www.study.com.
112 IN PTR ns1.study.com.
111 IN PTR ns2.study.com.
从服务器:
[root@na2 ~]# vim /etc/named.conf //配置从服务器的主配置文件
options {
directory "/var/named";
};
zone "study.com" IN {
type slave;
file "slaves/yxh.zheng";
masters { 192.168.50.112; };
};
zone "50.168.192.in-addr.arpa" IN {
type slave;
file "slaves/yxh.fan";
masters { 192.168.50.112; };
};
7、客户机可通过浏览器访问www.study.com得到WEB服务器相应内容 //通过客户机测试
8、N客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析结果 //客户机测试查看