操作系统

当前位置:永利皇宫463登录 > 操作系统 > 磁盘分配的定额quota

磁盘分配的定额quota

来源:http://www.makebuLuo.com 作者:永利皇宫463登录 时间:2019-09-12 14:29

2018-8-29 dynalist 配额

磁盘分配的定额quota,磁盘分配的定额

磁盘分配的定额

1 启用磁盘分配的定额

首先成立新的分区 /dev/sd5,并创设文件系统。

[[email protected] ~]# mkfs.ext4 /dev/sda5

是因为xfs 不磁盘分配的定额能成功,这里使用ext4.

然后把/dev/sda5分区挂载到 /home

[[email protected] ~]# mount /dev/sda5 /home

[[email protected] ~]# blkid /dev/sda5

/dev/sda5: UUID="8879cf63-99a5-43bb-9bfe-de303afb0799" TYPE="ext4"

修改 /etc/fstab 文件

[[email protected] ~]# vim /etc/fstab

UUID=dddd23d1-1012-4bac-9717-56b9b469e0c2 / ext4 defaults 1 1

UUID=316d8677-25b8-49af-b4eb-54daa20b6595 /boot ext4 defaults 1 2

UUID=dacd6ddd-d765-4646-b98c-0579f2732749 swap swap defaults 0 0

UUID=8879cf63-99a5-43bb-9bfe-de303afb0799 /home ext4 defaults,usrquota,grpquota 0 0

usrquota为启用磁盘的客户磁盘分配的定额作用,grpquota为启用磁盘的组磁盘分配的定额成效。

[[email protected] ~]# mount –a /home/

查阅挂载是还是不是中标

[[email protected] ~]# mount

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

[……]

/dev/sda5 on /home type ext4 (rw,relatime,seclabel,quota,usrquota,grpquota,data=ordered)

能够看出/dev/sda5一度不易挂载

2开立分配的定额数据库

[[email protected] ~]# quotacheck -cug /home

由于/etc/fstab 文件安装了usrquota,grpquota,所以那边不可不是 –cug,u对应usrquota,g对应grpquota。

今昔查阅/home目录,会多出多个文件,表明磁盘分配的定额数据库创立成功。

[[email protected] ~]# ll /home/

total 36

-rw-------. 1 root root 7168 Apr 25 11:03 aquota.group

-rw-------. 1 root root 7168 Apr 25 11:03 aquota.user

drwx------. 3 centos centos 4096 Apr 16 10:20 centos

drwx------. 2 root root 16384 Apr 25 10:55 lost+found

3 启用数据库

[[email protected] ~]# quotaon /home/

[[email protected] ~]#

下来查看一下,可以看来以及启用成功。

[[email protected] ~]# quotaon -p /home/

group quota on /home (/dev/sda5) is on

user quota on /home (/dev/sda5) is on

4 磁盘分配的定额设置

设置user1 磁盘分配的定额为100M,80M时发出警告

[[email protected] ~]# edquota user1

Disk quotas for user user1 (uid 1001):

Filesystem blocks soft hard inodes soft hard

/dev/sda5 52 80000 100000 13 0 0

那边的默许单位为block ,1个block为1K。soft为警告值,hard为最大值,

今后来认同一下配置是不是中标

[[email protected] ~]# quota user1    #查看用户user 的磁盘配额
Disk quotas for user user1 (uid 1001):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda5 52 80000 100000 13 0 0

5 测试

(1)创建测量检验的客户 user1

[[email protected] ~]# useradd uesr1

切换到user1用户

[[email protected] ~]# su - user1

Last login: Tue Apr 25 11:08:41 CST 2017 on pts/1

(2)创立文件测验

第一成立一个50M 的文本testquota。

[[email protected] ~]$ dd if=/dev/zero of=testquota bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.562963 s, 93.1 MB/s

能够看来一切不荒谬

    再来创立一个35M 的公文testquota2。

[[email protected] ~]$ dd if=/dev/zero of=testquota2 bs=1M count=35

sda5: warning, user block quota exceeded.
35+0 records in
35+0 records out
36700160 bytes (37 MB) copied, 0.348267 s, 105 MB/s

由于50M+35M=85M 大于80M

有着看到此次发生警告了,不过操作如故成功了

    下来再次创下制一个20M的文书testquota3。

[[email protected] ~]$ dd if=/dev/zero of=testquota3 bs=1M count=20

sda5: write failed, user block limit reached.
dd: error writing 'testquota3': Disk quota exceeded
13+0 records in
12+0 records out
13217792 bytes (13 MB) copied, 0.165029 s, 80.1 MB/s

由于已经超(Jing Chao)越最大值100M,所以创造失利了!

测量试验成功,实验停止!

磁盘分配的定额 1 启用磁盘分配的定额首先创设新的分区 /dev/sd5,并成立文件系统。 [[email protected] ~]# mkfs.ext4 /dev/sda5 由于xfs 不磁盘...

ZooKeeper能够在znode上设置分配的定额限制。假若过量了配置范围,ZooKeeper将会在log日志中打字与印刷WA凯雷德N日志。假若高出分配的定额限制,并不会终止行为操作。

提示有八个G的配额 就是行使的流量用光了.唯有1个G 

ZooKeeper的分配的定额是积攒在/zookeeper/quota路线下的。能够透过ZooKeeper client APIs可能ZooKeeper Java Shell来展开set,list,delete分配的定额。

下边举八个例子表达:

[zk: localhost:2181(CONNECTED) 3] setquota -n 2 /yandufeng_quota
Comment: the parts are option -n val 2 path /yandufeng_quota
[zk: localhost:2181(CONNECTED) 4] 
[zk: localhost:2181(CONNECTED) 4] 
[zk: localhost:2181(CONNECTED) 4] listquota /yandufeng_

yandufeng_quota   yandufeng_test
[zk: localhost:2181(CONNECTED) 4] listquota /yandufeng_quota
absolute path is /zookeeper/quota/yandufeng_quota/zookeeper_limits
Output quota for /yandufeng_quota count=2,bytes=-1
Output stat for /yandufeng_quota count=1,bytes=2
[zk: localhost:2181(CONNECTED) 5] 
[zk: localhost:2181(CONNECTED) 5] 
[zk: localhost:2181(CONNECTED) 5] 
[zk: localhost:2181(CONNECTED) 5] 
[zk: localhost:2181(CONNECTED) 5] 
[zk: localhost:2181(CONNECTED) 5] create /yandufeng_

yandufeng_quota   yandufeng_test
[zk: localhost:2181(CONNECTED) 5] create /yandufeng_quota/child1 ""
Created /yandufeng_quota/child1
[zk: localhost:2181(CONNECTED) 6] create /yandufeng_

yandufeng_quota   yandufeng_test
[zk: localhost:2181(CONNECTED) 6] create /yandufeng_quota/child2 ""
Created /yandufeng_quota/child2
[zk: localhost:2181(CONNECTED) 7] create /yandufeng_

yandufeng_quota   yandufeng_test
[zk: localhost:2181(CONNECTED) 7] create /yandufeng_quota/child

child2   child1
[zk: localhost:2181(CONNECTED) 7] create /yandufeng_quota/child3 ""
Created /yandufeng_quota/child3

当您创制/yandufeng_quota/child3时,会在ZooKeeper的log日志中打字与印刷

2017-02-08 10:38:43,738 - WARN  [CommitProcessor:10:DataTree@388] - Quota exceeded: /yandufeng_quota count=5 limit=2

 

你也足以举办

[zk: localhost:2181(CONNECTED) 18] delquota /yandufeng_quota

 来删除那些分配的定额

本文由永利皇宫463登录发布于操作系统,转载请注明出处:磁盘分配的定额quota

关键词:

上一篇:没有了

下一篇:没有了