GaussDB_T 单机版轻量安装
1、GaussDB T 软件安装目录存储空间不足导致安装失败,存储空间最少要求20GB。在安装完成,会在omm用户配置文件.bashrc添加4个环境变量。具体安装过程说明,下面日志表示安装成功。表2 zengine.ini配置表。表1 install安装参数说明。
GaussDB 100单机部署的总体架构如上图,DM、CM、ETCD在单机部署中是非必要组件,因此不部署,DN节点规划如下:
注:数据目录需要>=20GB,如果要减小,需要修改install.py和create_database.sample.sql。
安装环境,CentOS 7.9
内存 8G
硬盘 256G SSD
1) 更新操作系统
yum -y update
2) 安装相应软件
# yum install -y zlib readline python python-devel perl-ExtUtils-Embed readline-devel zlib-devel lsof expect mlocate openssl-devel sqlite-devel bzip2-devel libffi libffi-devel gcc gcc-c++ ntp ntp-date
3)修改内核参数,注意,内存小于4G会报各种错误
# cat <<EOF >> /etc/sysctl.conf
kernel.sem = 50100 128256000 50100 2560
net.core.netdev_max_backlog = 1000
net.ipv4.tcp_max_syn_backlog = 2048
kernel.core_pattern = /tmp/core.%p.%e
kernel.core_uses_pid = 1
kernel.shmmni = 4096
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
EOF
# sysctl -p
echo "ulimit -c unlimited" >> /etc/profile
4) 准备目录 ,上传第三个文件到服务器,并解压
# tar zxf GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
5)创建用户及组,omm组类似oracle中的oracle用户
# groupadd dbgrp
# useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
# echo redhat|passwd --stdin omm
Changing password for user omm.
passwd: all authentication tokens updated successfully.
6)到解压的目录下,直接安装,但是会报操作系统错误,
python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C DATA_BUFFER_SIZE=256M -C SHARED_POOL_SIZE=128M -C LOG_BUFFER_SIZE=64M -C TEMP_BUFFER_SIZE=128M -C LSNR_ADDR=0.0.0.0 -C LSNR_PORT=1888
修改install.py,如下,把572,573行注释掉。不同版本可能要自己看下
572 #if self.run_pkg_name.find(distname.upper().replace("OS", "")) == -1:
573 # logExit("Run package %s.tar.gz is inconsistent with os system %s." % (self.run_pkg_name, distname))
7)到系统中看看系统是否起来
# su - omm
$ zsql sys/Changeme_123@127.0.0.1:1888
Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.
SQL>
/gdb/software/gaussdb/python-3.9.2/bin
[root@gdb bin]# ln -s /gdb/software/gaussdb/python-3.9.2/bin/python3 /usr/bin/python3
[root@gdb python-3.9.2]# ls
bin include lib share
[root@gdb python-3.9.2]# cd ../
[root@gdb gaussdb]# ls
GaussDB-install-Package-bak.tar GaussDB_T_1.2.1-CLIENT-JDBC.tar GaussDB_T_1.2.1-CM-CENTOS-64bit.tar GaussDB_T_1.2.1-TOOLS.tar python-3.9.2.tar
GaussDB_T_1.2.1-CENTOS7.9-X86.tar GaussDB_T_1.2.1-CLIENT-ODBC-CENTOS-64bit.tar GaussDB_T_1.2.1-DATABASE-CENTOS-64bit GaussDB_T_1.2.1-ZSQL-CENTOS-64bit.tar
GaussDB_T_1.2.1-CLIENT-C-CENTOS-64bit.tar GaussDB_T_1.2.1-CLIENT-PYTHON3-CENTOS-64bit.tar GaussDB_T_1.2.1-DATABASE-CENTOS-64bit.tar jdk-8u302-linux-x64.tar
GaussDB_T_1.2.1-CLIENT-GO.tar GaussDB_T_1.2.1-CLUSTER-CENTOS-64bit.tar GaussDB_T_1.2.1-ROACH-CENTOS-64bit.tar python-3.9.2
[root@gdb gaussdb]# cd *t
[root@gdb GaussDB_T_1.2.1-DATABASE-CENTOS-64bit]# ls
funclib.py GaussDB_T_1.2.1-RUN-CENTOS-64bit.sha256 GaussDB_T_1.2.1-RUN-CENTOS-64bit.tar.gz install.py sshexkey.py upgrade.py
[root@gdb GaussDB_T_1.2.1-DATABASE-CENTOS-64bit]# python3 install.py -U omm:dbgrp -R /gdb/gaussdb/app -D /gdb/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.1.70 -C LSNR_PORT=1888
Checking runner.
Checking parameters.
End check parameters.
Checking old install.
End check old install.
Checking kernel parameters.
Please enter database password of user [SYS]:
Password:
Please enter database password of user [SYS] again:
Password:
Checking directory.
Checking integrality of run file...
Decompressing run file.
Setting user env.
Checking data dir and config file
Initialize db instance.
Please enter password of REPL_AUTH keys:
Password:
Please enter password of REPL_AUTH keys again:
Password:
Generate REPL_AUTH keys.
Creating database.
Creating database succeed.
Open ssl connection.
Open ssl connection successfully.
Changing file permission due to security audit.
Install successfully, for more detail information see /home/omm/zengineinstall.log.
[root@gdb GaussDB_T_1.2.1-DATABASE-CENTOS-64bit]#
一、创建安装用户和用户组
groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
passwd omm
说明:设置omm用户密码
二、上传GaussDB 100安装包,并解压
1.创建安装包目录
mkdir -p /gdb/software/gaussdb
2.通过FTP工具上传安装包到此目录
lcd "D:\Open Source DB\GaussDB100"
put GaussDB_100_1.0.0-DATABASE-REDHAT-64bit.tar.gz
3.解压
cd /gdb/software/gaussdb
tar -xvf GaussDB_100_1.0.0-DATABASE-REDHAT-64bit.tar.gz
三、进入安装包解压目录,执行install.py脚本进行安装
cd /gdb/software/gaussdb/GaussDB_100_1.0.0-DATABASE-REDHAT-64bit
python install.py -U omm:dbgrp -R /gdb/gaussdb/app -D /gdb/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.56.16 -C LSNR_PORT=1888
具体安装过程说明,下面日志表示安装成功。
[root@edumysql GaussDB_100_1.0.0-DATABASE-REDHAT-64bit]# python install.py -U omm:dbgrp -R /gdb/gaussdb/app -D /gdb/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.56.16 -C LSNR_PORT=1888
Checking runner.
Checking parameters.
End check parameters.
Checking user.
End check user.
Checking old install.
End check old install.
Checking kernel parameters.
Checking directory.
Checking integrality of run file...
Decompressing run file.
Setting user env.
Checking data dir and config file
Initialize db instance.
Creating database.
Creating database succeed.
Changing file permission due to security audit.
Install successfully, for more detail information see /home/omm/zengineinstall.log.
表1 install安装参数说明
参数 | 说明 |
---|---|
-U | 指定安装用户和用户组。 |
-R | 指定安装目录。 |
-D | 指定数据文件目录,即GAUSSDATA目录。 |
-C | 指定配置参数,可以指定多个。如果不指定,则按照/opt/gaussdb/data/cfg/zengine.ini中的默认配置项。 |
-P | 在安装时,如果禁用免密登录,则需要在命令行最后指定此选项。命令行执行过程中,会提示输入连接数据库的用户名和密码,用户名是SYS,密码是SYS用户的出厂密码Changeme_123。如果开启免密登录则不需要指定本选项。 |
表2 zengine.ini配置表
名称 | 说明 | 取值范围 | 默认值 | 优化配置 |
---|---|---|---|---|
TEMP_BUFFER_SIZE | Temp buffer的大小 | 整数,[32M,21T],单位为字节 | 32M | 1G |
DATA_BUFFER_SIZE | 用于缓存最近访问的数据的,数据BUFFER区的大小 | 整数,[64M,32T],单位为字节 | 128M | 2G |
SHARED_POOL_SIZE | Shared Pool的大小 | 整数,[82M,32T],单位为字节 | 128M | 1G |
LOG_BUFFER_SIZE | Log buffer的大小。Log buffer用于缓存Redo日志 | 整数,[1M,128M],单位为字节 | 4M | 64M |
DBWR_PROCESSES | 后台写脏页面线程的个数,提高数值可以提高并发效率,但也会消耗较多资源 | 整型,(0,36] | 1 | 8 |
LOG_BUFFER_COUNT | Log buffer的数量 | 整型,(0,16] | 4 | 8 |
SESSIONS | 最大并发SESSION数 | 整型,[52,8192] | 200 | 1500 |
INSTANCE_NAME | 实例名称 | 字符串 | zenith | |
LSNR_ADDR | 侦听的服务器IPV4地址 | IP地址 | 127.0.0.1 | |
LSNR_PORT | 服务侦听的端口号 | 整型,[1024,65535] | 1611 | |
ENABLE_SYSDBA_LOGIN | 设置sysdba是否支持免密登录 | TRUE/FALSE | TRUE | |
CONTROL_FILES | 该参数记录控制文件的路径 | 字符串 |
安装完成后,本虚拟机zengine.ini配置如下:
[omm@edumysql gdb]$ cat /gdb/gaussdb/data/cfg/zengine.ini
TEMP_BUFFER_SIZE = 1G
DATA_BUFFER_SIZE = 2G
SHARED_POOL_SIZE = 1G
LOG_BUFFER_SIZE = 64M
DBWR_PROCESSES = 8
LOG_BUFFER_COUNT = 8
SESSIONS = 1500
INSTANCE_NAME = zenith
LSNR_ADDR = 127.0.0.1,192.168.56.16
LSNR_PORT = 1888
ENABLE_SYSDBA_LOGIN = TRUE
CONTROL_FILES = (/gdb/gaussdb/data/data/cntl1, /gdb/gaussdb/data/data/cntl2, /gdb/gaussdb/data/data/cntl3)
表3 环境变量
在安装完成,会在omm用户配置文件.bashrc添加4个环境变量
环境变量名称 | 说明 |
---|---|
GSDB_DATA | GaussDB 100数据目录。 |
GSDB_HOME | GaussDB 100安装目录,bin和Lib所在目录。 |
PATH | 数据库内核可执行码路径。 |
LD_LIBRARY_PATH | Library库路径。如果规划数据库备份到NBU(Net Backup,企业级数据管理套件)上,请将NBU的Lib库路径信息配置到环境变量中,默认路径为/usr/openv/lib。 |
安装完成后,本虚拟机.bashrc配置如下:
[omm@edumysql ~]$ cat .bashrc
# User specific aliases and functions
export GSDB_HOME="/gdb/gaussdb/app"
export PATH="/gdb/gaussdb/app/bin":$PATH
export LD_LIBRARY_PATH="/gdb/gaussdb/app/lib":"/gdb/gaussdb/app/add-ons":$LD_LIBRARY_PATH
export GSDB_DATA="/gdb/gaussdb/data"
四、使用omm用户,启动数据库服务
su - omm
cd /gdb/gaussdb/app/bin
python zctl.py -t start
[omm@edumysql ~]$ cd /gdb/gaussdb/app/bin
[omm@edumysql bin]$ python zctl.py -t start
Zengine instance has already started.
五、使用zsql连接数据库
zsql sys/Changeme_123@127.0.0.1:1888
zsql sys/Changeme_123@192.168.56.16:1888
操作如下:
[omm@edumysql bin]$ zsql sys/Changeme_123@127.0.0.1:1888
connected.
SQL>
附录
1、GaussDB T 软件安装目录存储空间不足导致安装失败,存储空间最少要求20GB
[root@edumysql GaussDB_100_1.0.0-DATABASE-REDHAT-64bit]# python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C LSNR_ADDR=127.0.0.1 -C LSNR_PORT=1888
Checking runner.
Checking parameters.
End check parameters.
Checking user.
End check user.
Checking old install.
End check old install.
Checking kernel parameters.
Checking directory.
Checking integrality of run file...
Decompressing run file.
Setting user env.
Checking data dir and config file
Initialize db instance.
Creating database.
Error: Failed to execute sql file /opt/gaussdb/app/admin/scripts/create_database.sample.sql, output:
connected.
SQL>
GS-00028, Write size 1011712, expected size 2097152, mostly because file size is larger than disk, please delete the incomplete file
SQL>
Please refer to install log "/home/omm/zengineinstall.log" for more detailed information.
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)