## config of create a standby/witness node. ## when the cluster is in quorum or sync mode and expand sync standby node, ## it may automatically adjust synchronous_node and synchronous_standby_count parameters. [expand] expand_type="0"# The node type of standby/witness node, which would be add to cluster. 0:standby 1:witness primary_ip="192.168.6.87"# The ip addr of cluster primary node, which need to expand a standby/witness node. expand_ip="192.168.6.98"# The ip addr of standby/witness node, which would be add to cluster. node_id="3"# The node_id of standby/witness node, which would be add to cluster. It does not the same with any one in cluster node # for example: node_id="3" sync_type=""# the sync_type parameter is used to specify the sync type for expand node. 0:sync 1:potential 2:async # this parameter is only valid when expand_type="0" and the synchronous parameter of the cluster is set to custom mode.
## Specific instructions ,see it under [install] install_dir="/KingbaseES/V9/cluster"# the last layer of directory could not add '/' zip_package="/install/db.zip" net_device=(ens33) # if virtual_ip set,it must be set net_device_ip=(192.168.6.98) # if virtual_ip set,it must be set license_file=() deploy_by_sshd="1" ssh_port="22" scmd_port="8890"
[root@kesv9 ~]# cd /install/ [root@kesv9 install]# sh trust_cluster.sh [INFO] set password-free between root and kingbase Generating public/private rsa key pair. ... ... ...
## 过程中根据提示输入密码即可 root@192.168.6.87's password: id_rsa 100% 2590 1.3MB/s 00:00 id_rsa.pub 100% 564 486.4KB/s 00:00 authorized_keys 100% 564 590.3KB/s 00:00 known_hosts ... ... ... connect to "192.168.6.87" from current node by 'ssh' kingbase:0..... OK connect to "192.168.6.87" from current node by 'ssh' root:0..... OK connect to "192.168.6.88" from "192.168.6.87" by 'ssh' kingbase->kingbase:0 .... OK connect to "192.168.6.88" from "192.168.6.87" by 'ssh' root->root:0 root->kingbase:0 kingbase->root:0.... OK connect to "192.168.6.88" from current node by 'ssh' kingbase:0..... OK connect to "192.168.6.88" from current node by 'ssh' root:0..... OK connect to "192.168.6.98" from "192.168.6.88" by 'ssh' kingbase->kingbase:0 .... OK connect to "192.168.6.98" from "192.168.6.88" by 'ssh' root->root:0 root->kingbase:0 kingbase->root:0.... OK connect to "192.168.6.98" from current node by 'ssh' kingbase:0..... OK connect to "192.168.6.98" from current node by 'ssh' root:0..... OK connect to "192.168.6.87" from "192.168.6.98" by 'ssh' kingbase->kingbase:0 .... OK connect to "192.168.6.87" from "192.168.6.98" by 'ssh' root->root:0 root->kingbase:0 kingbase->root:0.... OK check ssh connection success!
[kingbase@kesv9:/install]$ sh cluster_install.sh expand [CONFIG_CHECK] will deploy the cluster of [RUNNING] success connect to the target "192.168.6.98" ..... OK [RUNNING] success connect to "192.168.6.98" from current node by 'ssh' ..... OK [RUNNING] success connect to the target "192.168.6.87" ..... OK [RUNNING] success connect to "192.168.6.87" from current node by 'ssh' ..... OK [RUNNING] Primary node ip is 192.168.6.87 ... [RUNNING] Primary node ip is 192.168.6.87 ... OK [CONFIG_CHECK] set install_with_root=1 [RUNNING] success connect to the target "192.168.6.98" ..... OK [RUNNING] success connect to "192.168.6.98" from current node by 'ssh' ..... OK [RUNNING] success connect to the target "192.168.6.87" ..... OK [RUNNING] success connect to "192.168.6.87" from current node by 'ssh' ..... OK [INSTALL] load config from cluster..... [INFO] db_user=system [INFO] db_port=54321 [INFO] use_scmd=1 [INFO] data_directory=/data [INFO] scmd_port=8890 [INFO] recovery=standby [INFO] use_check_disk=off [INFO] trusted_servers=192.168.6.254 [INFO] reconnect_attempts=10 [INFO] reconnect_interval=6 [INFO] auto_cluster_recovery_level=1 [INFO] synchronous=quorum [INSTALL] load config from cluster.....OK [CONFIG_CHECK] file format is correct ... OK [CONFIG_CHECK] check database connection ... [CONFIG_CHECK] check database connection ... OK [CONFIG_CHECK] expand_ip[192.168.6.98] is not used in the cluster ... [CONFIG_CHECK] expand_ip[192.168.6.98] is not used in the cluster ...ok [CONFIG_CHECK] The localhost is expand_ip:[192.168.6.98] ... [CONFIG_CHECK] The localhost is expand_ip:[192.168.6.98] ...ok [CONFIG_CHECK] check node_id is in cluster ... [CONFIG_CHECK] check node_id is in cluster ...OK [RUNNING] check the db is running or not... [RUNNING] the db is not running on "192.168.6.98:54321" ..... OK [RUNNING] the install dir is not exist on "192.168.6.98" ..... OK [RUNNING] check the sys_securecmdd is running or not... [RUNNING] the sys_securecmdd is not running on "192.168.6.98:8890" ..... OK [INFO] use_ssl=0 2025-02-26 17:27:36 [INFO] start to check system parameters on 192.168.6.98 ... 2025-02-26 17:27:36 [WARNING] [GSSAPIAuthentication] yes (should be: no) on 192.168.6.98 2025-02-26 17:27:36 [INFO] [UseDNS] is null on 192.168.6.98 2025-02-26 17:27:37 [INFO] [UsePAM] yes on 192.168.6.98 2025-02-26 17:27:37 [INFO] [ulimit.open files] 65536 on 192.168.6.98 2025-02-26 17:27:37 [INFO] [ulimit.open proc] 65536 on 192.168.6.98 2025-02-26 17:27:38 [INFO] [ulimit.core size] unlimited on 192.168.6.98 2025-02-26 17:27:38 [INFO] [ulimit.mem lock] 64 (less than 50000000) on 192.168.6.98 2025-02-26 17:27:38 [INFO] the value of [ulimit.mem lock] is wrong, now will change it on 192.168.6.98 ... 2025-02-26 17:27:38 [INFO] change ulimit.mem lock on 192.168.6.98 ... 2025-02-26 17:27:39 [INFO] change ulimit.mem lock on 192.168.6.98 ... Done 2025-02-26 17:27:39 [INFO] [ulimit.mem lock] 50000000 on 192.168.6.98 2025-02-26 17:27:40 [ERROR] [kernel.sem] 250 32000 100 128 (no less than: 5010 641280 5010 256) on 192.168.6.98 2025-02-26 17:27:40 [INFO] the value of [kernel.sem] is wrong, now will change it on 192.168.6.98 ... 2025-02-26 17:27:40 [INFO] change kernel.sem on 192.168.6.98 ... 2025-02-26 17:27:41 [INFO] change kernel.sem on 192.168.6.98 ... Done 2025-02-26 17:27:42 [INFO] [kernel.sem] 5010 641280 5010 256 on 192.168.6.98 2025-02-26 17:27:43 [INFO] [RemoveIPC] no on 192.168.6.98 2025-02-26 17:27:43 [INFO] [DefaultTasksAccounting] is null on 192.168.6.98 2025-02-26 17:27:43 [INFO] write file "/etc/udev/rules.d/kingbase.rules" on 192.168.6.98 2025-02-26 17:27:45 [INFO] [crontab] chmod /usr/bin/crontab ... 2025-02-26 17:27:45 [INFO] [crontab] chmod /usr/bin/crontab ... Done 2025-02-26 17:27:45 [INFO] [crontab access] OK 2025-02-26 17:27:46 [INFO] [cron.allow] add kingbase to cron.allow ... 2025-02-26 17:27:46 [INFO] [cron.allow] add kingbase to cron.allow ... Done 2025-02-26 17:27:47 [INFO] [crontab auth] crontab is accessible by kingbase now on 192.168.6.98 2025-02-26 17:27:47 [INFO] [SELINUX] disabled on 192.168.6.98 2025-02-26 17:27:48 [INFO] [firewall] down on 192.168.6.98 2025-02-26 17:27:48 [INFO] [The memory] OK on 192.168.6.98 2025-02-26 17:27:49 [INFO] [The hard disk] OK on 192.168.6.98 2025-02-26 17:27:49 [INFO] [ping] chmod /bin/ping ... 2025-02-26 17:27:49 [INFO] [ping] chmod /bin/ping ... Done 2025-02-26 17:27:50 [INFO] [ping access] OK 2025-02-26 17:27:50 [INFO] [/bin/cp --version] on 192.168.6.98 OK 2025-02-26 17:27:50 [INFO] [Virtual IP] Not configured on 192.168.6.98 [INSTALL] create the install dir"/KingbaseES/V9/cluster/kingbase" on 192.168.6.98 ... [INSTALL] success to create the install dir"/KingbaseES/V9/cluster/kingbase" on "192.168.6.98" ..... OK [INSTALL] try to copy the zip package "/install/db.zip" to /KingbaseES/V9/cluster/kingbase of "192.168.6.98" ..... [INSTALL] success to scp the zip package "/install/db.zip" /KingbaseES/V9/cluster/kingbase of to "192.168.6.98" ..... OK [INSTALL] decompress the "/KingbaseES/V9/cluster/kingbase" to "/KingbaseES/V9/cluster/kingbase" on 192.168.6.98 [INSTALL] success to decompress the "/KingbaseES/V9/cluster/kingbase/db.zip" to "/KingbaseES/V9/cluster/kingbase" on "192.168.6.98"..... OK [INSTALL] check license_file "default" [INSTALL] success to access license_file on 192.168.6.98: /KingbaseES/V9/cluster/kingbase/bin/license.dat [RUNNING] config sys_securecmdd and start it ... [RUNNING] config the sys_securecmdd port to 8890 ... [RUNNING] success to config the sys_securecmdd port on 192.168.6.98 ... OK successfully initialized the sys_securecmdd, please use "/KingbaseES/V9/cluster/kingbase/bin/sys_HAscmdd.sh start" to start the sys_securecmdd [RUNNING] success to config sys_securecmdd on 192.168.6.98 ... OK Created symlink /etc/systemd/system/multi-user.target.wants/securecmdd.service → /etc/systemd/system/securecmdd.service. [RUNNING] success to start sys_securecmdd on 192.168.6.98 ... OK [INSTALL] success to access file: /KingbaseES/V9/cluster/kingbase/etc/all_nodes_tools.conf [INSTALL] success to scp the /KingbaseES/V9/cluster/kingbase/etc/repmgr.conf from 192.168.6.87 to "192.168.6.98"..... ok [INSTALL] success to scp the ~/.encpwd from 192.168.6.87 to "192.168.6.98"..... ok [INSTALL] success to scp /KingbaseES/V9/cluster/kingbase/etc/all_nodes_tools.conf from "192.168.6.87" to "192.168.6.98" ...ok [INSTALL] success to chmod 600 the ~/.encpwd on 192.168.6.98..... ok [INFO] parameter_name=node_id [INFO] parameter_values='3' [INFO] [parameter_name] para_exist=1 [INFO] sed -i "/[#]*node_id[ ]*=/cnode_id='3'" /KingbaseES/V9/cluster/kingbase/etc/repmgr.conf [INFO] parameter_name=node_name [INFO] parameter_values='node3' [INFO] [parameter_name] para_exist=1 [INFO] sed -i "/[#]*node_name[ ]*=/cnode_name='node3'" /KingbaseES/V9/cluster/kingbase/etc/repmgr.conf [INFO] parameter_name=conninfo [INFO] parameter_values='host [INFO] [parameter_name] para_exist=1 [INFO] sed -i "/[#]*conninfo[ ]*=/cconninfo='host=192.168.6.98 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000'" /KingbaseES/V9/cluster/kingbase/etc/repmgr.conf [INFO] parameter_name=ping_path [INFO] parameter_values='/bin' [INFO] [parameter_name] para_exist=1 [INFO] sed -i "/[#]*ping_path[ ]*=/cping_path='/bin'" /KingbaseES/V9/cluster/kingbase/etc/repmgr.conf [RUNNING] standby clone ... [WARNING] following problems with command line parameters detected: -D/--sysdata will be ignored if a repmgr configuration file is provided [NOTICE] destination directory "/data" provided [INFO] connecting to source node [DETAIL] connection string is: host=192.168.6.87 user=esrep port=54321 dbname=esrep [DETAIL] current installation size is 102 MB [NOTICE] checking for available walsenders on the source node (2 required) [NOTICE] checking replication connections can be made to the source server (2 required) [INFO] checking and correcting permissions on existing directory "/data" [INFO] creating replication slot as user "esrep" [NOTICE] starting backup (using sys_basebackup)... [INFO] executing: /KingbaseES/V9/cluster/kingbase/bin/sys_basebackup -l "repmgr base backup" -D /data -h 192.168.6.87 -p 54321 -U esrep -c fast -X stream -S repmgr_slot_3 [NOTICE] standby clone (using sys_basebackup) complete [NOTICE] you can now start your Kingbase server [HINT] for example: sys_ctl -D /data start [HINT] after starting the server, you need to register this standby with "repmgr standby register" [RUNNING] standby clone ...OK [RUNNING] db start ... waiting for server to start.... done server started [RUNNING] db start ...OK [INFO] connecting to local node "node3" (ID: 3) [INFO] connecting to primary database [WARNING] --upstream-node-id not supplied, assuming upstream node is primary (node ID: 1) [INFO] standby registration complete [NOTICE] standby node "node3" (ID: 3) successfully registered 2025-02-26 17:28:24 begin to start DB on "[localhost]". 2025-02-26 17:28:25 DB on "[localhost]" already started, connect to check it. 2025-02-26 17:28:26 DB on "[localhost]" start success. 2025-02-26 17:28:26 Ready to start local kbha daemon and repmgrd daemon ... 2025-02-26 17:28:26 begin to start repmgrd on "[localhost]". [2025-02-26 17:28:27] [NOTICE] using provided configuration file "/KingbaseES/V9/cluster/kingbase/bin/../etc/repmgr.conf" [2025-02-26 17:28:27] [INFO] creating directory "/KingbaseES/V9/cluster/kingbase/log"... [2025-02-26 17:28:27] [NOTICE] redirecting logging output to "/KingbaseES/V9/cluster/kingbase/log/hamgr.log" 2025-02-26 17:28:29 repmgrd on "[localhost]" start success. [2025-02-26 17:28:32] [NOTICE] redirecting logging output to "/KingbaseES/V9/cluster/kingbase/log/kbha.log" 2025-02-26 17:28:34 Done. ID | Name | Role | Status | Upstream | Location | Priority | Timeline | LSN_Lag | Connection string ----+-------+---------+-----------+----------+----------+----------+----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 | node1 | primary | * running | | default | 100 | 1 | | host=192.168.6.87 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000 2 | node2 | standby | running | node1 | default | 100 | 1 | 0 bytes | host=192.168.6.88 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000 3 | node3 | standby | running | node1 | default | 100 | 1 | 0 bytes | host=192.168.6.98 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000 [RUNNING] query archive command at 192.168.6.87 ... [RUNNING] current cluster not config sys_rman,return.