QianBase MPP配置资源组报错cgroup is not properly configured

问题

在QianBase MPP中希望从默认的资源队列模式修改为资源组模式,通过以下命令设置为资源组模式,
qbmconfig -c qb_resource_manager -v “group”
但是却遇到以下报错

[qianbase@n208 mpp7]$ qbmconfig -c qb_resource_manager -v "group"
20230829:13:27:11:031179 qbmconfig:n208:qianbase-[CRITICAL]:-new GUC value failed validation: [n209:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist],[n208:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist],[n210:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist]
new GUC value failed validation: [n209:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist],[n208:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist],[n210:cgroup is not properly configured: directory '/sys/fs/cgroup/cpu/qbdb/' does not exist]

分析

根据报错信息判断,可能是因为cgroup未正常配置。根据报错提示查看/sys/fs/cgroup/cpu/qbdb/发现此目录并不存在,因此说明cgroup并未配置。

解决

参考文章Greenplum【集群搭建 02】cgroup工具安装+用户资源组配置+集群资源组配置+数据库资源组配置+资源组相关信息(一篇学会资源组配置) 进行相应的配置,步骤如下:

  1. 安装cgroup
yum install -y libcgroup-tools
rpm -qa | grep cgroup
  1. 配置QianBase数据库资源组文件
vim /etc/cgconfig.conf
增加以下内容段:

group gpdb {
     perm {
         task {
             uid = qbadmin;
             gid = qbadmin;
         }
         admin {
             uid = qbadmin;
             gid = qbadmin;
         }
     }
     cpu {
     }
     cpuacct {
     }
     cpuset {
     }
     memory {
     }
} 
  1. 使配置生效
cgconfigparser -l /etc/cgconfig.conf

注:初次在执行这条命令时遇到以下报错信息,最后发现原因是因为qbadmin用户名写错导致。

[root@n210 ~]# cgconfigparser -l /etc/cgconfig.d/gpdb.conf 
parsing failed at line number 4
Error: failed to parse file /etc/cgconfig.d/gpdb.conf
cgconfigparser; error loading /etc/cgconfig.d/gpdb.conf: Have multiple paths for the same namespace
  1. 启动cggroup服务并加入开机自启
systemctl start cgconfig
systemctl enable cgconfig
  1. 验证配置是否成功
[root@n208 qianbase]# grep cgroup /proc/mounts 
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
[root@n208 qianbase]# 
[root@n208 qianbase]# 
[root@n208 qianbase]# ll /sys/fs/cgroup/cpu/gpdb/
total 0
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cgroup.clone_children
--w--w---- 1 qbadmin qbadmin 0 Aug 29 15:21 cgroup.event_control
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cgroup.procs
-r--r--r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpuacct.stat
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpuacct.usage
-r--r--r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpuacct.usage_percpu
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.cfs_period_us
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.cfs_quota_us
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.rt_period_us
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.rt_runtime_us
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.shares
-r--r--r-- 1 qbadmin qbadmin 0 Aug 29 15:21 cpu.stat
-rw-rw-r-- 1 qbadmin qbadmin 0 Aug 29 15:21 notify_on_release
-rw-rw-r-T 1 qbadmin qbadmin 0 Aug 29 15:21 tasks

通过以上输出已经能够找到/sys/fs/cgroup/cpu/gpdb/目录,说明配置成功。
后续就可以继续尝试配置资源组并使用资源组功能了,我们在后续的文章中继续介绍。

注:本文相关知识点可访问官方网站 https://docs.vmware.com/en/VMware-Greenplum/6/greenplum-database/admin_guide-workload_mgmt_resgroups.html#configuring-and-using-resource-groups 进行学习!

你可能感兴趣的:(QianBaseMPP,Greenplum,数据库,postgresql,QianBase)