kingbaseES V8R6集群运维案例之---max_connections参数修改

案例说明:
数据库max_connections指定了数据库的最大连接数,对于集群部署后默认值是100,生产环境可以根据需要调整,但是注意:

适用版本:
KingbaseES V8R6

1、查看主备库原始max_connections配置

[kingbase@node1 data]$ cat kingbase.conf |grep max_con
max_connections = 1000                  # (change requires restart)
[kingbase@node1 data]$ cat es_rep.conf |grep max_conn
max_connections='100'

[kingbase@node3 data]$ cat kingbase.conf |grep max_con
max_connections = 1000                  # (change requires restart)
[kingbase@node3 data]$ cat es_rep.conf |grep max_conn
max_connections='100'

2、修改主备库max_connections参数(小于原始max_connections参数值)

[kingbase@node3 data]$ cat kingbase.conf|grep -i max_conn
max_connections = 500                   # (change requires restart)
[kingbase@node3 data]$ cat es_rep.conf|grep -i max_conn
max_connections='100'


[kingbase@node1 data]$ cat kingbase.conf |grep max_conn
max_connections = 500                   # (change requires restart)
[kingbase@node1 data]$ cat es_rep.conf |grep max_conn
max_connections='100'

3、启动主备库数据库服务

=备库启动失败,故障信息“because max_connections = 500 is a lower setting than on the master server (its value was 1000)”=


启动主库:
[kingbase@node1 bin]$ ./sys_ctl start -D ../data
waiting for server to start....2021-03-01 18:19:20.719 CST [6681] LOG:  sepapower extension initialized
2021-03-01 18:19:20.720 CST [6681] LOG:  starting KingbaseES V008R006C003B0010 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
2021-03-01 18:19:20.720 CST [6681] LOG:  listening on IPv4 address "0.0.0.0", port 54321
2021-03-01 18:19:20.720 CST [6681] LOG:  listening on IPv6 address "::", port 54321
2021-03-01 18:19:20.862 CST [6681] LOG:  listening on Unix socket "/tmp/.s.KINGBASE.54321"
2021-03-01 18:19:21.034 CST [6681] LOG:  redirecting log output to logging collector process
2021-03-01 18:19:21.034 CST [6681] HINT:  Future log output will appear in directory "sys_log".
 done
server started

[kingbase@node1 bin]$ ./ksql -U system test
ksql (V8.0)
Type "help" for help.

test=# show max_connections ;
 max_connections 
-----------------
 500
(1 row)

启动备库:

[kingbase@node3 bin]$ ./sys_ctl start -D ../data
waiting for server to start....2021-03-01 18:19:36.475 CST [9569] LOG:  sepapower extension initialized
2021-03-01 18:19:36.476 CST [9569] LOG:  starting KingbaseES V008R006C003B0010 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
2021-03-01 18:19:36.477 CST [9569] LOG:  listening on IPv4 address "0.0.0.0", port 54321
2021-03-01 18:19:36.477 CST [9569] LOG:  listening on IPv6 address "::", port 54321
2021-03-01 18:19:36.489 CST [9569] LOG:  listening on Unix socket "/tmp/.s.KINGBASE.54321"
2021-03-01 18:19:36.515 CST [9569] LOG:  redirecting log output to logging collector process
2021-03-01 18:19:36.515 CST [9569] HINT:  Future log output will appear in directory "sys_log".
. stopped waiting
sys_ctl: could not start server
Examine the log output.

[kingbase@node3 sys_log]$ tail -100 kingbase-2021-03-01_181936.log
2021-03-01 18:19:36.518 CST [9571] LOG:  database system was interrupted while in recovery at log time 2021-03-01 18:13:49 CST
2021-03-01 18:19:36.518 CST [9571] HINT:  If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target.
2021-03-01 18:19:37.585 CST [9571] LOG:  entering standby mode
2021-03-01 18:19:37.631 CST [9571] FATAL:  hot standby is not possible because max_connections = 500 is a lower setting than on the master server (its value was 1000)
2021-03-01 18:19:37.633 CST [9569] LOG:  startup process (PID 9571) exited with exit code 1
2021-03-01 18:19:37.633 CST [9569] LOG:  aborting startup due to startup process failure
2021-03-01 18:19:37.640 CST [9569] LOG:  database system is shut down

4、修改备库max_connections参数配置并启动数据库

[kingbase@node3 data]$ cat kingbase.conf|grep -i max_conn
max_connections = 1000                  # (change requires restart)
You have mail in /var/spool/mail/kingbase
[kingbase@node3 data]$ cat es_rep.conf|grep -i max_conn
max_connections='100'

[kingbase@node3 bin]$ ./sys_ctl start -D ../data
waiting for server to start....2021-03-01 18:20:42.606 CST [9667] LOG:  sepapower extension initialized
2021-03-01 18:20:42.607 CST [9667] LOG:  starting KingbaseES V008R006C003B0010 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
2021-03-01 18:20:42.607 CST [9667] LOG:  listening on IPv4 address "0.0.0.0", port 54321
2021-03-01 18:20:42.607 CST [9667] LOG:  listening on IPv6 address "::", port 54321
2021-03-01 18:20:42.636 CST [9667] LOG:  listening on Unix socket "/tmp/.s.KINGBASE.54321"
2021-03-01 18:20:42.679 CST [9667] LOG:  redirecting log output to logging collector process
2021-03-01 18:20:42.679 CST [9667] HINT:  Future log output will appear in directory "sys_log".
 done
server started

[kingbase@node3 bin]$ ps -ef |grep kingbase

kingbase  9667     1  0 18:20 ?        00:00:00 /home/kingbase/cluster/R6HA/KHA/kingbase/bin/kingbase -D ../data
kingbase  9668  9667  0 18:20 ?        00:00:00 kingbase: logger   
kingbase  9669  9667  3 18:20 ?        00:00:00 kingbase: startup   recovering 0000000E00000004000000AB
kingbase  9670  9667  0 18:20 ?        00:00:00 kingbase: checkpointer   
kingbase  9671  9667  0 18:20 ?        00:00:00 kingbase: background writer   
kingbase  9672  9667  0 18:20 ?        00:00:00 kingbase: stats collector   
kingbase  9673  9667  0 18:20 ?        00:00:00 kingbase: walreceiver   streaming 4/AB000110

5、重启集群测试

[kingbase@node3 bin]$ ./sys_monitor.sh restart
2021-03-01 18:23:06 Ready to stop all DB ...
.......
2021-03-01 18:23:47 repmgrd on "[192.168.7.243]" start success.
 ID | Name    | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
----+---------+---------+-----------+----------+---------+-------+---------+--------------------
 1  | node248 | primary | * running |          | running | 9290  | no      | n/a                
 3  | node243 | standby |   running | node248  | running | 11332 | no      | 0 second(s) ago    
2021-03-01 18:23:54 Done.

---如上所示,集群启动正常。

posted @ 2023-09-07 15:14  天涯客1224  阅读(19)  评论(0编辑  收藏  举报