长江计算R220KV2(鲲鹏920) 服务器部署人大金仓KingbaseES

硬件环境: kunpeng 920 64C/32G/500 G
操作系统:CentOS 7.9 ARM
数据库软件:KingbaseES_V008R006C008B0014_Aarch64_install.iso(官网获取)
授权文件:90 天企业版授权(官网获取)

说明:

此处用官方“KingbaseES_V008R006C008B0014_Kunpeng64_install.iso”安装部署到最后一步时报错,经咨询官方技术人员,改用“KingbaseES_V008R006C008B0014_Aarch64_install.iso”

 ISO获取地址:人大金仓-成为世界卓越的数据库产品与服务提供商

说明 :我是在鲲鹏920处理器的服务器上部署了开源虚拟化Proxmox VE 8,请参考我发布的

国产鲲鹏920处理器服务器部署Proxmox VE Arm 8.x

 1.检查硬件环境

 1.1 CPU

 1.2 内存

 1.3 磁盘

2.部署规划

规划方案
数据库安装用户:kingbase  
软件包、License存放目录:/home/kingbase/install
数据库软件安装目录:/home/kingbase/KingbaseES/V8
数据库软件安装目录客户有要求时可更换,设置好KINGBASE_HOME环境变量便于后续维护。
存储可选设备:FC存储、iscsi存储、本地磁盘,禁止使用NAS存储。
阵列级别:raid10、raid1、raid5+热备、raid5,禁止使用raid0。
数据库数据目录:/data/dbdata
数据库备份目录:/data/dbbackup
数据库端口:54321
数据库用户:SYSTEM
数据库密码:qweasd@2023

3.SELINUX、防火墙状态检查 

vim /etc/selinux/config 
SELINUX=disabled                    ##  禁用状态(确认是否可以修改)
service iptables stop
chkconfig iptables off
iptables -L
iptables -F
systemctl stop firewalld            ##  关闭防火墙(确认是否可以修改)
systemctl disable firewalld


时间检查
date            
date -s        ##  如不正确,使用data -s修改

4.创建用户、密码及目录

## 创建用户
## 安装数据库时,必须使用非root用户安装
useradd -m -U -s /bin/bash kingbase -d /home/kingbase
## -m创建用户家目录,-U 创建用户同名用户组

## 设置密码
passwd kingbase
输入密码

## 无论规划放到哪个目录,属主属组必须是安装用户。
## (1)数据库安装包及license文件存放存放目录:
mkdir /home/kingbase/install    
chown -R kingbase.kingbase /home/kingbase/install

## (2)数据库软件目录:
mkdir -p /home/kingbase/KingbaseES/V8    
chown -R kingbase.kingbase /home/kingbase/KingbaseES/V8

## (3)数据库数据目录(选择存储空间大的做数据目录):
mkdir -p /data/dbdata/data        
chown -R kingbase.kingbase /data/dbdata/data    

## (4)数据库备份目录(选择存储空间大的做备份目录,最好不与数据目录在同一盘下):
## A:物理备份路径
mkdir -p /data/dbbackup/kbbr_repo
chown -R kingbase.kingbase /data/dbbackup/kbbr_repo
## B:逻辑备份路径
mkdir -p /data/dbbackup/logical
chown -R kingbase.kingbase /data/dbbackup/logical

 5.操作系统参数配置

 5.1 配置 limits.conf 文件
vi /etc/security/limits.conf
## 追加写入
root     soft     nofile       655360
root     hard     nofile     655360
root     soft     nproc       655360
root    hard     nproc       655360
root     soft     memlock  50000000
root     hard     memlock  50000000
root    soft     core         unlimited
root     hard     core         unlimited

kingbase     soft     nofile       655360
kingbase     hard     nofile     655360
kingbase     soft     nproc       655360
kingbase    hard     nproc       655360
kingbase     soft     memlock  50000000
kingbase     hard     memlock  50000000
kingbase    soft     core         unlimited
kingbase     hard     core         unlimited

#参数说明
soft - 指当前系统生效的设置值。
hard - 指系统中所能设定的最大值。soft的限制不能比hard的限制高。
nofile - 指打开文件的最大数目
nproc - 指进程的最大数目
core - 指限制内核文件的大小
 5.2 配置 sysctl. Conf 文件
vi /etc/sysctl.conf
# 追加写入

kernel.sem = 50100 64128000 50100 1280
# 信号量, ipcs -l 或 -u 查看,每16个进程一组,每组信号量需要17个信号量。
kernel.shmall = 1073741824 
# 所有共享内存段相加大小限制(建议内存的80%)   
kernel.shmmax = 4398046511104
最大单个共享内存段大小(建议为内存一半)
kernel.shmmni = 4096  
vm.dirty_background_ratio=2 
vm.dirty_ratio = 40   
vm.overcommit_memory = 2 
vm.overcommit_ratio = 90  
vm.swappiness = 10   
fs.aio-max-nr = 40960000
fs.file-max = 7672460 
fs.nr_open = 20480000       
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.ip_local_port_range=9000 65500
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_max_tw_buckets = 6000
net.core.somaxconn=1024
net.core.netdev_max_backlog = 32768
net.core.wmem_default=262144
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=4194304
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_syn_retries = 2
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_wmem=8192 65536 16777216
net.ipv4.tcp_rmem=8192 87380 16777216
net.ipv4.tcp_mem = 94500000 91500000 92700000
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.ip_forward = 1

# 重新加载生效
sysctl -p 
 5.3 配置 system. Conf 文件
# 全局修改
vi /etc/systemd/system.conf 
# 修改参数
DefaultTasksAccounting=no  
# 注:所有服务不再有此限制

systemctl daemon-reload 
systemctl daemon-reexec 
service sshd status
# 注:修执行命令后 service sshd status 观察是否生效(无Limit那一行),若无生效,重启。
# 2、局部修改
systemctl set-property cron.service TasksMax=65535
 5.4修改 IPC
vi /etc/systemd/logind.conf
RemoveIPC=no    
# 生效方式
systemctl daemon-reload
systemctl restart systemd-logind 

 6. 安装

 6.1 上传文件
mkdir  /home/kingbase/cdrom
cd  /home/kingbase/install/
mount  KingbaseES_V008R006C008B0014_Aarch64_install.iso /home/kingbase/cdrom
cd  ../cdrom
cp  -r  *  ../install
# 注:mount命令只能使用root用户执行
 6.2 更改上传文件属主属组
cd /home/kingbase/install/
chown -R kingbase.kingbase *
 6.3 命令行方式安装

如果当前登录用户为 root 用户,su - kingbase 之后执行 sh setup. Sh 之后不会显示图形化安装界面。

su - kingbase
cd /home/kingbase/install
bash setup.sh -i console
# 注:加-i console可直接使用命令行安装
[kingbase@localhost install]$ bash setup.sh -i console
Now launch installer...
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

=========================================================================
KingbaseES V8                                    (created with InstallAnywhere)
-------------------------------------------------------------------------------

Preparing CONSOLE Mode Installation...

=========================================================================

Please Wait
-----------

=========================================================================
Welcome
-------

This installer will guide you through the installation of KingbaseES V8.

It is strongly recommended that you quit all programs before continuing with
this installation. You may cancel this installation by typing 'quit'.

KingbaseES Version: V8
Kingbase Type:BMJ-NO
Installer Version: V008R006C008B0014
Install DATE:202312130246

Kingbase Inc.
        http://www.kingbase.com.cn

PRESS <ENTER> TO CONTINUE:

=========================================================================
Please Wait
-----------

=========================================================================
License Agreement
-----------------

Installation and Use of KingbaseES V8 Requires Acceptance of the Following
License Agreement:


Beijing Kingbase Information Technologies Inc.
"SOFTWARE END-USER LICENSE AGREEMENT"
IMPORTANT-READ CAREFULLY: This End-User License Agreement ("EULA") is a legal
agreement between you (either an individual or a single entity) and Beijing
Kingbase Information Technologies Inc.(abbreviated as Kingbase in the
context). The "software product" includes computer software, and may include
associated media, printed materials, and online documentation(Software
product). This "software product" includes any upgrade and supplemental
materials to the original "software product" provided by Kingbase. Any
software product that are provided with the "software product", which are
accompanied by their own license agreements or terms of use are governed by
this EULA. You agree to be bound by the terms of this EULA by installing,
copying, downloading, accessing or otherwise using the "software product". If
you do not agree to the terms of this EULA, you may not install, copy or use
the "software product".

SOFTWARE PRODUCT LICENSE

The "software product" is protected by copyright laws, international copyright
treaty and other intellectual property laws and treaties.

The "software product" is licensed to use, not sold.

PRESS <ENTER> TO CONTINUE:


1. GRANT OF LICENSE. As long as you follow this EULA, Kingbase grants you the
following non-exclusive, non-transitive rights:

APPLICATION SOFTWARE. You can use the software in locations as agreed in the
related contract. The usage is restricted by the quantity of the purchased and
the type of the license (as agreed in the contract). If the license type has
no special specification, you can only install, use, access, display, run or
use other methods to interact(run) with one copy of this "software product"
(or any previous versions on the same operating system) on a single computer,
workstation, handheld computer, smart phone or other electronic device
("computer").

RESERVATION OF RIGHTS. Except for the specific statements in this EULA,
Kingbase reserves all rights not expressly granted to you. Kingbase reserves
the right to interpret the content of the agreement.

2. LIMITATIONS AND OTHER RIGHT

LIMITATION ON TRANSFER. Under any condition, without the written permission of
Kingbase, you may not transfer this license and any usage permission under
this license.

PRESS <ENTER> TO CONTINUE:


NOT FOR RESALE SOFTWARE. If this "software product" is identified as "Not For
Resale", it may not be sold or otherwise transferred for value, or used for
any purpose other than demonstration, test or evaluation, no matter what else
is stated in this EULA.

LIMITATIONS ON REVERSE ENGINEERING, DECOMPILATION, AND DISASSEMBLY. You may
not reverse engineer, decompile, or disassemble the "software product", except
and only to the extent that such activity is expressly permitted by applicable
law not with standing this limitation.

TRADEMARKS. This EULA does not grant you any rights in connection with any
trademarks or service marks of Kingbase.

NO RENTAL. You may not rent, lease or lend the "software product" to others.

EXPORT LIMITATION. You admit that the "software product" is governed by the
export laws of People's Republic of China. You agree to obey all the
international and domestic laws applicable to this "software product",
including "Foreign Trade Law of the People's Republic of China", and other
restrictions and regulations issued by the Chinese government related to
software exportation.

PRESS <ENTER> TO CONTINUE:


PRODUCT SUPPORT. Kingbase provides you the support service related to the
software product ("support service"), but the specific content of the support
service is limited by related contract. Kingbase reserves the right to charge
the support service. The usage of support service is restricted by the
policies and plans in the user's manual, online document and/or other Kingbase
provided materials. Any supplemental software code provided to you should be
treated as a part of the "software product", and has to comply the terms and
conditions in this EULA. As for the technical information you provided to
Kingbase as a part of the support service, Kingbase may commercialize it,
including product support and development. Kingbase will not mention you
individually when using this technical information.

TERMINATION. Without prejudice to other rights, Kingbase may terminate this
EULA if you fail to comply with the terms and conditions of this EULA. In such
event, you must destroy all copies of the "software product" and all of its
component parts.

3. UPGRADES. If the "software product" is labeled as an upgrade, you must be
properly licensed to use a product identified by Kingbase as being eligible
for the upgrade in order to use the "software product". Kingbase reserves the
right to charge the upgrade version or upgrade. "software product" labeled as

PRESS <ENTER> TO CONTINUE:

an upgrade replaces and/or supplements the Eligible Product which you are
qualified to use. You may use the resulting upgraded product only in
accordance with the terms of this EULA. If the "software product" is an
upgrade of a component of a package of software programs that you licensed as
a single product, the "software product" may be used and transferred only as
part of that single product package and may not be separated for use on more
than one computer.

4. INTELLECTUAL PROPERTY. The ownership, copyright and other intellectual
property of the "software product" (including but not limited to the picture,
photo, animation, video, recordings, music, text and supplemental programs
contained in the "software product"), enclosed printed materials and any
copies of the "software product", is owner by Kingbase and its suppliers. The
ownership and intellectual property accessed by this "software product"
belongs to the owner of the contents, and may be protected by copyright laws,
and other intellectual property laws and treaties. This EULA does not grant
you the right to use these contents. If this "software product" include
documents only provided electronically, you can print one copy of the
electronic documents. You may not remove the copyright declaration from the
software, and ensures that the copyright declaration is copied for the replica
(whole or part) of the "software product". You agree to stop any forms of
illegal copying this software and the documents. You cannot copy the enclosed

PRESS <ENTER> TO CONTINUE:

printed materials in this "software product".

5. MULTIMEDIA SOFTWARE. You may obtain the "software product" through multiple
medias. No matter the type and size of the media you receive, you can only use
the media which is applicable to your single computer. You cannot run a
different media on another computer. Except for the part as in "permanent
transfer" of the "software product (as stated above), you cannot transfer the
other medias to another user via rent, lease or lend.

6. BACKUP COPY. After installing a copy of the "software product" according to
the EULA, you may keep the original media by which Kingbase provided you the
"software product" solely for backup or archival purpose. If original media is
needed to use the "software product", you may make one back-up copy solely for
your backup or archival purposes. Except as expressly provided in this EULA,
you may not otherwise make copies of the software, including the printed
materials accompanying the software. Authorized copy should be kept in secured
environments.

7. CONFIDENTIALITY. "Confidential information" includes program(including the
methods and concepts used in the program) and any information that Kingbase
identifies as exclusive or confidential. Unless expressly granted by this
EULA, you may not expose or provide the confidential information by other

PRESS <ENTER> TO CONTINUE:

methods to a third party and any employees to whom you do not grant the usage
in their business. You should take any reasonable, necessary measures to
ensure that the program or any component of the software is not exposed or
provided by other methods to a third party.

If you acquired the Kingbase product in People's Republic of China, the
following limited warranty applies to you.

1. LIMITED WARRANTY.
As long as you have valid license, Kingbase warrants that: (1) The "software
product" will perform substantially in accordance with the accompanying
materials for a period of ninety (90) days after the date of receipt. (2) The
provided support will perform substantially in accordance with the
accompanying materials, and Kingbase engineers will try their best to solve
any problems permitted by commercial range. If the product is not compliant to
the warranty, Kingbase will fix, replace the product or refund you for the
product, and you have to return the "software product" to Kingbase along with
the invoice held by you. If the malfunction of the product is due to accident,
abuse or misuse, then the warranty is not effective. The replaced product has
the residual of the original warranty period, or thirty days, whichever is
longer. To the maximum extent permitted by applicable law, except for the
above warranty, all expressed or implied warranties, conditions and other

PRESS <ENTER> TO CONTINUE:

terms are denied by Kingbase. All implicit warranties which cannot be excluded
are limited to 90 days or the minimum period allowed by the appropriate laws,
whichever is longer.

2. LIMITATION OF LIABILITY
To the maximum extent permitted by applicable law, except for the above
warranty, Kingbase and its suppliers shall not be liable for any damages
whatsoever (including without limitation, damages for loss of business
profits, business interruption, loss of business information or other
pecuniary loss) arising out of the use or inability to use the "software
product", even if Kingbase and its suppliers have been advised of the
possibility of such damages. In any case Kingbase and any of its suppliers'
entire liability under any provision of this EULA shall be limited to the
amount actually paid by you for the "software product" or RMB 10.00 Yuan,
which ever is higher. However, if you have signed support agreement with
Kingbase, all Kingbase's liability of the support service will be defined by
that agreement.

GOVERNING LAWS
This EULA is governed by the laws of the People's Republic of China (including
but not restricted to "Copyright Law of the People's Republic of China",
"Regulations for the Protection of Computer Software of the People's Republic

PRESS <ENTER> TO CONTINUE:

of China", "Trademark Law of the People's Republic of China", "Patent Law of
the People's Republic of China", "Anti-Unfair Competition Law of the People's
Republic of China", etc.). In respect of any dispute or claim which may arise
by this EULA or the violation of the EULA, you consent to the jurisdiction of
the federal and provincial courts sitting in the location of Kingbase. If
Kingbase's intellectual property is violated, the above terms do not restrict
Kingbase to apply remedial measures from the legitimate court with governing
rights.

Beijing Kingbase Information Technologies Inc.

Add: 3 layer, B block, Information Industrial Park, Rongda Road 7, Chaoyang
District, Beijing, 100102 China
Tel: 86-10-5885 1118
Http: //www.kingbase.com.cn
National Hotline: 400-601-1188
Support E-mail: support@kingbase.com.cn


DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): y

===============================================================================
Choose Install Set
------------------

Please choose the Install Set to be installed by this installer.

  ->1- Full
    2- Client

    3- Custom

ENTER THE NUMBER FOR THE INSTALL SET, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
 : 1

===============================================================================

Please Wait
----------

===============================================================================

Please Wait
-----------

===============================================================================
Choose License File
-------------------
```

```ad-tip
title:软件授权
```

填写授权文件绝对地址

```bash
Choose License File
-------------------


File Path: /home/kingbase/install/license_29296_0.dat

License序列号 --- 启用 --- 5B9512C0-C2DA-11ED-B123-000C29CBE49F
生产日期 --- 启用 --- 2023-03-15
产品名称 --- 启用 --- KingbaseES V8
细分版本模板名 --- 启用 --- SALES-企业版 V8R6
产品版本号 --- 启用 --- V008R006C
浮动基准日期 ------ 启用
有效期间 --- 启用 --- 90
用户名称 --- 启用 --- 官方网站试用授权
项目名称 --- 启用 --- 官方网站试用授权
CPU检查 --- 启用 --- 0
容器名称 --- 禁用 --- 0
MAC地址 --- 启用 --- 00:00:00:00:00:00
最大连接数 --- 启用 --- 0
分区 --- 启用 --- 0
物理同步 --- 启用 --- 0
读写分离模块 --- 启用 --- 0
恢复到指定时间点 --- 启用 --- 0
集群对网络故障的容错 --- 启用 --- 0
快速加载 --- 启用 --- 0
日志压缩 --- 启用 --- 0
全文检索 --- 启用 --- 0
性能优化包(性能诊断) --- 启用 --- 0
性能优化包(性能调优) --- 启用 --- 0
保密通讯协议 --- 启用 --- 0
审计 --- 启用 --- 0
三权分立 --- 启用 --- 0
透明加密 --- 启用 --- 0
强制访问控制 --- 启用 --- 0
列加密 --- 启用 --- 0
密码复杂度 --- 启用 --- 0
用户锁定 --- 启用 --- 0
集群管理软件 --- 启用 --- 0
集群配置工具 --- 启用 --- 0
集群高级管理包 --- 启用 --- 0
并行查询 --- 启用 --- 0
并行备份还原 --- 启用 --- 0
异构数据源 --- 启用 --- 0
日志解析 --- 启用 --- 0
GIS --- 启用 --- 0
日志解析为SQL --- 启用 --- 0
操作系统类型 --- 启用 --- 0
数据守护集群 --- 启用 --- 0
多活共享存储集群 --- 启用 --- 0
========================================================================
Choose Install Folder
---------------------

Please choose a destination folder for this installation.

Where would you like to install?

  Default Install Folder: /opt/Kingbase/ES/V8
```

```ad-tip
title:安装路径
输入绝对路径,用做软件安装目录(输入之前规划的/home/kingbase/KingbaseES/V 8),按 enter 键继续,提示路径是否正确,无问题后,回车继续安装。
```
```bash

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
      : /home/kingbase/KingbaseES/V8

INSTALL FOLDER IS: /home/kingbase/KingbaseES/V8
   IS THIS CORRECT? (Y/N): y


```

```ad-tip
title预安装摘要
显示安装信息,如果信息有误,输入“BACK”进行更改,如果信息无误,按 enter 键继续。
```

```bash
=======================================================================
Pre-Installation Summary
------------------------

Please Review the Following Before Continuing:

Product Name:
    KingbaseES V8

Install Folder:
    /home/kingbase/KingbaseES/V8

Product Features:
    SERVER,
    INTERFACE,
    DEPLOY,
    KINGBASEHA,
    KSTUDIO,
    KDTS

Install Disk Space Information
    Require Disk space : 4983 MB           Free Disk Space : 41602 MB
    
PRESS <ENTER> TO CONTINUE:

```

```bash

========================================================================
Ready To Install
----------------

InstallAnywhere is now ready to install KingbaseES V8 onto your system at the
following location:

   /home/kingbase/KingbaseES/V8

PRESS <ENTER> TO INSTALL:
```

开始安装

```bash
========================================================================
Installing...
-------------
 [==================|==================|==================|=============]
[------------------|------------------|------------------|-------------]
.
.
.
Please Wait
-----------

========================================================================
Choose a Folder for data directory
----------------------------------

Please choose a folder. The folder must be empty.

Data folder (Default: /home/kingbase/KingbaseES/V8/data): /data/dbdata/data

```

```bash
========================================================================
Port
----

Please enter database service listened port, default 54321.

Port (Default: 54321):


========================================================================
User
----

Please enter database administrator user name.

User (Default: system):

========================================================================
Enter Password
--------------


Please Enter the Password: Please Enter the Password:************

========================================================================
Enter Password again
--------------------


Please Enter the Password Again: Please Enter the Password Again:************

========================================================================
Server Encoding
---------------

Please enter server character set encoding.

  ->1- UTF8
    2- GBK
    3- GB18030

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1

========================================================================
Database Mode
-------------

Please enter database mode.

    1- PG
  ->2- ORACLE
    3- MySQL

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 2


========================================================================
Case Sensitivity
----------------

Please enter the case sensitivity.

  ->1- YES
    2- NO

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1

========================================================================
Block Size
----------

Please enter block size used in storing data.

  ->1- 8k
    2- 16k
    3- 32k

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:


========================================================================
Encrypt Method
--------------

Please enter the encrypt method.

  ->1- sm4
    2- rc4

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:

========================================================================
Authentication Method
---------------------

Please enter the authentication method.

  ->1- scram-sha-256
    2- scram-sm3
    3- sm4
    4- sm3

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:

========================================================================
Tips
----

The database will be initialized, which may take some time. Please be patient.

PRESS <ENTER> TO CONTINUE:


========================================================================

Please Wait
-----------


========================================================================
Installation Complete
---------------------

Congratulations. KingbaseES V8 has been successfully installed to:

/home/kingbase/KingbaseES/V8

If you want to register KingbaseES V8 as OS service, please run

    /home/kingbase/KingbaseES/V8/install/script/root.sh

PRESS <ENTER> TO EXIT THE INSTALLER:


```
6.4执行 root. Sh 脚本

执行 root. Sh 脚本,是指将 kingbase 8 d 服务注册为系统服务,并实现开机自启,此操作必须由 root 用户执行,安装用户无此权限。执行后会提示启动成功,如未成功,可根据提示,查看相关 log 日志。

[kingbase@localhost install]$ su root
Password:
[root@localhost install]# cd /home/kingbase/KingbaseES/V8/Scripts/
bash: cd: /home/kingbase/KingbaseES/V8/Scripts/: No such file or directory
[root@localhost install]# cd /home/kingbase/KingbaseES/V8/install/script/
[root@localhost script]# ls
consoleCloud-uninstall.sh  initcluster.sh  javatools.sh  rootDeployClusterware.sh  root.sh  rootuninstall.sh  startupcfg.sh  stopserver.sh
[root@localhost script]# bash ./root.sh
Starting KingbaseES V8:
waiting for server to start.... done
server started
KingbaseES V8 started successfully
[root@localhost script]#
6.5设置 kingbase 用户环境变量

检查用户家目录下/home/kingbase/.bash_profile 中是否包含下列代码,不存在则增加。

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

在/home/kingbase/.bashrc 文件末尾增加如下配置。

export PATH=/home/kingbase/KingbaseES/V8/Server/bin:$PATH
export LD_LIBRARY_PATH=/home/kingbase/KingbaseES/V8/Server/lib:$LD_LIBRARY_PATH
export KINGBASE_DATA=/data/dbdata/data
export KINGBASE_PORT=54321
export KINGBASE_HOME=/home/kingbase/KingbaseES/V8
6.6 查看版本

 7.配置数据库自动备份

 7.1逻辑备份

安装rpm包

rpm -ivh kdbtools-006-001.noarch.rpm

安装完毕之后对应文件路径/opt/Kingbase/tools/logical\_backup/

vim backup8.conf ---根据实际情况选择路径

kdb_home="/home/kingbase/KingbaseES/V8"
kdbback_dest="/data/dbbackup/logical"
kdb_user="system"
kdb_pass="qweasd@2023"
kdb_port="54321"
kdb_host="127.0.0.1"
#可不填,默认备份所有库(不包括自带库)
#kdb_list="TEST,SAMPLES"
keep_time="7"

修改定时任务

Crontab -e
0 2 * * * sh /home/kingbase/KingbaseES/V 8/Server/kb_scripts/kb_backup/logical/backup 8. Sh >>//home/kingbase/KingbaseES/V 8/Server/kb_scripts/kb_backup/logical/logical_backup. Log 2>&1 &

执行完毕检查一下 

crontab -l
0 2 * * * sh /home/kingbase/KingbaseES/V 8/Server/kb_scripts/kb_backup/logical/backup 8. Sh >>//home/kingbase/KingbaseES/V 8/Server/kb_scripts/kb_backup/logical/logical_backup. Log 2>&1 &
 7.2物理备份(必做)

说明:本小节为引用物理备份官方说明
rman单机本地备份操作步骤
一、配置物理备份前提条件
1、创建备份目录
mkdir /home/kingbase/kbbr_repo
2、数据库开启归档
(1)修改配置文件kingbase.conf中参数:
    archive_mode=on
archive_command=’’
(2)重启数据库
sys_ctl restart -D /home/kingbase/KingbaseES/V8/data
3、配置ssh免密登录
kingbase用户执行
ssh-keygen -t rsa
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub kingbase@192.168.114.13
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub root@192.168.114.13

二、配置物理备份
1、修改物理备份配置文件
vi /home/kingbase/KingbaseES/V8/Server/bin/sys_backup.conf
# target db style enum:  single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.114.13"                --本机物理IP
# local repo IP, inner-REPO, must be same as one_db_ip, means repo located in one db node
# outer repo IP, outer-REPO, means repo located in outer node
_repo_ip="192.168.114.13"                    --本机物理IP,与_one_db_ip配置相同
# label of this cluster
_stanza_name="kingbase"
# OS user name of database
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/home/kingbase/kbbr_repo"        --备份路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5                --全量备份保留5份
# count of days, interval to do FULL-backup
_crond_full_days=7                            --每周一次全量备份
# count of days, interval to do DIFF-backup
_crond_diff_days=0                        --不进行差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1                        --每天一次增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2                        --每天凌晨两点进行全量备份
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4                        --每天凌晨四点进行增量备份
# OS cmd define
_os_ip_cmd="/usr/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/home/kingbase/KingbaseES/V8/data"
# bin dir of single
_single_bin_dir="/home/kingbase/KingbaseES/V8/Server/bin"
#_single_bin_dir="/home/kingbase/KingbaseES/V8/Server/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh init    
——执行后会在备份文件路径 /home/kingbase/kbbr_repo 创建文件夹、文件、配置文件等,并备份一次全量数据。
3、执行sys_backup.sh start添加定时任务
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh start    
——执行后会在定时任务中添加备份任务
4、查看定时任务
cat /etc/cron.d/KINGBASECRON

rman单机异地备份操作步骤
说明:
1、异地备份服务器正常安装好单机,不执行root.sh,不启动服务
2、异地备份服务器备份执行目录需要与源端数据节点的目录一致!
3、异地存放备份文件路径/home/kingbase/kbbr_repo,数据节点也需要存在此路径,执行init初始化操作后数据节点同路径下会产生sys_rman.conf配置文件,但备份文件会生成在异地路径下!   

一、配置异地备份服务器
1、安装单机时目录需要与数据节点目录一致
2、与数据库节点之间配置免密
kingbase用户执行
ssh-keygen -t rsa
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub 114.13
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub root@192.168.114.13

二、配置数据节点
1、修改配置文件kingbase.conf中参数:
    archive_mode=on
archive_command=’’
2、重启数据库
sys_ctl restart -D /home/kingbase/KingbaseES/V8/data

三、配置物理备份
1、修改物理备份配置文件
vi /home/kingbase/KingbaseES/V8/Server/bin/sys_backup.conf
# target db style enum:  single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.114.13"              --数据节点ip
# local repo IP, can be same as one_db_ip, means repo located in one db node
_repo_ip="192.168.114.20"               --备份节点ip,指异地备份服务器ip
# label of this cluster
_stanza_name="kingbase"
# OS user name of database 
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/home/kingbase/kbbr_repo"     --存放备份文件及备份配置文件路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5              --全量备份文件保留五次
# count of days, interval to do FULL-backup
_crond_full_days=7                     --7天备份一次全量
# count of days, interval to do DIFF-backup
_crond_diff_days=0                    --不做差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1                    --每天增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2                    --每天凌晨两点做全备
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4                    --每天凌晨四点做增量备
# OS cmd define
_os_ip_cmd="/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single 
_single_data_dir="/home/kingbase/KingbaseES/V8/data" 
# bin dir of single
_single_bin_dir="/home/kingbase/KingbaseES/V8/Server/bin"   
# database user of single
_single_db_user="system"  
# database port of single
_single_db_port="54321"  
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh init    
——执行后会在备份文件路径 /home/kingbase/kbbr_repo 创建文件夹、文件、配置文件等,并备份一次全量数据。
3、执行sys_backup.sh start添加定时任务
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh start    
——执行后会在定时任务中添加备份任务
4、查看定时任务
cat /etc/cron.d/KINGBASECRON
rman集群本地备份操作步骤(一主一备+本地备份 推荐配置)
一、配置主机物理备份
1、修改主机物理备份配置文件
vi /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/sys_backup.conf
# target db style enum:  single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.114.20"            --主机物理IP
# local repo IP, inner-REPO, must be same as one_db_ip, means repo located in one db node
# outer repo IP, outer-REPO, means repo located in outer node
_repo_ip="192.168.114.20"                --主机物理IP,与_one_db_ip相同
# label of this cluster
_stanza_name="kingbase"
# OS user name of database
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/home/kingbase/kbbr_repo"    --备份路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5            --全量备份文件保留5份
# count of days, interval to do FULL-backup
_crond_full_days=7                        --一周一次全量备份
# count of days, interval to do DIFF-backup
_crond_diff_days=0                    --不做差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1                    --一天一次增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2                    --每天凌晨两点做全量备份
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4                    --每天凌晨四点做增量备份
# OS cmd define
_os_ip_cmd="/usr/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/home/kingbase/cluster/test/KingbaseCluster/kingbase/data/"
# bin dir of single
_single_bin_dir="/home/kingbase/cluster/test/KingbaseCluster/kingbase/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/
./sys_backup.sh init    
——执行后会在备份文件路径 /home/kingbase/kbbr_repo 创建文件夹、文件、配置文件等,并备份一次全量数据。
3、执行sys_backup.sh start添加定时任务
cd /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/
./sys_backup.sh start    
——执行后会在定时任务中添加备份任务
4、查看定时任务
cat /etc/cron.d/KINGBASECRON
二、配置备机物理备份
说明:此节点不会进行备份,如下操作只是为切机准备好备份配置;
如果为新装机器,可直接将备机升为主机,重复主机操作,完成备份后再切回

1、修改备机物理备份配置文件
vi /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/sys_backup.conf
# target db style enum:  single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.114.21"            --备机物理IP
# local repo IP, inner-REPO, must be same as one_db_ip, means repo located in one db node
# outer repo IP, outer-REPO, means repo located in outer node
_repo_ip="192.168.114.21"                --备机物理IP,与_one_db_ip相同
# label of this cluster
_stanza_name="kingbase"
# OS user name of database
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/home/kingbase/kbbr_repo"    --备份路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5            --全量备份文件保留5份
# count of days, interval to do FULL-backup
_crond_full_days=7                        --一周一次全量备份
# count of days, interval to do DIFF-backup
_crond_diff_days=0                    --不做差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1                    --一天一次增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2                    --每天凌晨两点做全量备份
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4                    --每天凌晨四点做增量备份
# OS cmd define
_os_ip_cmd="/usr/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/home/kingbase/cluster/test/KingbaseCluster/kingbase/data/"
# bin dir of single
_single_bin_dir="/home/kingbase/cluster/test/KingbaseCluster/kingbase/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/
./sys_backup.sh init    
——提示ERROR: create stanza failed
3、手动执行stanza-create
(1)修改sys_rman.conf(备份路径下的配置文件)
vi /home/kingbase/kbbr_repo/sys_rman.conf
[kingbase]
kb1-host=192.168.114.21    --主机节点IP
kb1-host-user=kingbase        --执行备份操作的OS用户
——在[kingbase]模块下添加以上两行配置
(2)执行stanza-create动作
cd /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/
./sys_rman --config=/home/kingbase/kbbr_repo/sys_rman.conf --stanza=kingbase --log-level-console=info stanza-create
4、添加定时任务
(1)注释或删除以上sys_rman.conf文件添加的两行内容(备份路径下的配置文件)
vi /home/kingbase/kbbr_repo/sys_rman.conf
[kingbase]
#kb1-host=192.168.114.21    --主机节点IP
#kb1-host-user=kingbase    --执行备份操作的OS用户
(2)执行sys_backup.sh start添加定时任务
cd /home/kingbase/cluster/test/KingbaseCluster/kingbase/bin/
./sys_backup.sh start

rman集群异地备份操作步骤(一主一备+异地备份)
说明:
1、异地备份服务器正常安装好单机,不执行root.sh,不启动服务
2、异地备份服务器备份执行目录需要与源端数据节点的目录一致!
3、_repo_path="/data/kdb_backup"异地存放备份文件路径/data/kdb_backup,数据节点也需要存在此路径,执行init初始化操作后数据节点同路径下会产生sys_rman.conf配置文件,但备份文件会生成在异地路径下!    
  
一、配置异地备份服务器
1、新建目录需与集群安装目录相同
mkdir -p /home/kingbase/cluster/R611/cluster/kingbase
2、将异地单机数据库KingbaseES/Server目录下的bin、lib、share移动到新建好的集群目录下
cd /home/kingbase/KingbaseES/Server
cp -r bin lib share /home/kingbase/cluster/R611/cluster/kingbase/
3、与数据库节点之间配置免密
kingbase用户执行
ssh-keygen -t rsa
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub kingbase@192.168.80.54
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub root@192.168.80.54
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub kingbase@192.168.80.55
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub root@192.168.80.55

二、配置物理备份
1、修改物理备份配置文件
vi /home/kingbase/cluster/R611/cluster/kingbase/bin/sys_backup.conf
# target db style enum:  single/cluster
_target_db_style="cluster"       --single改为cluster
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.80.55"      --任一数据节点ip
# local repo IP, can be same as one_db_ip, means repo located in one db node
_repo_ip="192.168.80.11"       --备份节点ip,指异地备份服务器ip
# label of this cluster
_stanza_name="kingbase"
# OS user name of database 
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/data/kdb_backup"     --存放备份文件及备份配置文件路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5      --全量备份文件保留五次
# count of days, interval to do FULL-backup
_crond_full_days=7             --7天备份一次全量
# count of days, interval to do DIFF-backup
_crond_diff_days=0            --不做差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1            --每天增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2            --每天凌晨两点做全备
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4            --每天凌晨四点做增量备
# OS cmd define
_os_ip_cmd="/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single 
_single_data_dir="/home/kingbase/cluster/R611/cluster/kingbase/data" 
# bin dir of single
_single_bin_dir="/home/kingbase/cluster/R611/cluster/kingbase/bin"   
# database user of single
_single_db_user="system"  
# database port of single
_single_db_port="54321"  
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/cluster/R611/cluster/kingbase/bin
sys_backup.sh init
——执行后会在备份文件路径 /data/kdb_backup 创建文件夹、文件、配置文件等,并备份一次全量数据。
3、执行sys_backup.sh start添加定时任务
cd /home/kingbase/cluster/R611/cluster/kingbase/bin
sys_backup.sh start
——执行后会在定时任务中添加备份任务
4、查看cat /etc/cron.d/KINGBASECRON(定时任务)
添加成功的全量备份定时任务:
0 2 */7 * * kingbase /home/kingbase/cluster/R611/cluster/kingbase/bin/sys_rman --config=/data/kdb_backup/sys_rman.conf --stanza=kingbase --archive-copy --type=full backup >>/tmp/sys_rman_backup_full.log 2>&1
添加成功的增量备份定时任务:
0 4 */1 * * kingbase /home/kingbase/cluster/R611/cluster/kingbase/bin/sys_rman --config=/data/kdb_backup/sys_rman.conf --stanza=kingbase --archive-copy --type=incr backup >>/tmp/sys_rman_backup_incr.log 2>&1

```

8.Kingbase . Conf 配置

数据库安装完毕之后,还需对 data 目录下的 kingbase. Conf 文件进行标准配置,以下参数追加在最后即可,重启数据库生效。

# 带注释项,需要手动修改
vi /dbata/data/kingbase.conf

listen_addresses='*'
port=54321
max_connections=1000
work_mem =10MB
maintenance_work_mem=1GB
max_locks_per_transaction=1024
max_wal_size=64GB
checkpoint_timeout=20min
checkpoint_completion_target=0.9
shared_buffers=RAM*0.25GB         #RAM指内存,最大设置为64GB  需手工改
effective_cache_size=RAM*0.5GB    #RAM指内存(free -g)   需手工改

# 客户明确说明数据不重要不需要物理备份时,以下三个参数可不配置
wal_level=replica   #   需手工改
archive_mode=on     #   需手工改
archive_command=''  #   需手工改

logging_collector=on
log_destination='stderr'
log_directory='sys_log'
log_filename='kingbase-%d.log'   #日志保留一个月
log_truncate_on_rotation=on
log_rotation_age=1440
log_connections=on
log_disconnections=on
log_statement='ddl'
log_checkpoints=on
log_lock_waits=on
log_autovacuum_min_duration=0
log_temp_files=0
lc_messages='C'
log_min_duration_statement=1000
log_line_prefix='%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h'

# 与oracle兼容参数开关,根据现场实际情况配置
# ora_forbid_func_polymorphism = off
# ora_statement_level_rollback = off
# ora_input_emptystr_isnull=on
# ora_numop_style=off
# ora_open_cursors=300

# 其他可选参数:
# 默认关闭并行计算, 数据库优化时可以考虑打开,数值根据情况调整
max_parallel_workers_per_gather=0
# 用于管理断开的连接
tcp_keepalives_idle=1200
tcp_keepalives_count=3
tcp_keepalives_interval=30

```

 9.安装完整性检查


 9.1查看安装日志,确认没有错误记录;
 9.2安装用户下查看应用程序菜单
是否安装了 KingabseES V 8 菜单项,结构如下:
控制台工具
逻辑同步工具
数据库部署工具
数据库对象管理工具
数据迁移工具
卸载
9.3查看进程
ps -ef | grep kingbase
注:(红框内为主进程)

9.4验证数据库对象管理工具能否正常连接;

打开工具,关闭欢迎界面,点击连接,输入相关信息。点击检查,成功之后点击确定。

 10.完结,收工!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小小滴泥瓦匠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值