问题描述
远程连接数据库时报错如上图所示。
原因: 使用的license.dat 文件是开发测试版,限制最大连接数为10,管理员用户的最大连接数为3,导致启动失败。
4台设备同时用root账户连接时,出现此问题。
解决方案
第1步:停止服务
[kingbase@xxx kdb]$ ./Server/bin/sys_ctl -D data2/ -l logfile stop
第2步:修改kingbase.conf
[kingbase@xxx kdb]$ vim data2/kingbase.conf
修改管理员预留连接数为8,默认为3。
...
max_connections = 10 # (change requires restart)
superuser_reserved_connections = 8 # (change requires restart)
...
第3步:启动服务
[kingbase@xxx kdb]$ ./Server/bin/sys_ctl -D data2/ -l logfile start
第4步:核对配置
test_db=# show max_connections;
max_connections
-----------------
10
(1 row)
test_db=# show superuser_reserved_connections;
superuser_reserved_connections
--------------------------------
8
(1 row)
test_db=# select sourcefile,name,setting,applied from sys_file_settings;
WARNING: max_connections should be less than or equal than 10 (restricted by license)
HINT: the value of max_connect is set 10
sourcefile | name |setting
/home/kingbase/kdb/data2/kingbase.conf | max_connections | 10
/home/kingbase/kdb/data2/kingbase.conf | superuser_reserved_connections | 8
配置正确,重启后远程连接成功。