一、金仓数据库搭建(单机)
系列导航
金仓数据库文档写的没有达梦数据库写的清晰不过也还可以,比看英文版的还是好得多,国产数据库逐渐崛起今后必定赶超国外的数据库。该安装文档使用命令行式的安装方法。服务端是linux,客户端是windows
注:官网上的是中文的安装交互界面,我实际安装时英文的估计哪里语言选错了。
一、查看系统信息
#获取系统位数
[root@minio3 kdb]$ getconf LONG_BIT
64
[root @minio3 kdb]$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
#查询系统名称
[root @minio3 kdb]$ uname -a
Linux minio3 3.10.0-1160.6.1.el7.x86_64 #1 SMP Tue Nov 17 13:59:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
二、创建安装用户
1. 创建安装用户 kingbase。
useradd kingbase
2. 初始化用户密码。
passwd kingbase
注:密码为kingbase
3、创建目录
切换用户
[root@minio2 ~]# su kingbase
创建数据库安装目录
[kingbase@minio3 ~]$ pwd
/home/kingbase
[kingbase@minio3 ~]$ ls
[kingbase@minio3 ~]$ mkdir KingbaseES
[kingbase@minio3 ~]$ cd KingbaseES/
[kingbase@minio3 KingbaseES]$ ls
[kingbase@minio3 KingbaseES]$ mkdir V8
[kingbase@minio3 V8]$ pwd
/home/kingbase/KingbaseES/V8
4. 创建数据库文件路径。
cd /home/kingbase
mkdir kdb
三、安装包
1、上传KingbaseES_V008R006C004B0021_Lin64_single_install.iso和license_7206到
/home/kingbase
注:安装包获取方式(免费):
(1)登录-注册:http://resources.kittytiger.cn/
(2)签到获取积分
(3)搜索:金仓linux下安装包 KingbaseES_V008R006C004B0021_Lin64_single_install.iso
2、挂载iso文件
Root用户执行
[root@minio3 kingbase]# chown -R kingbase:kingbase KingbaseES_V008R006C004B0021_Lin64_single_install.iso
[root@minio3 kingbase]# chown -R kingbase:kingbase license_7206
[root@minio3 ~]# mkdir /mnt/cdrom
[root@minio3 kingbase]# sudo mount -o loop KingbaseES_V008R006C004B0021_Lin64_single_install.iso /mnt/cdrom
mount: /dev/loop0 is write-protected, mounting read-only
四、安装过程
[kingbase@minio3 ~]$ cd /mnt/cdrom
[kingbase@minio3 cdrom]$ ls
setup setup.sh
[kingbase@minio3 cdrom]$ sh setup.sh -i console
Now launch installer...
tee: .installer.log: Read-only file system
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...
Verifying JVM........
Launching installer...
===============================================================================
KingbaseES V8 (created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
===============================================================================
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
Installer Version: V008R006B1022 Build
Kingbase Inc.
http://www.kingbase.com.cn
PRESS <ENTER> TO CONTINUE:
===============================================================================
License Agreement
-----------------
Installation and Use of KingbaseES V8 Requires Acceptance of the Following
License Agreement:
........一路回车........
DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): y^H
===============================================================================
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
===============================================================================
Choose License File
-------------------
File Path: /home/kingbase/license_7206/license_7206_0.dat
License序列号 --- 启用 --- 15E99E1A-C81A-11EB-AE8E-000C29CBE49F
生产日期 --- 启用 --- 2021-06-08
产品名称 --- 启用 --- KingbaseES V8
细分版本模板名 --- 启用 --- SALES-企业版 V8R6
产品版本号 --- 启用 --- V008R006C
浮动基准日期 ------ 启用
有效期间 --- 启用 --- 90
用户名称 --- 启用 --- 官方网站90天试用授权
项目名称 --- 启用 --- 官方网站90天试用授权
CPU检查 --- 启用 --- 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
===============================================================================
Choose Install Folder
---------------------
Where would you like to install?
Default Install Folder: /opt/Kingbase/ES/V8
You do not have write permissions to the chosen installation destination.
Please choose a different location for installation
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
===============================================================================
Please Wait
-----------
Pre-Installation Summary
------------------------
Please Review the Following Before Continuing:
Product Name:
KingbaseES V8
Install Folder:
/home/kingbase/KingbaseES/V8
Product Features:
SERVER,
HELP,
MANAGER,
DTS,
INTERFACE,
CLIENTTOOLS
Disk space information
Required Space:696M Available Space:1264645M
PRESS <ENTER> TO CONTINUE:
===============================================================================
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:
===============================================================================
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):
===============================================================================
Please Wait
-----------
===============================================================================
Port
----
Port (Default: 54321):
===============================================================================
User
----
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
---------------
->1- UTF8
2- GBK
3- GB18030
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1
===============================================================================
Database_Mode
-------------
1- PG
->2- ORACLE
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 2
===============================================================================
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/Scripts/root.sh
PRESS <ENTER> TO EXIT THE INSTALLER:
cat: .installer.log: No such file or directory
Complete.
切换到root用户
root@minio3 KingbaseES]# cd /home/kingbase/KingbaseES/V8/Scripts/
[root@minio3 Scripts]# ls
consoleCloud-uninstall.sh initcluster.sh javatools.sh mkln.sh root.sh rootuninstall.sh startupcfg.sh
[root@minio3 Scripts]# sh root.sh
Starting KingbaseES V8:
waiting for server to start.... done
server started
KingbaseES V8 started successfully
注:system用户的密码设置成为了system
五、启动数据库
cd /home/kingbase/KingbaseES/V8/Server/bin
前台启动数据库
$ kingbase -D /home/kingbase/KingbaseES/V8/data
后台启动数据库
$ /home/kingbase/KingbaseES/V8/Server/bin/sys_ctl start -l logfile -D /home/kingbase/KingbaseES/V8/data
后台查看数据状态
$ /home/kingbase/KingbaseES/V8/Server/bin/sys_ctl status -l logfile -D /home/kingbase/KingbaseES/V8/data
关闭数据库
$ /home/kingbase/KingbaseES/V8/Server/bin/sys_ctl stop -l logfile -D /home/kingbase/KingbaseES/V8/data
六、使用
安装windows客户端,使用客户端管理工具
1、创建数据库demo
CREATE DATABASE demo TEMPLATE template0;
2、创建用户
CREATE user joe PASSWORD 'joe' SUPERUSER;
3、创建表空间
CREATE TABLESPACE space1 LOCATION '/ssd1/kingbase/data';
4、创建表
使用joe用户登录数据库后创建
CREATE TABLE my_first_table(
first_column TEXT,
second_column INTEGER
) TABLESPACE fastspace;
资源丰富的的网盘资源:网盘资源大全! 推荐一个适合零基础学习SQL的网站:不用安装数据库,在线轻松学习SQL!