KingbaseES 命令行安装数据库
关键字:
KingbaseES、Linux、x86-64
一、安装前环境准备
1、硬件环境支持
` 金仓数据库管理系统KingbaseES支持X86、X86_64,同时支持龙芯、飞腾等国产CPU硬件体系结构。 `
2、软件环境支持
`金仓数据库管理系统KingbaseES支持各种主流的Linux操作系统32位及64位发行版本。 `
3、依赖包准备
1)准备需要安装的金仓数据库管理系统KingbaseES安装程序和jdk1.8及以上的jdk环境。
2)图形化环境准备
3)安装桌面组件包
yum -y groupinstall “GNOME Desktop”
yum -y groupinstall “X Window System”
4、创建数据库安装用户
[root@node2 ~]# id kingbase
uid=1001(kingbase) gid=1001(kingbase) groups=1001(kingbase)
5、创建安装目录和数据存储目录
1)软件安装目录(默认KingbaseES数据库软件安装目录)
[root@node1 ~]# mkdir -p /opt/Kingbase/ES/V8
[root@node1 ~]# chown -R kingbase.kingbase /opt/Kingbase/ES/V8
2)数据存储目录(建议将目录创建到独立的磁盘空间)
[root@node1 ~]# mkdir -p /data/kingbase/v8/data
[root@node1 ~]# chown -R kingbase.kingbase /data/kingbase/v8/data
6、内核参数配置
` [root@node1 ~]# cat /etc/sysctl.conf `
===以上内容仅供参考,根据业务环境进行配置;配置相关参数后,执行sysctl -p使参数设置生效===
[root@node1 ~]#sysctl -p
7、配置资源配额
===以下内容仅供参考,根据业务环境进行配置。===
[root@node1 ~]# cat /etc/security/limits.conf
二、命令行安装
** 1)查看数据库软件包和license文件**
[root@node1 v8r6]# ls -lh
total 789M
-rw-r--r-- 1 tom tom 789M Mar 1 17:53 KingbaseES_V008R006C004B0021_Lin64_single_install.iso
-rw-r--r-- 1 root root 2.9K Mar 1 17:57 license.dat
** 2)mount 安装包到指定目录**
[root@node1 v8r6]# mount -o loop KingbaseES_V008R006C004B0021_Lin64_single_install.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only
[root@node1 v8r6]# ls -lh /mnt
total 6.0K
dr-xr-xr-x 2 root root 2.0K Jul 22 2021 setup
-r-xr-xr-x 1 root root 3.8K Jul 22 2021 setup.sh
** 3)切换到kingbase用户执行安装**
<center> 图2-3 选择license文件(文件合法并且能被kingbase用户访问)</center>
三、启动数据库服务测试
** 1、查看数据存储目录**
[root@node1 ~]# su - kingbase
Last login: Mon Mar 1 18:00:48 CST 2021 on pts/2
[kingbase@node1 ~]$ cd /data/kingbase/v8/data/
[kingbase@node1 data]$ ls -lh
total 52K
drwx------ 6 kingbase kingbase 50 Mar 1 2021 base
drwx------ 2 kingbase kingbase 4.0K Mar 1 2021 global
-rw------- 1 kingbase kingbase 88 Mar 1 2021 kingbase.auto.conf
-rw------- 1 kingbase kingbase 27K Mar 1 2021 kingbase.conf
drwx------ 3 kingbase kingbase 18 Mar 1 2021 sys_aud
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_bulkload
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_commit_ts
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_dynshmem
-rw------- 1 kingbase kingbase 4.6K Mar 1 2021 sys_hba.conf
-rw------- 1 kingbase kingbase 1.6K Mar 1 2021 sys_ident.conf
drwxrwxr-x 2 kingbase kingbase 6 Mar 1 2021 sys_log
drwx------ 4 kingbase kingbase 65 Mar 1 2021 sys_logical
drwx------ 4 kingbase kingbase 34 Mar 1 2021 sys_multixact
drwx------ 2 kingbase kingbase 17 Mar 1 2021 sys_notify
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_replslot
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_serial
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_snapshots
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_stat
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_stat_tmp
drwx------ 2 kingbase kingbase 17 Mar 1 2021 sys_subtrans
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_tblspc
drwx------ 2 kingbase kingbase 6 Mar 1 2021 sys_twophase
-rw------- 1 kingbase kingbase 3 Mar 1 2021 SYS_VERSION
drwx------ 3 kingbase kingbase 58 Mar 1 2021 sys_wal
drwx------ 2 kingbase kingbase 17 Mar 1 2021 sys_xact
** 2、启动数据库服务**
3、查看数据库服务进程
4、连接数据库访问测试
[kingbase@node1 bin]$ ./ksql -U system -W test
Password:
ksql (V8.0)
Type "help" for help.
test=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+--------+----------+-------------+-------------+-------------------
security | system | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | system | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/system +
| | | | | system=CTc/system
template1 | system | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/system +
| | | | | system=CTc/system
test | system | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
(4 rows)
test=# create database prod;
CREATE DATABASE
test=# \c prod
Password:
You are now connected to database "prod" as user "system".
prod=# create table t1 (id int,name varchar(10));
CREATE TABLE
prod=# \d t1
Table "public.t1"
Column | Type | Collation | Nullable | Default
--------+----------------------------+-----------+----------+---------
id | integer | | |
name | character varying(10 char) | | |
prod=# insert into t1 values (10,'tom'),(20,'jerry'),(30,'rose');
INSERT 0 3
prod=# select * from t1;
id | name
----+-------
10 | tom
20 | jerry
30 | rose
(3 rows)
四、总结
1、安装前需要准备好相应的软硬件环境,如确定CPU架构类型、Memory及磁盘空间大小等。
2、系统环境需要安装相应的java软件包及基本的图形化软件包。
3、系统配置内核参数和资源管理的相关参数。
4、按照软件安装的提示及业务需求进行安装。
KINGBASE研究院