暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss训练营学习心得-从PG到openGauss

原创 pysql 2021-09-13
1019

自开源软件联盟PostgreSQL分会推广PG数据库以来,我也跟着加入了PG学习的潮流。2019年先后参加了PGCA、PGCE的认证考试,慢慢得开始学习和熟悉PG数据库,也逐步开始关注和PG相关的国产数据库。2019年得知华为发布了openGauss数据库,2020年openGauss也开源了。也打算开始学习一下openGauss。

借训练营的机会,根据之前学习的一些知识,结合训练营彭冲老师-openGauss实践总结,快速体验了一把openGauss数据库

1、先准备环境
CentOS Linux release 7.4.1708 (Core)
3.10.0-693.el7.x86_64
先进行一系列操作系统的配置:包括防火墙、时区、SELinux 、主机映射、关闭swap、优化sysctl.conf网络配置参数、配置时间同步和limits.conf等。这些信息网络和官网上有。就不重复赘述了。主要谢谢我的部署过程,初步体验一把OpenGauss实验环境

2、安装python3.6.x
yum install openssl* -y
yum install python3* -y

检查python3 -V
Python 3.6.8

3、安装依赖包
yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel
yum install -y java-1.8.0-openjdk* psmisc bzip2 python3 python3-devel lksctp*

4、软件包
创建安装包的存放目录
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software

下载openGauss数据库软件
下载地址为:https://opengauss.org/zh/download.html
数据库安装包上传至centos上

5、解压缩安装介质
cd /opt/software/openGauss
tar -zxvf openGauss-2.0.0-CentOS-64bit-all.tar.gz
包含的文件如下:
openGauss-2.0.0-CentOS-64bit-om.sha256
openGauss-2.0.0-CentOS-64bit-om.tar.gz
openGauss-2.0.0-CentOS-64bit.sha256
openGauss-2.0.0-CentOS-64bit.tar.bz2
upgrade_sql.sha256
upgrade_sql.tar.gz

tar -zxvf openGauss-2.0.0-CentOS-64bit-om.tar.gz

6、创建XML文件
模板
cat > clusterconfig.xml<<EOF

    <!--dbnode-->
    <PARAM name="dataNum" value="1"/>
    <PARAM name="dataPortBase" value="26000"/>
    <PARAM name="datanode61" value="/opt/huawei/install/data/dn"/>
        <PARAM name="datanode61_syncNum" value="0"/>
    </DEVICE>
</DEVICELIST>

EOF

7、端口修改

改成26000端口

本次实验的最终配置

[root@node61 script]# cat /opt/software/openGauss/clusterconfig.xml

8、检查环境变量
echo $LD_LIBRARY_PATH

9、安装前进行交互式检查

[root@node61 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting pssh path
Successfully set core path.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password: gauss_8811
Please enter password for cluster user again.
Password: gauss_8811
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster’s path.
Successfully created cluster’s path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by “/opt/software/openGauss/script/gs_checkos -i A -h node61.centos.com --detail”.
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

可以仔细检查一下系统环境
[root@node61 script]# /opt/software/openGauss/script/gs_checkos -i A -h node61.centos.com --detail
Checking items:
A1. [ OS version status ] : Normal
[node61.centos.com]
centos_7.4.1708_64bit

A2. [ Kernel version status ]                               : Normal     
    The names about all kernel versions are same. The value is "3.10.0-693.el7.x86_64".
A3. [ Unicode status ]                                      : Normal     
    The values of all unicode are same. The value is "LANG=en_US.UTF-8".
A4. [ Time zone status ]                                    : Normal     
    The informations about all timezones are same. The value is "+0800".
A5. [ Swap memory status ]                                  : Normal     
    The value about swap memory is correct.            
A6. [ System control parameters status ]                    : Normal     
    All values about system control  parameters are correct.
A7. [ File system configuration status ]                    : Normal     
    Both soft nofile and hard nofile are correct.      
A8. [ Disk configuration status ]                           : Normal     
    The value about XFS mount parameters is correct.   
A9. [ Pre-read block size status ]                          : Normal     
    The value about Logical block size is correct.     
A10.[ IO scheduler status ]                                 : Normal     
    The value of IO scheduler is correct.              
A11.[ Network card configuration status ]                   : Warning    
    [node61.centos.com]

BondMode Null
Warning reason: network ‘ens34’ ‘mtu’ RealValue ‘1500’ ExpectedValue ‘8192’

A12.[ Time consistency status ]                             : Warning    
    [node61.centos.com]
    The NTPD not detected on machine and local time is "2021-09-11 23:51:10".

A13.[ Firewall service status ]                             : Normal     
    The firewall service is stopped.                   
A14.[ THP service status ]                                  : Normal     
    The THP service is stopped.                        

Total numbers:14. Abnormal numbers:0. Warning numbers:2.

有2个告警,由于是实验环境 可以忽略

安装和创建数据库

安装参考
使用root执行如下命令
cd /opt/software/openGauss/script
chmod -R 755 /opt/software/openGauss/script
chown -R omm:dbgrp /opt/software/openGauss/script

使用omm用户安装openGauss DBMS和创建openGauss数据库
su - omm
cd /opt/software/openGauss/script
cp …/clusterconfig.xml .
gs_install -X /opt/software/openGauss/script/clusterconfig.xml

开始执行安装:
[omm@node61 script]$ gs_install -X /opt/software/openGauss/script/clusterconfig.xml

Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy…
Installing the cluster.
begin prepare Install Cluster…
Checking the installation environment on all nodes.
begin install Cluster…
Installing applications on all nodes.
Successfully installed APP.
begin init Instance…
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/gaussdb/install/app/share/sslcert/om
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
Successfully started cluster.
Successfully installed application.
end deploy…

查看数据库的状态:

[omm@node61 script]$ gs_om -t status

cluster_name : dbCluster
cluster_state : Normal
redistributing : No


停止和启动数据库:

[omm@node61 script]$ gs_om -t start
Starting cluster.

[SUCCESS] node61.centos.com:
[2021-09-12 00:01:00.147][18438][][gs_ctl]: gs_ctl started,datadir is /opt/gaussdb/install/data/dn
[2021-09-12 00:01:00.150][18438][][gs_ctl]: another server might be running; Please use the restart command

Successfully started.

结合实验环境和8小时训练营老师的课件讲解,进一步学习和熟悉OpenGauss数据库

最后修改时间:2021-09-13 15:49:17
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论