GreenPlum中性能调优之segment实例个数

GreenPlum集群安装完成后,到底设置多少个segment实例才合适呢?

请综合考虑以下几点:

1.数据量和查询负载:greenplum集群为shared-nothing架构,segment数量多,会提升系统的并发查询能力,如果数据量比较大,或者查询负载比较高,那么可以考虑增加segment实例的数量

2.硬件配置:Segment 实例数量应该与硬件资源相匹配。每个 Segment 实例通常需要 8GB 的内存和 2个 CPU 核心。因此,如果集群中有 8 个节点,每个节点有 64GB 内存和 16 个 CPU 核心,则可以将每个节点上的 Segment 实例数量设置为 8。

可以通过以下命令查询机器内存及cpu配置

查看内存:

[root@xxxxx ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:            31G        8.7G        738M        223M         21G         21G
Swap:           15G        171M         15G

查看cpu:

[root@xxxxxx ~]# lscpu | grep '^CPU.s'
CPU(s):                32

该机器为32G内存 32核cpu,所以每个segment节点上可以配置4个segment实例,提升系统性能。

查看集群中segment实例的状态可以使用以下sql:

--查看节点信息
select * from gp_segment_configuration order by content,hostname,port;

---gp_segment_configuration解释
select 
dbid as "节点标识(1-master,primary-mirror-standby master)",
content as "数据库节点标识(primary=mirror)",
case role
when 'p' then 'p-primary'
when 'm' then 'm-mirror' 
else '未知' end as "节点当前的角色",
case preferred_role
when 'p' then 'p-primary'
when 'm' then 'm-mirror' 
else '未知' end as "节点被定义的角色",
case mode
when 's' then 's-已同步'
when 'n' then 'n-不同步' 
else '未知' end as "主备同步状态",
case status
when 'u' then 'u-节点正常'
when 'd' then 'd-节点失败' 
else '未知' end as "节点状态",
port as "端口",
hostname,address,datadir
from gp_segment_configuration order by content,hostname,port;

猜你喜欢

转载自blog.csdn.net/wangning0714/article/details/130683770