当前位置: 首页 > news >正文

KingbaseES主备读写分离集群安装教程

首先我们先要找数据库集群安装软件和脚本。这里我事先安装一台单机。

[root@localhost zip]# mkdir -p /home/kingbase/software
[root@localhost zip]# scp -r * /home/kingbase/software/  #安装软件和脚本在单机版本的/opt/Kingbase/ES/V9/ClientTools/guitools/DeployTools/zip路径下,可自行获取
[root@localhost zip]# chmod -R  775 /home/kingbase/software
[root@localhost zip]# ls -l /home/kingbase/software

在这里插入图片描述
前提是必须卸载原安装的单机库。

[kingbase@localhost ~]$ cd /opt/Kingbase/ES/V9/Uninstall
[kingbase@localhost Uninstall]$ ./Uninstaller

在这里插入图片描述

安装集群

初始化两台机器,主节点需要安装单机版本的数据库,备节点什么都不需要。注意的是主节点找到集群软件和脚本后,要进行卸载。主备节点都关闭防火墙。

选项操作系统
主节点IP192.168.59.141麒麟V10
备节点IP192.168.59.142麒麟V10
主备节点网卡名称ens33
VIP IP192.168.59.200
网关192.168.59.0
[root@localhost software]# vi install.conf

添加以下内容,并进行修改。

[install]
on_bmj=0
all_ip=(192.168.59.141 192.168.59.142)			#必须配置,所有集群节点的IPv4、IPv6或hostname,用但所有节点必须配置为相同的类型。
witness_ip=""
production_ip=()
local_disaster_recovery_ip=()
remote_disaster_recovery_ip=()
install_dir="/home/kingbase/cluster/install"			#必须配置,集群部署的路径。
zip_package="/home/kingbase/software/db.zip"            #必须配置,压缩包的路径。
license_type='default'
license_file=()
lac_host=''                                             #license_type为'LAC'时,必须配置,LAC服务端地址
lac_port=11234                                          #license_type为'LAC'时,必须配置,LAC服务端端口号
lac_type=''
activation_file=''
use_vcpu_limit=0                                        #license_type为'LAC'时,必须配置,0代表示例授权,1代表VCPU授权
db_user="system"                 
db_port="54321"                  
db_mode="oracle"                 
db_auth="scram-sha-256"          
db_case_sensitive="yes"          
db_checksums="yes"               
archive_mode="always"            
encoding="UTF8"                  
locale="zh_CN.UTF-8"                                              
other_db_init_options=""         
sync_security_guc="no"           
tcp_keepalives_idle="2"          
tcp_keepalives_interval="2"      
tcp_keepalives_count="3"         
tcp_user_timeout="9000"          
connection_timeout="10"          
wal_sender_timeout="30000"       
wal_receiver_timeout="30000"     
trusted_servers="192.168.59.0"			#必须配置,指定当前部署集群的信任网关,多个网关请用“,”分隔,不允许有空格。通过route -n查看网关地址
running_under_failure_trusted_servers='on'
use_exist_data=0
data_directory=""
waldir=''
virtual_ip="192.168.59.200"			#可选配置,部署集群所需VIP。只能配置IPv4,当all_ip配置为IPv6或hostname时, 不能配置此参数。
ignore_vip_failure='off'
net_device=(ens33)                #可选配置,若配置了[virtual_ip],则此参数必须配置,值为VIP所在网卡的网卡名称。
net_device_ip=(192.168.59.141 192.168.59.142)        #可选配置,若配置了[virtual_ip],则此参数必须配置,值为VIP所在网卡的集群节点物理IP地址。
ipaddr_path="/sbin"
arping_path=""
ping_path="/bin"
install_with_root=1
super_user="root"
execute_user="kingbase"
deploy_by_sshd=1                 
use_scmd=1                       
reconnect_attempts="10"          
reconnect_interval="6"           
recovery="standby"               
ssh_port="22"                    
scmd_port="8890"                 
use_ssl=0
auto_cluster_recovery_level='1'
use_check_disk='off'
synchronous=''
sync_nodes=()
potential_nodes=()
async_nodes=()
sync_in_same_location=0
failover_need_server_alive='off'
[expand]
expand_type=""                   
primary_ip=""                    
expand_ip=""                     
node_id=""                       
sync_type=""                     
install_dir=""                   
zip_package=""
net_device=()                    
net_device_ip=()                 
license_type='default'
license_file=()
lac_host=''
lac_port=11234
lac_type=''
activation_file=''
use_vcpu_limit=0
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"                              

主节点执行免密脚本

[root@localhost software]# cd /home/kingbase/software/
[root@localhost software]# sh trust_cluster.sh

在这里插入图片描述
集群搭建
使用kingbase用户登录集群主节点执行

[kingbase@localhost ~]$ cd /home/kingbase/software/
[kingbase@localhost ~]$ sh cluster_install.sh

集群状态查看
在集群中任意一数据库节点,使用kingbase用户执行

[kingbase@localhost ~]$cd /home/kingbase/cluster/install/kingbase/bin
[kingbase@localhost ~]$./repmgr cluster show

在这里插入图片描述
我这里网关地址配置有误,报错可以忽略。

主备切换演练

[kingbase@localhost ~]$ cd /home/kingbase/cluster/install/kingbase/bin
[kingbase@localhost bin]$ ./repmgr standby switchover --choose

在这里插入图片描述
说明142可以升为主库。

[kingbase@localhost bin]$ ./repmgr standby switchover --siblings-follow

在这里插入图片描述
执行切主。

[kingbase@localhost bin]$ ./repmgr cluster show

在这里插入图片描述
这里我们看到切换成功了。

附录

因为刚开始两台机器之间没做免密,会有如下报错。
[RUNNING] check the sys_securecmdd is running or not…
[ERROR] the sys_securecmdd on “192.168.59.141:8890” is running, please stop it first.
[ERROR] the sys_securecmdd on “192.168.59.142:8890” is running, please stop it first.
解决方案是停掉进程,并删掉已经安装的路径文件。

[root@localhost ~]# systemctl status securecmdd
[root@localhost ~]# systemctl stop securecmdd
[root@localhost kingbase]# rm -rf /home/kingbase/cluster/install/kingbase

重新执行集群安装命令即可。

参考链接:https://docs.kingbase.com.cn/cn/KES-V9R1C10/availability/rwc/Database_Operation/Cluster_Operations#%E4%B8%BB%E5%A4%87%E5%88%87%E6%8D%A2

http://www.dtcms.com/a/335275.html

相关文章:

  • 字节数据流
  • 北汽新能源半年报:双品牌战略拉动销量增长,多元布局促进转化
  • PIDGen!DecodeProdKey函数分析之四个断点
  • 【大模型应用开发 3.RAG技术应用与Faiss向量数据库】
  • 【leetcode】12. 整数转罗马数字
  • 关于“双指针法“的总结
  • 【Python】Python爬虫学习路线
  • “openfeign“调用接口上传文件报错:Failed to deleted temporary file used for part [file]
  • c++11扩展(c++11并发库)
  • 在职老D渗透日记day18:sqli-labs靶场通关(第26关)get报错注入 过滤or和and基础上又过滤了空格和注释符 ‘闭合 手动注入
  • echarts 画一个饼图,并且外围有一个旋转动画
  • linux下程序运行一段时间无端崩溃/被杀死,或者内存占用一直增大。linux的坑
  • 11.web api 2
  • 模式匹配自动机全面理论分析
  • AI短视频爆火?记录AIGC在影视制作场景的实践教程
  • 大模拟 Major
  • 随机整数列表处理:偶数索引降序排序
  • jd-hotkey探测热点key
  • 流量分析服务一审构成非法经营罪二审改判:数据服务的法律边界
  • 电路方案分析(二十二)适用于音频应用的25-50W反激电源方案
  • ethernet_input到应用层处理简单分析
  • 5 索引的操作
  • K8s核心组件全解析
  • 如何使用嵌入模型创建本地知识库Demo
  • 三、memblock 内存分配器
  • 深入理解文件硬链接、软链接与引用计数的那些事
  • 机器学习相关算法:回溯算法 贪心算法 回归算法(线性回归) 算法超参数 多项式时间 朴素贝叶斯分类算法
  • 超详细yolo8/11-pose人体姿态全流程概述:配置环境、数据标注、训练、验证/预测、onnx部署(c++/python)详解
  • 8.16、8.17 JavaWeb(MyBatis P116-P134)
  • 【网络与爬虫 00】试读