静默部署
名称 | IP地址 | 备注 |
主节点 | 192.168.122.193 | Primary |
备节点 | 192.168.122.194 | Standby |
见证节点 | 192.168.122.195 | Witness |
修改install.conf配置文件(供参考)
$ egrep -v '^#|^$' install.conf |awk -F "#" '{print $1}' [install] --初次安装使用 on_bmj=0 all_ip=(192.168.122.193 192.168.122.194) witness_ip="192.168.122.195" production_ip=() local_disaster_recovery_ip=() remote_disaster_recovery_ip=() install_dir="/home/kingbase/cluster/install" zip_package="/home/kingbase/KingbaseES/V8/ClientTools/guitools/DeployTools/zip/db.zip" license_file=(license_18720_0.dat) db_user="system" db_port="54321" db_mode="oracle" db_auth="scram-sha-256" db_case_sensitive="yes" db_checksums="yes" trusted_servers="192.168.122.1" running_under_failure_trusted_servers='on' data_directory="" waldir='' virtual_ip="192.168.122.196" net_device=(team0 team0 ) net_device_ip=(192.168.122.193 192.168.122.194) ipaddr_path="/sbin" arping_path="" ping_path="/bin" super_user="root" execute_user="kingbase" deploy_by_sshd=1 use_scmd=0 reconnect_attempts="10" reconnect_interval="6" recovery="standby" ssh_port="22" scmd_port="8890" auto_cluster_recovery_level='1' use_check_disk='off' synchronous='' sync_in_same_location=0 failover_need_server_alive='off' [expand] --扩容时使用 expand_type="" primary_ip="" expand_ip="" node_id="" install_dir="" zip_package="" net_device=() net_device_ip=() license_file=(license.dat) deploy_by_sshd="1" ssh_port="22" scmd_port="8890" [shrink] --缩容时使用 shrink_type="" primary_ip="" shrink_ip="" node_id="" install_dir="" ssh_port="22" scmd_port="8890" |
注:上面配置文件搭建一主一备一见证服务器,如需配置单节点升级到主备复制集群、或配置两地三中心环境后续完善。
节点配置信任
# cd /home/kingbase/KingbaseES/V8/ClientTools/guitools/DeployTools/zip # ./ trust_cluster.sh |
部署主备集群
$ cd /home/kingbase/KingbaseES/V8/ClientTools/guitools/DeployTools/zip $ ./V8R6_cluster_install.sh |
部署过程查看日志
$ cd ${install_dir}/log |
异步节点
在实际的客户环境中,我们会遇到各种的部署要求。例如:主备集群中1主多备 存在1个异步节点。又或者是主备容灾中心,灾备中心是异步节点。相对更复杂的部署要求两地三中心架构。
安装时修改install.conf指定为sync模式
$ egrep -v '$^|#' install.conf [install] on_bmj=0 all_ip=(192.168.2.153 192.168.2.154 192.168.2.155) witness_ip="" production_ip=() local_disaster_recovery_ip=() remote_disaster_recovery_ip=() install_dir="/home/kingbase/cluster" zip_package="/home/kingbase/install_tmp/zip/db.zip" license_file=(license.dat) trusted_servers="192.168.0.1" running_under_failure_trusted_servers='on' data_directory="/data/kingbase/data" waldir='' virtual_ip="192.168.2.162/24" net_device=(ens192 ens192) net_device_ip=(192.168.2.153 192.168.2.154 192.168.2.155) ipaddr_path="/sbin" arping_path="" ping_path="/bin" super_user="root" execute_user="kingbase" auto_cluster_recovery_level='1' use_check_disk='off' synchronous='sync' sync_in_same_location=0 failover_need_server_alive='off' [shrink] install_dir="" |
已经部署完的集群,修改主备集群的配置文件es_repmgr.conf,将synchronous=修改为sync,异步节点还可以加上优先级参数priority=0 (0不自动升级为主机)
$ egrep -v '$^|#' repmgr.conf use_scmd=off ha_running_mode='DG' node_id='3' node_name='node3' conninfo='host=192.168.2.155 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3' connection_check_type='mix' data_directory='/data/kingbase/data' log_file='/home/kingbase/cluster/kingbase/log/hamgr.log' kbha_log_file='/home/kingbase/cluster/kingbase/log/kbha.log' sys_bindir='/home/kingbase/cluster/kingbase/bin' scmd_options='-q -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ServerAliveInterval=2 -o ServerAliveCountMax=5 -p 22' trusted_servers='192.168.0.1' running_under_failure_trusted_servers='on' repmgrd_pid_file='/home/kingbase/cluster/kingbase/etc/hamgrd.pid' kbha_pid_file='/home/kingbase/cluster/kingbase/etc/kbha.pid' failover='automatic' synchronous='sync' recovery='standby' auto_cluster_recovery_level='1' monitoring_history='no' reconnect_attempts=10 reconnect_interval=6 priority=0 promote_command='/home/kingbase/cluster/kingbase/bin/repmgr standby promote -f /home/kingbase/cluster/kingbase/etc/repmgr.conf' follow_command='/home/kingbase/cluster/kingbase/bin/repmgr standby follow -f /home/kingbase/cluster/kingbase/etc/repmgr.conf -W --upstream-node-id=%n' ping_path='/bin' use_check_disk='off' virtual_ip='192.168.2.162/24' ipaddr_path='/sbin' arping_path='/home/kingbase/cluster/kingbase/bin' net_device='ens192' net_device_ip='192.168.2.155' |
修改后状态
$ repmgr cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | LSN_Lag | Connection string ----+-------+---------+-----------+----------+----------+----------+----------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------- 1 | node1 | primary | * running | | default | 100 | 5 | | host=192.168.2.153 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 2 | node2 | standby | running | node1 | default | 100 | 5 | 0 bytes | host=192.168.2.154 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 3 | node3 | standby | running | node1 | default | 0 | 5 | 0 bytes | host=192.168.2.155 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 |