centos7.6安装opengauss5.0

本文详细描述了在Linux系统上安装openGauss数据库的步骤,包括安装前的环境准备、Python版本升级、依赖包安装、XML配置文件创建、安装包解压与安装,以及后续的设置如字符集、网络参数、用户权限等。
摘要由CSDN通过智能技术生成

openGauss安装与使用

一、安装准备

查看Python版本,安装3.6

关闭防火墙,关闭selinux

[root@opengauss ~]# vim /etc/selinux/config
SELINUX=disabled
[root@opengauss ~]# setenforce 0
[root@opengauss ~]# systemctl disable firewalld.service
[root@opengauss ~]# systemctl stop firewalld.service
//安装环境依赖包
[root@opengauss ~]# yum -y groupinstall "Development tools"
[root@opengauss ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
//安装python
[root@opengauss ~]# python -V
Python 2.7.5
[root@opengauss ~]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
[root@opengauss ~]# ls
anaconda-ks.cfg  Python-3.6.8.tar.xz
[root@opengauss ~]# mkdir /usr/local/python3
[root@opengauss ~]# xz -d Python-3.6.8.tar.xz
[root@opengauss ~]# tar xf Python-3.6.8.tar -C /usr/local/python3/
[root@opengauss ~]# cd /usr/local/python3/Python-3.6.8/
[root@opengauss Python-3.6.8]# ./configure --prefix=/usr/local/python3/  --enable-optimizations
[root@opengauss Python-3.6.8]# make && make install
//创建软连接
[root@opengauss Python3]# ln -sf /usr/local/Python3/bin/python3.6 /usr/bin/python3
[root@opengauss Python3]# ln -sf /usr/local/Python3/bin/pip3 /usr/bin/pip3
//替换原有python文件
[root@opengauss Python3]# mv /usr/bin/python /usr/bin/python22
[root@opengauss Python3]# ln -sf /usr/bin/python3 /usr/bin/python
//修改配置文件
[root@opengauss Python3]# vim /usr/bin/yum
把文件头部的#!/usr/bin/python改成#!/usr/bin/python22
[root@opengauss Python3]# vim /usr/libexec/urlgrabber-ext-down
把文件头部的#!/usr/bin/python改成#!/usr/bin/python22
[root@opengauss ~]# python -V
Python 3.6.1

opengauss安装流程

流程说明
安装前准备openGauss安装前需要准备相应的软硬件环境以及完成相关配置。本文档提供了openGauss安装所需的最低要求,实际安装中,请用户根据实际情况进行规划。更多信息,请参考安装准备
获取并校验安装包安装包需要在openGauss开源社区下载并且对安装包内容进行检查,详细请参见获取安装包
配置XML文件安装openGauss前需要创建XML文件。XML文件包含部署openGauss的服务器信息、安装路径、IP地址以及端口号等。用于告知openGauss如何部署。用户需根据不同场景配置对应的XML文件。关于如何配置XML文件,详细请参见创建XML配置文件
上传安装包和XML文件上传安装包和XML配置文件到待安装的服务器。
解压安装包使用tar命令解压安装包。
初始化安装环境安装环境的初始化包含上传安装包和XML文件、解压安装包、使用gs_preinstall准备好安装环境。关于如何初始化安装环境,详细请参见初始化安装环境
执行安装使用gs_install安装openGauss。关于如何执行安装,详细请参见执行安装
设置备机可读可选操作。在开启备机可读之后,备机将支持读操作,并满足数据一致性要求。

opengauss下载地址:https://opengauss.org/zh/download/archive/

开始安装opengauss

[root@opengauss ~]# mkdir /usr/local/opengauss
[root@opengauss ~]# tar xf openGauss-5.0.0-CentOS-64bit-all.tar.gz -C /usr/local/opengauss/
[root@opengauss ~]# cd /usr/local/opengauss/
[root@opengauss opengauss]# ls -lb
总用量 131076
-rw-r--r--. 1 root root      105 3月  29 2023 openGauss-5.0.0-CentOS-64bit-cm.sha256
-rw-r--r--. 1 root root 22356000 3月  29 2023 openGauss-5.0.0-CentOS-64bit-cm.tar.gz
-rw-r--r--. 1 root root       65 3月  29 2023 openGauss-5.0.0-CentOS-64bit-om.sha256
-rw-r--r--. 1 root root 11963876 3月  29 2023 openGauss-5.0.0-CentOS-64bit-om.tar.gz
-rw-r--r--. 1 root root       65 3月  29 2023 openGauss-5.0.0-CentOS-64bit.sha256
-rw-r--r--. 1 root root 99384569 3月  29 2023 openGauss-5.0.0-CentOS-64bit.tar.bz2
-rw-------. 1 root root       65 3月  29 2023 upgrade_sql.sha256
-rw-------. 1 root root   493211 3月  29 2023 upgrade_sql.tar.gz
//下载python模块
[root@opengauss opengauss]# pip3 install psutil netifaces cffi pycparser cryptography pynacl bcrypt paramiko

这里会有报错

在这里插入图片描述

[root@opengauss opengauss]# pip3 install --upgrade pip
Collecting pip
//重新下载
[root@opengauss opengauss]# pip3 install psutil netifaces cffi pycparser cryptography pynacl bcrypt paramiko
//下载opengauss依赖
[root@opengauss opengauss]# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel libnsl
设置字符集参数
[root@opengauss opengauss]# vim /etc/profile
export LANG=zh_CN.utf8
[root@opengauss opengauss]# source /etc/profile
关闭swap分区
[root@opengauss opengauss]# swapoff -a
设置网卡MTU值

将各数据库节点的网卡MTU值设置为相同大小。

[root@opengauss opengauss]# yum -y install net-tools
[root@opengauss opengauss]# ifconfig ens33 mtu 3000
[root@opengauss opengauss]# ifconfig |grep mtu
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 3000
创建opengauss用户和用户组
[root@opengauss opengauss]# groupadd dbgrp
[root@opengauss opengauss]# useradd -g dbgrp omm
[root@opengauss opengauss]# passwd omm
更改用户 omm 的密码 。
解压配置文件模板
[root@opengauss opengauss]# bzip2 -d openGauss-5.0.0-CentOS-64bit.tar.bz2 
[root@opengauss opengauss]# tar xf openGauss-5.0.0-CentOS-64bit-om.tar.gz 
[root@opengauss opengauss]# ls
lib
openGauss-5.0.0-CentOS-64bit-cm.sha256
openGauss-5.0.0-CentOS-64bit-cm.tar.gz
openGauss-5.0.0-CentOS-64bit-om.sha256
openGauss-5.0.0-CentOS-64bit-om.tar.gz
openGauss-5.0.0-CentOS-64bit.sha256
openGauss-5.0.0-CentOS-64bit.tar
script
upgrade_sql.sha256
upgrade_sql.tar.gz
version.cfg
[root@opengauss opengauss]# chown -R omm.dbgrp .
[root@opengauss opengauss]# cd script/
[root@opengauss script]# ll -d
drwxr-xr-x. 10 omm dbgrp 4096 3月  29 2023
编辑配置文件模板

本次是单机安装

一主多备实例配置详情:https://docs-opengauss.osinfra.cn/zh/docs/5.0.0/docs/InstallationGuide/%E5%88%9B%E5%BB%BAXML%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6.html#%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8D%E7%A7%B0%E5%8F%8A%E5%90%84%E9%A1%B9%E7%9B%AE%E5%BD%95

[root@opengauss opengauss]# vim script/gspylib/etc/conf/cluster_config_template.xml 
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
  <!-- openGauss整体信息 -->
  <CLUSTER>
  	<!-- 数据库名称 -->
    <PARAM name="clusterName" value="test1" />
    <!-- 数据库节点名称(hostname) -->
    <PARAM name="nodeNames" value="opengauss"/>
    <!-- 数据库安装目录-->
    <PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
    <!-- 日志目录-->
    <PARAM name="gaussdbLogPath" value="/opt/huawei/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.31.200"/>
  </CLUSTER>
  <!-- 每台服务器上的节点部署信息 -->
  <DEVICELIST>
  	<!-- 节点1上的部署信息 -->
    <DEVICE sn="node1_hostname">
      <!-- 节点1的主机名称 -->
      <PARAM name="name" value="opengauss"/>
      <!-- 节点1所在的AZ及AZ优先级 -->
      <PARAM name="azName" value="AZ1"/>
      <PARAM name="azPriority" value="1"/>
      <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
      <PARAM name="backIp1" value="192.168.31.200"/>
      <PARAM name="sshIp1" value="192.168.31.200"/>
      <!-- dn -->
      <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>
初始化安装环境

检查hostname与/etc/hostname是否一致。预安装过程中,会对hostname进行检查。

执行前置命令

[root@opengauss script]# ./gs_preinstall -U omm -G dbgrp -L -X /usr/local/opengauss/script/gspylib/etc/conf/cluster_config_template.xml 

这步会报错,解决方法

[root@opengauss script]# yum install python3-devel
[root@opengauss script]# pip3 install paramiko
[root@opengauss script]# pip3 install psutil
[root@opengauss script]# pip3 install netifaces

这步还会报错,解决方法

在这里插入图片描述

[root@opengauss script]# pip3 install --upgrade pip setuptools
[root@opengauss script]# pip3 install paramiko
或者
[root@localhost script]# python3 -m pip install --upgrade pip

重新执行前置命令

–unused-third-party 参数表示放弃使用om的三方库,使用系统自带的

[root@opengauss script]# ./gs_preinstall -U omm -G dbgrp -L -X /usr/local/opengauss/script/gspylib/etc/conf/cluster_config_template.xml --unused-third-party

执行安装命令

给omm用户/opt/huawei文件夹属主权限,执行安装命令

[root@opengauss script]# chown -R omm.dbgrp /opt/huawei/
[root@opengauss script]# ll /opt/huawei/
总用量 0
drwxr-x---. 2 omm dbgrp  6 12月  4 16:56 corefile
drwxr-x---. 5 omm dbgrp 48 12月  4 16:56 install
drwx------. 3 omm dbgrp 17 12月  4 16:52 log
drwx------. 2 omm dbgrp  6 12月  4 16:56 tmp
[root@opengauss script]# chown -R omm.dbgrp /usr/local/opengauss/

执行命令

[root@opengauss script]# su omm
[omm@opengauss script]$ ./gs_install -X /usr/local/opengauss/script/gspylib/etc/conf/cluster_config_template.xml

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Qyoung_青

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值