利用cgroup限制instance磁盘io资源使用
1、安装libcgroup软件包;
[[email protected] ~]# yum install libcgroup Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. epel | 3.0 kB 00:00 epel/primary_db | 7.9 MB 00:00 rhel-HighAvailability | 3.9 kB 00:00 rhel-HighAvailability/primary_db | 43 kB 00:00 rhel-LoadBalancer | 3.9 kB 00:00 rhel-LoadBalancer/primary_db | 7.0 kB 00:00 rhel-ResilientStorage | 3.9 kB 00:00 rhel-ResilientStorage/primary_db | 47 kB 00:00 rhel-ScalableFileSystem | 3.9 kB 00:00 rhel-ScalableFileSystem/primary_db | 6.8 kB 00:00 rhel-Server | 3.9 kB 00:00 rhel-Server/primary_db | 3.1 MB 00:00 rhel-dvd | 3.9 kB 00:00 rhel-dvd/primary_db | 3.1 MB 00:00 Setting up Install Process Package libcgroup-0.40.rc1-5.el6.x86_64 already installed and latest version Nothing to do
2、开启服务;
[[email protected] ~]# service cgconfig restart Stopping cgconfig service: [ OK ] Starting cgconfig service: [ OK ] [[email protected] ~]# chkconfig cgconfig on [[email protected] ~]# service cgred restart Stopping CGroup Rules Engine Daemon... [ OK ] Starting CGroup Rules Engine Daemon: [ OK ] [[email protected] ~]# chkconfig cgred on
3、修改配置文件
[[email protected] ~]# cat /etc/cgconfig.conf # # Copyright IBM Corporation. 2007 # # Authors: Balbir Singh <[email protected]> # This program is free software; you can redistribute it and/or modify it # under the terms of version 2.1 of the GNU Lesser General Public License # as published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See man cgconfig.conf for further details. # # By default, mount all controllers to /cgroup/<controller> mount { cpuset = /cgroup/cpuset; cpu = /cgroup/cpu; cpuacct = /cgroup/cpuacct; memory = /cgroup/memory; devices = /cgroup/devices; freezer = /cgroup/freezer; net_cls = /cgroup/net_cls; blkio = /cgroup/blkio; } group bio-181 { blkio { blkio.throttle.write_iops_device=""; blkio.throttle.read_iops_device=""; blkio.throttle.write_bps_device="252:0 209715200"; blkio.throttle.read_bps_device="252:0 209715200"; blkio.reset_stats=""; blkio.weight="500"; blkio.weight_device=""; } } [[email protected] ~]# cat /etc/cgrules.conf # /etc/cgrules.conf #The format of this file is described in cgrules.conf(5) #manual page. # # Example: #<user> <controllers> <destination> #@student cpu,memory usergroup/student/ #peter cpu test1/ #% memory test2/ # End of file * blkio bio-181/
4、重启服务
[[email protected] ~]# /etc/init.d/cgconfig restart Stopping cgconfig service: [ OK ] Starting cgconfig service: [ OK ] [[email protected] ~]# /etc/init.d/cgred restart Stopping CGroup Rules Engine Daemon... [ OK ] Starting CGroup Rules Engine Daemon: [ OK ]
原文出处:51cto -> http://blog.51cto.com/coolsky/2155397?source=dra
本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如果侵犯你的利益,请发送邮箱到 [email protected],我们会很快的为您处理。