# 人大金仓-kingbase-es-v8-r6-docker **Repository Path**: gybf8f8f8/kingbase-es-v8-r6-docker ## Basic Information - **Project Name**: 人大金仓-kingbase-es-v8-r6-docker - **Description**: 人大金仓数据库docker镜像构建 - **Primary Language**: 其他 - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 3 - **Created**: 2022-10-01 - **Last Updated**: 2024-11-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 人大金仓-kingbase-es-v8-r6-docker #### 介绍说明 人大金仓数据库docker镜像构建。数据库版本:`KingbaseES_V008R006C006B0021_Lin64_install.iso`。 - docker-entrypoint.sh 初始化数据库的入口。 - Dockerfile 构造镜像文件。 - kingbase.tar.gz 由于文件限制,没有上传。它是由安装后的金仓数据库目录下的`Server`文件的压缩打包而来。命令:`tar -czvf kingbase.tar.gz Server/`。 - license.dat 对应版本的授权证书文件。此版本是开发版。 - password 超级管理员密码。初始化数据库过程中,参数 `--pwfile=${PWD_FILE}`读取密码。`${PWD_FILE}`即`docker-entrypoint.sh`脚本中password文件的路径。 #### 目录结构 ```css $ tree kingbase-es-v8-r6-docker -L 1 kingbase-es-v8-r6-docker ├── docker-entrypoint.sh ├── Dockerfile ├── kingbase.tar.gz ├── license.dat ├── password 1 directory, 5 files ``` #### 环境变量 - `SYSTEM_USER` 超级管理员用户名,默认值`system`。 - `SYSTEM_PWD` 超级管理员密码,默认值`123456`。 - `ENCODING` 选择模板数据库的编码,默认值`UTF8`。可选值:`UTF8`, `GBK`, `GB18030`。 这也将是后来创建的任何数据库的默认编码,除非你覆盖它。 - `DATABASE_MODE` 数据库兼容模式,默认值`ORACLE`。设置 KingbaseES V8.6 初始化时的兼容模式。 默认情况下 (初始化时不设置此参数) 为兼容 Oracle 模式。 支持四种参数值: `pg` , `oracle` , `0` , `1` ;其中 pg 和 0 表示兼容 PostgreSQL 模式, oracle 和 1 表示兼容 Oracle 模式。注意:参数值 pg 和 oracle 不区分大小写。 - `CASE_SENSITIVE` 大小写是否敏感,默认敏感。特别提醒:`不区分大小写只能在oracle模式下启用`。敏感,取值:`YES` 或 `1`;不敏感,取值:`NO` 或 `0`。 - `BLOCK_SIZE` 默认的尺寸为 `8` 千字节。该值必须是 `2` 的整数次幂,并且在 `1` 到 `32` 之 间。这个选项只能在初始化期间设置,并且之后不能更改。 #### 构造镜像 1. git clone https://gitee.com/gybf8f8f8/kingbase-es-v8-r6-docker.git 2. 准备好安装后的金仓数据库目录下Server文件的压缩打包文件 kingbase.tar.gz,命令:`tar -czvf kingbase.tar.gz Server/`。 百度网盘可供下载:https://pan.baidu.com/s/1MGHdg_bGhhvrJk4MyLv_4Q?pwd=r22e 提取码:r22e 3. `cd kingbase-es-v8-r6-docker`,进入目录,把 kingbase.tar.gz 文件复制到该目录下。 4. `docker build -t kingbase:v8r6 .` 运行该命令构建镜像。 #### 运行 ```css docker run --name kingbase -d -p 54321:54321 \ -e SYSTEM_USER=system \ -e SYSTEM_PWD=123456 \ -e ENCODING=UTF8 \ -e DATABASE_MODE=ORACLE \ -e CASE_SENSITIVE=NO \ -e BLOCK_SIZE=8 \ -v /home/kingbase/data:/home/kingbase/data \ -v /home/kingbase/license.dat:/home/kingbase/Server/bin/license.dat \ kingbase:v8r6 ``` - `--name`: 容器名称。 - `-d`: 容器后台运行。 - `-p`: 端口映射。例如:`宿主机端口:容器端口`。 - `-e`: 环境变量。根据实际情况自行修改。 - `-v`:挂载宿主机数据(目录|文件)。例如:`宿主机(目录|文件):容器内(目录|文件)`。 #### 启动日志 ```css If the data directory is not specified, the environment variable KINGBASE_DATA is used. Report bugs to . The files belonging to this database system will be owned by user "kingbase". This user must also own the server process. The database cluster will be initialized with locale "C". The default text search configuration will be set to "english". The comparision of strings is case-insensitive. Data page checksums are disabled. fixing permissions on existing directory /home/kingbase/data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... UTC creating configuration files ... ok Begin setup encrypt device initializing the encrypt device ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok create security database ... ok load security database ... ok syncing data to disk ... ok Success. You can now start the database server using: ./sys_ctl -D /home/kingbase/data -l logfile start initdb: warning: enabling "trust" authentication for local connections You can change this by editing sys_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. waiting for server to start.... done server started 2022-10-02 05:11:15.881 GMT [31] HINT: the value of max_connect is set 10 2022-10-02 05:11:15.882 GMT [31] WARNING: max_connections should be less than or equal than 10 (restricted by license) 2022-10-02 05:11:15.882 GMT [31] HINT: the value of max_connect is set 10 2022-10-02 05:11:15.895 UTC [31] LOG: sepapower extension initialized 2022-10-02 05:11:15.907 UTC [31] LOG: starting KingbaseES V008R006C006B0021 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit 2022-10-02 05:11:15.907 UTC [31] LOG: listening on IPv4 address "0.0.0.0", port 54321 2022-10-02 05:11:15.907 UTC [31] LOG: listening on IPv6 address "::", port 54321 2022-10-02 05:11:15.909 UTC [31] LOG: listening on Unix socket "/tmp/.s.KINGBASE.54321" 2022-10-02 05:11:15.948 UTC [31] LOG: redirecting log output to logging collector process 2022-10-02 05:11:15.948 UTC [31] HINT: Future log output will appear in directory "sys_log". ``` #### 可能出现的问题及解决 1. 问题:case-insensitive should only be enabled in oracle mode ```css 不区分大小写只能在oracle模式下启用。在oracle模式下,CASE_SENSITIVE才能设置为 NO 或 0 ```