安装部署opengauss(单节点,OM方式)

环境:
OS:Centos 7
DB:3.0
Python:3.6.5

 

1.下载安装包
https://opengauss.org/zh/download.html
我这里下载的是:
openGauss-3.0.0-CentOS-64bit-all.tar.gz

将下载安装包上传到服务器/soft/opangauss目录下
[root@localhost opengauss]# ls -1
openGauss-3.0.0-CentOS-64bit-all.tar.gz

[root@localhost opengauss]# tar -xvf openGauss-3.0.0-CentOS-64bit-all.tar.gz
openGauss-3.0.0-CentOS-64bit-cm.tar.gz
openGauss-3.0.0-CentOS-64bit-om.tar.gz
openGauss-3.0.0-CentOS-64bit.tar.bz2
openGauss-3.0.0-CentOS-64bit-cm.sha256
openGauss-3.0.0-CentOS-64bit-om.sha256
openGauss-3.0.0-CentOS-64bit.sha256
upgrade_sql.tar.gz
upgrade_sql.sha256

然后解压:openGauss-3.0.0-CentOS-64bit-om.tar.gz
[root@localhost opengauss]#tar -zxvf openGauss-3.0.0-CentOS-64bit-om.tar.gz
只需要解压这两个压缩包

 

2.安装python3.6
注意只能安装3.6.x的版本,低于和高于该版本的都不行,我这里安装的是3.6.5
编译的时候需要加上–enable-shared方式编译,可以参考链接:
https://www.cnblogs.com/hxlasky/p/14913936.html

 

3.编辑安装配置文件
在script/gspylib/etc/conf/cluster_config_template.xml获取XML文件模板.以下配置内容为示例,可自行替换.
该文件是由openGauss-3.0.0-CentOS-64bit-om.tar.gz解压出来的
cp /soft/opengauss/script/gspylib/etc/conf/cluster_config_template.xml /tmp/cluster_config_template.xml

修改该文件,根据实际情况进行修改(单节点)

 

<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
    <!-- openGauss整体信息 -->
    <CLUSTER>
        <!-- 数据库名称 -->
        <PARAM name="clusterName" value="dbCluster" />
        <!-- 数据库节点名称(hostname) -->
        <PARAM name="nodeNames" value="host134" />
        <!-- 数据库安装目录-->
        <PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
        <!-- 日志目录-->
        <PARAM name="gaussdbLogPath" value="/var/log/omm" />
        <!-- 临时文件目录-->
        <PARAM name="tmpMppdbPath" value="/opt/huawei/tmp" />
        <!-- 数据库工具目录-->
        <PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />
        <!-- 数据库core文件目录-->
        <PARAM name="corePath" value="/opt/huawei/corefile" />
        <!-- 节点IP,与数据库节点名称列表一一对应 -->
        <PARAM name="backIp1s" value="192.168.1.134"/> 
    </CLUSTER>
    <!-- 每台服务器上的节点部署信息 -->
    <DEVICELIST>
        <!-- 节点1上的部署信息 -->
        <DEVICE sn="node1_hostname">
            <!-- 节点1的主机名称 -->
            <PARAM name="name" value="host134"/>
            <!-- 节点1所在的AZ及AZ优先级 -->
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.168.1.134"/>
            <PARAM name="sshIp1" value="192.168.1.134"/>

        <!--dbnode-->
        <PARAM name="dataNum" value="1"/>
        <PARAM name="dataPortBase" value="15400"/>
        <PARAM name="dataNode1" value="/opt/huawei/install/data/dn"/>
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE>
    </DEVICELIST>
</ROOT>

 

4.安装依赖包

yum install libaio-devel
yum install flex
yum install bison
yum install ncurses-devel
yum install glibc-devel
yum install patch
yum install redhat-lsb-core
yum install readline-devel
yum install libnsl

 

5.预安装检查

[root@host134 ~]# /soft/opengauss/script/gs_preinstall -U omm -G dbgrp -X /tmp/cluster_config_template.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 host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? Please type 'yes' or 'no': yes
Please enter password for cluster user.
Password:  ##这里输入密码oracle
Please enter password for cluster user again.
Password: 
Generate cluster user password files successfully.

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.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/soft/opengauss/script/gs_checkos -i A -h host134 --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.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

 

该步骤会创建用户omm和组dbgrp

 

5.安装(omm用户下操作)

su - omm
[omm@host134 ~]$ gs_install -X /tmp/cluster_config_template.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Last time end with Install cluster.
Continue this step.
Successfully created the backup directory.
begin deploy..
Rolling back.
Rollback succeeded.
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: ##密码设置为 Gauss@123456
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/huawei/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
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..

 

6.查看数据库状态

[omm@host134 ~]$ gs_om -t status --detail
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

    node   node_ip         port      instance                            state
----------------------------------------------------------------------------------------------
1  host134 192.168.1.134   15400      6001 /opt/huawei/install/data/dn   P Primary Normal

 

7.初始化数据库

登陆数据库

su - omm
gsql -d postgres -p 15400

创建数据库
openGauss=# create database db_test with encoding 'utf8' template = template0;
查看数据库

openGauss=# \l
 db_test   | omm   | UTF8      | C       | C     | 
 postgres  | omm   | SQL_ASCII | C       | C     | 
 template0 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
 template1 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm

 

8.修改文件pg_hba.conf和postgresql.conf配置文件
su - omm
vi /opt/huawei/install/data/dn/pg_hba.conf
添加如下项:
host all all 0.0.0.0/0 md5

修改postgresql.conf
vi /opt/huawei/install/data/dn/postgresql.conf
修改如下项:
listen_addresses = '*' # what IP address(es) to listen on;


[omm@opengauss ~]$ vim /opt/software/openGauss/data/single_node/postgresql.conf
listen_addresses = '*' # what IP address(es) to listen on;
local_bind_address = '0.0.0.0'
password_encryption_type = 0 #Password storage type, 0 is md5 for PG, 1 is sha256 + md5, 2 is sha256 only


重启动
[omm@host134 dn]$gs_om -t stop
[omm@host134 dn]$gs_om -t start

 

9.创建用户

su -omm
gsql -d postgres -p 15400
openGauss=# create user hxl01 password 'Gauss@123456';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE

openGauss=# grant all on database db_test to hxl01;
GRANT

 

赋予权限

grant all privileges to hxl01;

 

10.使用navicate连接

 

posted @ 2022-07-18 14:55  slnngk  阅读(722)  评论(0编辑  收藏  举报