cgroup在ceph中的应用(4)

  1. 节点cpu和内存节点查看
    cgroup在ceph中的应用(4)_第1张图片

  2. 准备配置文件
    编辑/etc/cgconfig.conf
    注意mon和osd部分根据实际情况进行增加
    以下为配置文件
    mount {
    cpu = /sys/fs/cgroup/cpu;
    cpuacct = /sys/fs/cgroup/cpuacct;
    cpuset = /sys/fs/cgroup/cpu;
    devices = /sys/fs/cgroup/devices;
    memory = /sys/fs/cgroup/memory;
    freezer = /sys/fs/cgroup/freezer;
    }
    group mon {
    perm {

    task {
        uid = root;
        gid = root;
    }
    admin {
        uid = root;
        gid = root;
    }
    

    }
    cpu {

    cpuset.cpus = 0;
    cpuset.mems = 0;
    

    }
    memory {

    memory.limit_in_bytes = 2g;
    memory.memsw.limit_in_bytes = 3g;
    

    memory.soft_limit_in_bytes = 1g;
    memory.swappiness = 0;
    memory.oom_control = 1;

    memory.failcnt = 1;
    

    }
    }
    group osd0 {
    perm {

    task {
        uid = root;
        gid = root;
    }
    admin {
        uid = root;
        gid = root;
    }
    

    }
    cpu {

    cpuset.cpus = 1;   #绑定到指定的cpu 
    cpuset.mems = 0,1;
    

    }
    memory {

    memory.limit_in_bytes = 2g;  #物理内存限制为2G
    memory.memsw.limit_in_bytes = 3g;  #swap虚拟内存限制为3G
    

    memory.soft_limit_in_bytes = 1g; #当物理内存成果1G将触发内存回收
    memory.swappiness = 0; #优先使用物理内存
    memory.oom_control = 1; #当内存到达上限,不关闭进程,只将对应进程进入sleep状态

    memory.failcnt = 1;    #报告当内存到达memory.limit_in_bytes次数
    

    }
    }

  3. 修改服务配置文件
    osd服务配置
    修改/etc/init/ceph-osd.conf配置如下
    cgroup在ceph中的应用(4)_第2张图片

Mon服务配置
修改/etc/init/ceph-mon.conf配置如下
cgroup在ceph中的应用(4)_第3张图片

你可能感兴趣的:(ceph,OSD,mon,cgroup)