GaussDB T分布式分布式DN和CN实例内存调整
【摘要】 GaussDB T提供了gs_gucZenith工具来帮助完成在线状态下对CN和DN的内核参数设置。此处将分别演示对DN和CN实例进行内存压缩。查看实力当前状态[omm@Gauss1 ~]$ gs_om -t statusSet output to terminal.---------------------------------------------------------------...
GaussDB T提供了gs_gucZenith工具来帮助完成在线状态下对CN和DN的内核参数设置。此处将分别演示对DN和CN实例进行内存压缩。
查看实力当前状态
[omm@Gauss1 ~]$ gs_om -t status
Set output to terminal.
--------------------------------------------------------------------Cluster Status--------------------------------------------------------------------
az_state : single_az
cluster_state : Normal
balanced : true
----------------------------------------------------------------------AZ Status-----------------------------------------------------------------------
AZ:AZ1 ROLE:primary STATUS:ONLINE
---------------------------------------------------------------------Host Status----------------------------------------------------------------------
HOST:Gauss1 AZ:AZ1 STATUS:ONLINE IP:192.168.10.11
HOST:Gauss2 AZ:AZ1 STATUS:ONLINE IP:192.168.10.12
HOST:Gauss3 AZ:AZ1 STATUS:ONLINE IP:192.168.10.13
HOST:Gauss4 AZ:AZ1 STATUS:ONLINE IP:192.168.10.14
----------------------------------------------------------------Cluster Manager Status----------------------------------------------------------------
INSTANCE:CM1 ROLE:slave STATUS:ONLINE HOST:Gauss1 ID:601
INSTANCE:CM2 ROLE:slave STATUS:ONLINE HOST:Gauss2 ID:602
INSTANCE:CM3 ROLE:slave STATUS:ONLINE HOST:Gauss3 ID:603
INSTANCE:CM4 ROLE:primary STATUS:ONLINE HOST:Gauss4 ID:604
---------------------------------------------------------------------ETCD Status----------------------------------------------------------------------
INSTANCE:ETCD1 ROLE:follower STATUS:ONLINE HOST:Gauss1 ID:701 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD2 ROLE:leader STATUS:ONLINE HOST:Gauss2 ID:702 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD3 ROLE:follower STATUS:ONLINE HOST:Gauss3 ID:703 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
----------------------------------------------------------------------CN Status-----------------------------------------------------------------------
INSTANCE:cn_401 ROLE:no role STATUS:ONLINE HOST:Gauss1 ID:401 PORT:8000 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_402 ROLE:no role STATUS:ONLINE HOST:Gauss2 ID:402 PORT:8000 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_403 ROLE:no role STATUS:ONLINE HOST:Gauss3 ID:403 PORT:8000 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_404 ROLE:no role STATUS:ONLINE HOST:Gauss4 ID:404 PORT:8000 DataDir:/opt/gaussdb/data/cn
---------------------------------------------------------Instances Status in Group (group_1)----------------------------------------------------------
INSTANCE:DB1_1 ROLE:standby STATUS:ONLINE HOST:Gauss1 ID:1 PORT:40000 DataDir:/opt/gaussdb/data/dn1
INSTANCE:DB1_2 ROLE:primary STATUS:ONLINE HOST:Gauss2 ID:2 PORT:40021 DataDir:/opt/gaussdb/data/dn1
---------------------------------------------------------Instances Status in Group (group_2)----------------------------------------------------------
INSTANCE:DB2_3 ROLE:primary STATUS:ONLINE HOST:Gauss2 ID:3 PORT:40000 DataDir:/opt/gaussdb/data/dn2
INSTANCE:DB2_4 ROLE:standby STATUS:ONLINE HOST:Gauss3 ID:4 PORT:40021 DataDir:/opt/gaussdb/data/dn2
---------------------------------------------------------Instances Status in Group (group_3)----------------------------------------------------------
INSTANCE:DB3_5 ROLE:primary STATUS:ONLINE HOST:Gauss3 ID:5 PORT:40000 DataDir:/opt/gaussdb/data/dn3
INSTANCE:DB3_6 ROLE:standby STATUS:ONLINE HOST:Gauss4 ID:6 PORT:40021 DataDir:/opt/gaussdb/data/dn3
---------------------------------------------------------Instances Status in Group (group_4)----------------------------------------------------------
INSTANCE:DB4_8 ROLE:standby STATUS:ONLINE HOST:Gauss1 ID:8 PORT:40021 DataDir:/opt/gaussdb/data/dn4
INSTANCE:DB4_7 ROLE:primary STATUS:ONLINE HOST:Gauss4 ID:7 PORT:40000 DataDir:/opt/gaussdb/data/dn4
--------------------------------------------------Manage IP--------------------------------------------------
HOST:Gauss1 IP:192.168.10.11
HOST:Gauss2 IP:192.168.10.12
HOST:Gauss3 IP:192.168.10.13
HOST:Gauss4 IP:192.168.10.14
[omm@Gauss1 ~]$
1.DN实例内存调整
1>查看当前主机负载及DN实例内存配置
[omm@Gauss1 ~]$ gs_checkperf
The cpu and memory statistics information of every DN:
DB4_7 CPU uasge : 1.09
DB4_7 memory uasge : 76.0%
DB3_6 CPU uasge : 1.09
DB3_6 memory uasge : 76.0%
DB3_5 CPU uasge : 2.17
DB3_5 memory uasge : 76.0%
DB2_4 CPU uasge : 2.17
DB2_4 memory uasge : 76.0%
DB2_3 CPU uasge : 2.42
DB2_3 memory uasge : 76.0%
DB1_2 CPU uasge : 2.42
DB1_2 memory uasge : 76.0%
DB4_8 CPU uasge : 4.33
DB4_8 memory uasge : 56.0% --各DB实例内存使用均较高
DB1_1 CPU uasge : 4.33
DB1_1 memory uasge : 56.0%
[omm@Gauss1 ~]$ zsql omm/'kevinA1!'@192.168.10.14:40000
Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.
SQL> show parameter DATA_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
DATA_BUFFER_SIZE GS_TYPE_INTEGER 2G
SQL> show parameter SHARED_POOL_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
SHARED_POOL_SIZE GS_TYPE_INTEGER 1G
SQL> show parameter TEMP_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
TEMP_BUFFER_SIZE GS_TYPE_INTEGER 1G
SQL>
如上参数为重置建库模版创建,这也就是为什么为何安装时启库报错需要4.5G左右内存的原因,因为模版要求确实有点高。
2>执行调整
使用gs_gucZenith命令在线对各个DN实例核心内存进行调整:
[omm@Gauss1 ~]$ gs_gucZenith -c "DATA_BUFFER_SIZE=450M" -I DB4_8,DB4_7,DB3_6,DB3_5,DB2_4,DB2_3,DB1_2,DB1_1
[omm@Gauss1 ~]$ gs_gucZenith -c "SHARED_POOL_SIZE=150M" -I DB4_8,DB4_7,DB3_6,DB3_5,DB2_4,DB2_3,DB1_2,DB1_1
[omm@Gauss1 ~]$ gs_gucZenith -c "TEMP_BUFFER_SIZE=150M" -I DB4_8,DB4_7,DB3_6,DB3_5,DB2_4,DB2_3,DB1_2,DB1_1
命令执行过程示例:
[omm@Gauss1 ~]$ gs_gucZenith -c "DATA_BUFFER_SIZE=450M" -I DB4_8,DB4_7,DB3_6,DB3_5,DB2_4,DB2_3,DB1_2,DB1_1
B2_3,DB1_2,DB1_1Get cluster status.
Start getting healthy zenith instances...
Successfully got healthy zenith instances.
Start verifying the specifications of the kernel parameter value...
Successfully verified the specifications of the kernel parameter value.
Start setting kernel parameter.
------------------------------
Current value of DB1_1 is "2G"
Set kernel parameter successfully! Instance: DB1_1
------------------------------
Current value of DB1_2 is "2G"
Set kernel parameter successfully! Instance: DB1_2
------------------------------
Current value of DB2_3 is "2G"
Set kernel parameter successfully! Instance: DB2_3
------------------------------
Current value of DB2_4 is "2G"
Set kernel parameter successfully! Instance: DB2_4
------------------------------
Current value of DB3_5 is "2G"
Set kernel parameter successfully! Instance: DB3_5
------------------------------
Current value of DB3_6 is "2G"
Set kernel parameter successfully! Instance: DB3_6
------------------------------
Current value of DB4_8 is "450M"
Set kernel parameter successfully! Instance: DB4_8
------------------------------
Current value of DB4_7 is "450M"
Set kernel parameter successfully! Instance: DB4_7
------------------------------
Successfully set kernel parameter.
Please restart the cluster to make the new value take effect.
[omm@Gauss1 ~]$
调整完成后重启性能提升:
[omm@Gauss1 ~]$ gs_om -t stop
[omm@Gauss1 ~]$ gs_om -t stopetcd
[omm@Gauss1 ~]$ gs_om -t startetcd
[omm@Gauss1 ~]$ gs_om -t start
注:实际如果是修改单实例,只需重启单实例就好。
gs_om -t停止-h高斯1 -I DB1_1
gs_om -t start -h高斯1 -I DB1_1
3>验证查看
修改完成后重新查看:
[omm@Gauss1 ~]$ zsql omm/'kevinA1!'@192.168.10.14:40000
Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.
SQL> show parameter DATA_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
DATA_BUFFER_SIZE GS_TYPE_INTEGER 450M
SQL> show parameter TEMP_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
TEMP_BUFFER_SIZE GS_TYPE_INTEGER 150M
SQL> show parameter SHARED_POOL_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
SHARED_POOL_SIZE GS_TYPE_INTEGER 150M
SQL>
[omm@Gauss1 ~]$ gs_checkperf
The cpu and memory statistics information of every DN:
DB4_7 CPU uasge : 0.6
DB4_7 memory uasge : 18.0%
DB3_6 CPU uasge : 0.6
DB3_6 memory uasge : 18.0%
DB3_5 CPU uasge : 1.86
DB3_5 memory uasge : 18.0%
DB2_4 CPU uasge : 1.86
DB2_4 memory uasge : 18.0%
DB2_3 CPU uasge : 2.09
DB2_3 memory uasge : 18.0%
DB1_2 CPU uasge : 2.09
DB1_2 memory uasge : 18.0%
DB4_8 CPU uasge : 0.85
DB4_8 memory uasge : 13.0%
DB1_1 CPU uasge : 0.85
DB1_1 memory uasge : 13.0%
[omm@Gauss1 ~]$
如上:DN内存参数修改成功,主机内存使用率明显下降。
2. CN实例内存调整
1>查看CN实例主要内存配置
[omm@Gauss1 ~]$ zsql omm/'kevinA1!'@127.0.0.1:8000
Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.
SQL> show parameter SHARED_POOL_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
SHARED_POOL_SIZE GS_TYPE_INTEGER 1G
SQL> show parameter TEMP_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
TEMP_BUFFER_SIZE GS_TYPE_INTEGER 1G
SQL> show parameter DATA_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
DATA_BUFFER_SIZE GS_TYPE_INTEGER 2G
SQL>
2>执行内存调整
进行相同的调整
[omm@Gauss1 ~]$ gs_gucZenith -c "DATA_BUFFER_SIZE=450M" -I cn_401,cn_402,cn_403,cn_404
[omm@Gauss1 ~]$ gs_gucZenith -c "SHARED_POOL_SIZE=150M" -I cn_401,cn_402,cn_403,cn_404
[omm@Gauss1 ~]$ gs_gucZenith -c "TEMP_BUFFER_SIZE=150M" -I cn_401,cn_402,cn_403,cn_404
调整完成后重启性能提升:
[omm@Gauss1 ~]$ gs_om -t stop
[omm@Gauss1 ~]$ gs_om -t stopetcd
[omm@Gauss1 ~]$ gs_om -t startetcd
[omm@Gauss1 ~]$ gs_om -t start
3>验证
调整完成后查看
[omm@Gauss1 ~]$ zsql omm/'kevinA1!'@127.0.0.1:8000
Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.
SQL> set line 100
SQL> show parameter DATA_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
DATA_BUFFER_SIZE GS_TYPE_INTEGER 450M
SQL> show parameter TEMP_BUFFER_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
TEMP_BUFFER_SIZE GS_TYPE_INTEGER 150M
SQL> show parameter SHARED_POOL_SIZE
NAME DATATYPE VALUE
---------------------------------------------------------------- -------------------- --------------
SHARED_POOL_SIZE GS_TYPE_INTEGER 150M
SQL>
如上CN实例调整完成。
到这里,GaussDB T的DN,CN内存调整完成。生产环境,可在线先修改备库,重启备库后参数生效后,再将主库业务切换到备库。依次循环保证在不停业务的情况下实现在线调整。
本文转自“墨天轮”社区GaussDB频道
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)