测试环境
| IP | VIP | OS | DB |
主库 | 168.3.1.212 | 168.3.1.214 | rhel7.6 | KingbaseES V008R006C007B0012 |
备库 | 168.3.1.213 | 168.3.1.214 | rhel7.6 | KingbaseES V008R006C007B0012 |
测试记录
1.操作系统配置
该步骤主库和备库都必须执行.
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
cat >> /etc/ssh/sshd_config << eof
PermitRootLogin yes
GSSAPIAuthentication no
UseDNS no
eof
sed -i 's/RemoveIPC=yes/RemoveIPC=no/g' /etc/systemd/logind.conf
systemctl daemon-reload
systemctl restart systemd-logind
sed -i.bak '/DefaultTasksAccounting=/cDefaultTasksAccounting=no' /etc/systemd/system.conf
cat >> /etc/rc.d/rc.local << eof
echo deadline > /sys/block/sda/queue/scheduler
eof
#机械硬盘推荐deadline,ssd推荐noop
groupadd -g 1001 kingbase
useradd -u 1001 -g kingbase kingbase
echo kingbase|passwd --stdin kingbase
mkdir -p /kingbase/cluster
chown -R kingbase:kingbase /kingbase
chmod -R 775 /kingbase
2.主库安装数据库客户端
挂载kingbaseES的iso.执行安装,安装时选择客户端安装.
mount /dev/sr0 /mnt
su - kingbase
cd /mnt/
sh setup.sh -i console
3.主库收集集群部署文件
在${install_dir}/ClientTools/guitools/DeployTools/zip/目录下获取如下文件
db.zip | 数据库服务器压缩包 |
V8R6_cluster_install.sh | 部署脚本 |
install.conf | 部署配置文件 |
trust_cluster.sh | 配置SSH免密脚本 |
将license文件也顺带上传到主机,本次测试为了一目了然,也放在了${install_dir}/ClientTools/guitools/DeployTools/zip
4.主库配置部署参数文件
vi install.conf
on_bmj=0
all_ip=(168.3.1.212 168.3.1.213)
witness_ip=""
install_dir="/kingbase/cluster/"
zip_package="/kingbase/KESRealPro/V008R006C007B0012/ClientTools/guitools/DeployTools/zip/db.zip"
license_file=(license.dat)
db_user="system"
db_password="kingbase"
db_port="54321"
db_mode="oracle"
db_auth="scram-sha-256"
db_case_sensitive="yes"
db_checksums="yes"
archive_mode="on"
db_encoding=""
db_collate=""
db_ctype=""
other_db_init_options=""
trusted_servers="168.3.1.254"
running_under_failure_trusted_servers='on'
data_directory=""
virtual_ip="168.3.1.214"
net_device=(enp0s3)
net_device_ip=(168.3.1.212 168.3.1.213)
ipaddr_path="/sbin"
arping_path=""
ping_path="/bin"
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"
auto_cluster_recovery_level='1'
use_check_disk='off'
synchronous=''
sync_in_same_location=0
failover_need_server_alive='off'
install.conf文件里的参数太多,官方文档里都有说明,这里就不再解释了.
5.节点之间配置SSH互信
cd /kingbase/ClientTools/guitools/DeployTools/zip
./trust_cluster.sh
6.主库执行集群部署脚本
cd /kingbase/ClientTools/guitools/DeployTools/zip
./V8R6_cluster_install.sh
7.集群安装完成以后检查
vi /home/kingbase/.bash_profile
export PATH=$PATH:$HOME/.local/bin:$HOME/bin:/kingbase/cluster/kingbase/bin
source /home/kingbase/.bash_profile
repmgr cluster show
总结
kingbaseES读写分离集群搭建还是比较简单的,难的是要理解install.conf中每个参数的含义,只有真的理解了里面每个参数的含义,遇到故障才可能处理的得心应手.
参考文档
KingbaseES主备和读写分离集群使用手册 — KingbaseES产品手册
标签:zip,读写,db,kingbase,cluster,集群,install,168.3,kingbaseES From: https://blog.51cto.com/u_13482808/7587926