cgroup在ceph中的應用(4)

  1. 節點cpu和內存節點查看 在此輸入圖片描述
  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次數
	}
}
  1. 修改服務配置文件 osd服務配置 修改/etc/init/ceph-osd.conf配置以下 在此輸入圖片描述

Mon服務配置 修改/etc/init/ceph-mon.conf配置以下 在此輸入圖片描述app

相關文章
相關標籤/搜索