我试图在Centos 7中设置每个用户的资源限制,但是我找不到cgroups新实现的正确命令(我没有阅读文档,但是讨论了限制服务而不是用户)。
这是Centos 6中的步骤
添加到/etc/cgconfig.conf
group mygroup{ cpu { cpu.shares = 200; } memory { memory.limit_in_bytes = 128m; } }
重新启动service cgconfig restart
chkconfig cgconfig on lscgroup 将我们希望限制资源的进程添加到我们创build的cgroup中:add to /etc/cgrules.conf
myuser cpu,memory mygroup/
启动cgred服务,使cgrulesconfiguration更改生效: service cgred start
chkconfig cgred on : chkconfig cgred on Centos 7中的等价物是什么?
请尝试例如
systemctl set-property user-1000.slice CPUShares=100
假设您希望限制UID 1000的资源并限制CPUShares。
安装完成后:yum install libcgroup-tools命令lscgroup和cg *,文件/ etc / cg *可用。