前几天看了一些Gaussdb的资源后,今天尝试安装一把Gaussdb 100,这里分享一下遇到的问题及解决办法,根据官方文档指导来安装很简单,不过怎么总是按别人设计好的路走呢,人生就得折腾,对吧。
首先,根据提示,创建用户、目录、系统变量等
groupadd dbgrp useradd -g dbgrp -d /home/omm -m -s /bin/bash omm echo "XXXXXXXX"|passwd --stdin omm mkdir -p /opt/software/gaussdb mkdir -p /opt/gaussdb/app mkdir -p /opt/gaussdb/data chown -R omm:dbgrp /opt/software chown -R omm:dbgrp /opt/gaussdb 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= /corefile/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 |
然后,上传介质,解压安装,这里遇到第一个问题,提示操作系统校验不通过,因为我的操作系统的Centos 7.3的,而不是安装介质要求的Redhat 7.5,所以报错了,如下:
su - omm cd /opt/software/gaussdb tar xf GaussDB_100_1.0.0-REDHAT7.5-X86.tar.gz tar -xvf GaussDB_100_1.0.0-DATABASE-REDHAT-64bit.tar.gz cd 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,192.168.126.143 -C LSNR_PORT=1888
[root@mysql3 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,192.168.124.136 -C LSNR_PORT=1888 Error: Run package GaussDB_100_1.0.0-RUN-REDHAT-64bit.tar.gz is inconsistent with os system centos. Please refer to install log "/home/omm/zengineinstall.log" for more detailed information. |
日志提示redhat版本的安装包不能安装在centos系统上,这怎么不行呢,centos就是redhat的社区版嘛,哪个软件不是如果支持redhat就支持centos的。
解决这种报错很简单,就是让安装时的检查通过即可,因为安装使用python脚本安装的,直接编辑安装脚本install.py,找到检查OS的项,设置通过即可。
如下:
if self.run_pkg_name.find(distname.upper().replace("OS", "")) == -1: 修改为 if self.run_pkg_name.find(distname.upper().replace("OS", "")) == -2: |
安装即可顺利通过OS检验。
接着往下走,发现报错无效的IP
[root@mysql3 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,192.168.124.136 -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. Error: The invalid IP is '192.168.124.136'. Please refer to install log "/home/omm/zengineinstall.log" for more detailed information. |
仔细查看,是IP写错了,正确的IP是192.168.126.143
修改安装命令后继续往下走,又出现一个报错,提示无法获取实例进程ID,如下
tail -4 /home/omm/zengineinstall.log [2019-10-30 15:42:16] End clean user environment variables... [2019-10-30 15:42:16] Roll back: profile is updated [2019-10-30 15:42:16] End roll back [2019-10-30 15:42:16] Error: Can not get instance '/opt/gaussdb/data' process pid,The detailed information: 'instance startup failed ' |
因为报错的设计一个目录,赶紧查看该目录情况,发现目录不存在,可是之前明明创建过该目录的,重新创建后再次尝试安装,还是一样的报错。
查看完整的日志,发现前面有一步实例启动失败的报错,报错后会回退安装,因此也会删除/opt/Gaussdb/data目录,日志如下:
[2019-10-30 15:50:02] Initialize db instance. [2019-10-30 15:50:02] config Parameters is empty, so just return. [2019-10-30 15:50:02] Successfully Initialize zenith instance. [2019-10-30 15:50:02] Creating database. [2019-10-30 15:50:02] rm the backup log of zengine /opt/gaussdb/log [2019-10-30 15:50:05] Instance start log output:starting instance(nomount) instance startup failed . [2019-10-30 15:50:05] Begin roll back... [2019-10-30 15:50:05] Roll back type: 5 [2019-10-30 15:50:05] Using user profile: /home/omm/.bashrc [2019-10-30 15:50:05] Begin to backup log cmd: cp -r /opt/gaussdb/data/log /opt/gaussdb/log [2019-10-30 15:50:05] Error:The detail log for CREATE_DB_FAILED: /opt/gaussdb/log [2019-10-30 15:50:05] kill process cmd: su - omm -c "proc_pid_list=\`ps ux | grep /opt/gaussdb/data$ | grep -v grep | awk '{print \$2}'\` && (if [ X\"\$proc_pid_list\" != X\"\" ]; then echo \"\$proc_pid_list\" | xargs kill -9 ; exit 0; fi)" [2019-10-30 15:50:05] Roll back: process killed. [2019-10-30 15:50:05] Roll back: remove /opt/gaussdb/app [2019-10-30 15:50:05] Roll back: remove /opt/gaussdb/data ... [2019-10-30 15:50:05] Roll back: profile is updated [2019-10-30 15:50:05] End roll back [2019-10-30 15:50:05] Error: Can not get instance '/opt/gaussdb/data' process pid,The detailed information: 'instance startup failed ' |
报错的根因是启动实例失败,然后回退了安装,因此需要检查实例启动失败的原因。
根据日志提示,详细的日志被移动到了/opt/Gaussdb/log目录,在该目录下的run目录,有一个日志文件,详细记录了实例启动失败的原因,是内存不足,如下:
[root@mysql3 run]# cat zengine.rlog UTC+8 2019-10-30 15:50:02.520|ZENGINE|00000|9676|INFO>[LOG] file '/opt/gaussdb/data/log/zenith_alarm.log' is added [srv_param.c:488] UTC+8 2019-10-30 15:50:02.520|ZENGINE|00000|9676|INFO>[LOG] file '/opt/gaussdb/data/log/run/zengine.rlog' is added [cm_log.c:643] UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] LSNR_ADDR = 127.0.0.1,192.168.126.143 UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] LSNR_PORT = 1888 UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] DATA_BUFFER_SIZE = 2G UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] SHARED_POOL_SIZE = 1G UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] LOG_BUFFER_SIZE = 64M UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] LOG_BUFFER_COUNT = 8 UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] TEMP_BUFFER_SIZE = 1G UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] SESSIONS = 1500 UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] DBWR_PROCESSES = 8 UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] INSTANCE_NAME = zenith UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|9676|INFO>[PARAM] ENABLE_SYSDBA_LOGIN = TRUE UTC+8 2019-10-30 15:50:02.531|ZENGINE|00000|206158439884|INFO>starting instance(nomount) UTC+8 2019-10-30 15:50:02.533|ZENGINE|00000|9676|ERROR>GS-00001 : Failed to allocate 4592381952 bytes for sga [srv_sga.c:170] UTC+8 2019-10-30 15:50:02.533|ZENGINE|00000|9676|ERROR>failed to create sga UTC+8 2019-10-30 15:50:02.533|ZENGINE|00000|9676|ERROR>Instance Startup Failed
|
日志提示,实例启动必须要4G内存,而我的虚拟机才分配了2G内存,肯定不够用,没办法,只能调整实例启动的内存大小。
找了一圈,安装模板中没有配置内存大小的参数,原来内存大小是在安装的命令中直接指定的,需要用-C选项指定4个参数,注意每个参数前面都要加-C选项,如下:
[root@mysql3 GaussDB_100_1.0.0-DATABASE-REDHAT-64bit]# 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=127.0.0.1,192.168.126.143 -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. |
至此,Gaussdb 100单机版安装完成,可以通过zsql登陆到数据库进行使用了,默认SYS密码是Changeme_2015