IT--cgroup--cgroup使用

1安装
yum install libcgroup

/etc/init.d/cgconfig restart
2 默认配置,不用更改
cat /etc/cgconfig.conf

#
#  Copyright IBM Corporation. 2007
#
#  Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
#  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;
}

3 使用

限制磁盘IO

建立文件夹
mkdir -p /cgroup/blkio/testlsh

会自动出现很多文件
然后往文件里面追加东西
追加的东西有
1设备号
ls /dev/sda

2进程pid
ps -ef|grep …

echo '8:0   10485760' > /cgroup/blkio/testlsh/blkio.throttle.read_bps_device

echo 30863 > /cgroup/blkio/testlsh/tasks

用iotop看一下,还是没有起作用,原因是
我这里用的是lvm,需要将设备号换成lvm的

查找对应分区的

]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-lv1 493G 172G 296G 37% /
tmpfs 63G 320K 63G 1% /dev/shm
/dev/sda1 976M 41M 885M 5% /boot
/dev/mapper/vg-lv_data
49T 23T 24T 50% /opt/lv_data

找出vg-lv_data的 设备号
[root@jxq-10-0-0-94 ~]# ls -l /dev/mapper/vg-lv_data
lrwxrwxrwx. 1 root root 7 Mar 15 2016 /dev/mapper/vg-lv_data -> ../dm-2
[root@jxq-10-0-0-94 ~]# ls -l /dev/dm-2
brw-rw—-. 1 root disk 253, 2 Mar 15 2016 /dev/dm-2
[root@jxq-10-0-0-94 ~]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值