首页 > 其他分享 >openGauss单机部署

openGauss单机部署

时间:2024-04-08 15:14:40浏览次数:16  
标签:opt 单机 部署 Successfully omm export openGauss software

openGauss 单机部署
一、安装环境
操作系统:虚拟机 VMware、CentOS7.9

环境设置:

(1)虚拟机内存 3G、磁盘 100G

(2)系统版本修改

一开始使用了 centos8,无法安装,因此降低版本,选用 7.9 后依然存在一些问题,因此修改/etc/redhat-release 文件中系统版本为 CentOS Linux release 7.6(Core)

(3)配置 YUM 源

① 删除系统自带 yum 源

rm -rf /etc/yum.repos.d/*
② 下载阿里云 yum 源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
③ 生成仓库缓存

yum makecache
(4)安装依赖包

1 yum install ‐y libaio‐devel flex bison ncurses‐devel glibc.devel patch lsb_release
2 yum install ‐y openssl* python3
(5)关闭 SELINUX 和 Firewall

1 setenforce 0
2 systemctl disable firewalld.service
3 systemctl stop firewalld.service
(6)关闭交换内存

swapoff -a
(7)关闭透明大页

1 vim /etc/rc.d/rc.local
2 if test ‐f /sys/kernel/mm/transparent_hugepage/enabled;
3 then
4 echo never > /sys/kernel/mm/transparent_hugepage/enabled
5 fi
6 if test ‐f /sys/kernel/mm/transparent_hugepage/defrag;
7 then
8 echo never > /sys/kernel/mm/transparent_hugepage/defrag
9 fi
(8)修改主机名

1 echo "node1" > /etc/hostname
2 echo “ ... node1” >>/etc/hosts
二、安装详细步骤
Opengauss 安装

(1)下载 opengauss 安装包及创建用户组和目录

1 groupadd dbgrp
2 useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
3 echo "omm" | passwd -‐stdin omm
4 mkdir -p /opt/software/openGauss
5 chmod 755 -R /opt/software
6 chown -R omm:dbgrp /opt/software/openGauss
cd /opt/software/openGauss/
7 wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.0.0/x86/openGauss-2.0.0-CentOS-64bit-all.tar.gz
8 tar -zxvf openGauss-2.0.0-CentOS-64bit-all.tar.gz
9 tar -zxvf openGauss-2.0.0-CentOS-64bit-om.tar.gz
(2)单机 xml 配置文件

首先从如下地址复制文件至当前位置

cp script/gspylib/etc/conf/cluster_config_template.xml .
修改配置文件具体如下,配置文件中要注意配置一下几个参数:nodeNAMES、backips


(3)设置 lib 库

vim .bashrc
添加
export GPHOME=/opt/huawei/install/om
export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH
export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$GPHOME/lib
export GAUSSHOME=/opt/huawei/install/app
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
export S3_CLIENT_CRT_FILE=$GAUSSHOME/lib/client.crt
export GAUSS_VERSION=2.0.0
export PGHOST=/opt/huawei/tmp
export GAUSSLOG=/opt/huawei/log/omm
umask 077
export GAUSS_ENV=2
export GS_CLUSTER_NAME=singlenode
(4)执行交互式初始化

① 预安装,操作如下:

1 cd /opt/software/openGauss/script
2 root@node1 script]#python3 gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/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 pssh path
Successfully set core path.
Are you sure you want to create the user[omm] and create trust for it (yes)? yes
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 node1 --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.
当出现“Preinstallation succeeded.”时,预安装成功。

② 安装

进入 script 目录后进行正式安装,命令如下,其中“/opt/software/openGauss/cluster_config_template.xml”为前几步中编辑的配置文件。

此过程需要输入密码,且设置的密码要符合复杂度要求如下:

最少包含 8 个字符;

不能和用户名和当前密码(ALTER)相同,或和当前密码反序;

至少包含大写字母(A-Z),小写字母(a-z),数字,非字母数字字符(限定为~!@#$%^&*()-_=+|[{}];:,<.>/?)四类字符中的三类字符:

[omm@node1 openGauss]$ cd script/
[omm@node1 script]$ gs_install -X /opt/software/openGauss/cluster_config_template.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/huawei/install/app/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..
测试安装是否成功,首先需要使数据库处于开启状态,然后输入”gsql -d postgres -p 26000”命令使数据库在本地运行,其中-p 为数据库端口 dataPortBase,具体数值在前述过程中 xml 配置文件中确定,这里为 26000。

Opengauss 连接设置

(1)安装 java,确认 jdk 版本为 1.8

(2)从官网下载 jdbc 压缩包后,将其解压至路径/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/lib/ext 下

(3)配置数据库服务器中的白名单与监听名单

① 以操作系统用户 omm 登录数据库主节点

② 执行如下命令增加对外提供服务的网卡 IP 或者主机名(英文逗号分隔),其中 NodeName 为当前节点名称,如:

gs_guc reload -N NodeName -I all -c "listen_addresses='localhost,...'"
③ 执行如下命令在数据库主节点配置文件中增加一条认证规则。(这里假设客户端 IP 地址为 ...,即远程连接的机器的 IP 地址)

gs_guc reload -N all -I all -h "host all yushan .../32 sha256"

  • -N all表示openGauss中的所有主机。
  • -I all表示主机中的所有实例。
  • -h表示指定需要在“pg_hba.conf”增加的语句。
  • all表示允许客户端连接到任意的数据库。
  • yushan表示连接数据库的用户。
  • .../32表示只允许IP地址为...的主机连接。在使用过程中,请根据用户的网络进行配置修改。32表示子网掩码为1的位数,即... - sha256表示连接时jack用户的密码使用sha256算法加密。
    与之效果相同的代替操作:

在/opt/huawei/install/data/db1 路径(创建的节点名叫 db1)下编辑 pg_hba.conf 文件

(4)通过编写 java 程序即可连接,example 如下

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.CallableStatement;
public class test{
public static Connection getConnect(String username, String passwd)
{
//驱动类。
String driver = "org.postgresql.Driver";
//数据库连接描述符。
String sourceURL = "jdbc:postgresql://...:26000/postgres";
Connection conn = null;

    try
    {
        //加载驱动。
        Class.forName(driver);
    }
    catch( Exception e )
    {
        e.printStackTrace();
        return null;
    }

    try
    {
         //创建连接。
        conn = DriverManager.getConnection(sourceURL, username, passwd);
        System.out.println("Connection succeed!");
    }
    catch(Exception e)
    {
        e.printStackTrace();
        return null;
    }

    return conn;
};
public static void main(String[] args) {
	// TODO Auto-generated method stub
	Connection conn = getConnect("yushan", "1qaz@wsx");
	//BatchInsertData(conn);
	try {
		conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
}

}
编译执行程序后,如图,连接成功。

三、安装过程中碰到的问题与解决办法
问题 1

在安装结束后,准备运行后,发现 gsom 无法启动。

解决过程:

猜测可能是内存不足,虚拟机一开始设置的内存为 1G,查阅相关博客发现,1G 内存对于企业版不足,后将虚拟机内存设置为 3G。

问题 2

运行 gsom 后报错如下

解决过程:

检查发现 pg_hba.conf 文件配置出错,修改如下

问题 3

一开始安装的虚拟机为 centos8,进行预安装后发现不支持该版本操作系统。

解决过程:

切换为 centos7.9,但依然报错,因此修改/etc/redhat-release 文件中系统版本为 CentOS Linux release 7.6(Core)

标签:opt,单机,部署,Successfully,omm,export,openGauss,software
From: https://www.cnblogs.com/helloopenGauss/p/18121185

相关文章

  • openGauss内存引擎中的索引
    一、索引索引是一种用于快速查询和检索数据的数据结构。常见的索引结构有:B树,B+树和Hash。索引的作用就相当于目录的作用。打个比方:我们在查字典的时候,如果没有目录,那我们就只能一页一页的去找我们需要查的那个字,速度很慢。如果有目录了,我们只需要先去目录里查找字的位置,......
  • Linux系统部署
    一、操作系统没有安装操作系统的计算机——裸机如果想在裸机上运行自己所编写的程序,就必须用机械语言(11010101)书写程序作用直接操作硬件将操作硬件的代码封装成系统调用二、不同应用领域的操作系统1.桌面操作系统Windows系列:用户群体大(推广时间长,应用软件多);安全性、......
  • 国产开源数据库OpenGauss的安装运行
    步骤一:OpenGauss的安装环境OS:openEuler20.0364bitwithARM架构:arm64部署:单机安装过程1、环境配置安装依赖包:yuminstalllibaio-develflexbisonncurses-develglibc-develpatchreadline-devel2、创建xml配置文件创建cluster_config.xml配置文件并进行配置......
  • Docker部署xxl-job
    官方文档:https://www.xuxueli.com/xxl-job/#《分布式任务调度平台XXL-JOB》参考文档:https://www.jianshu.com/p/c47a405e98c4安装正常情况下,mysql的账号和密码如果和xxl-job上面的密码是一样的话,直接使用官方文档命令行即可:dockerrun-p8080:8080-v/tmp:/data/applogs--n......
  • Docker部署Seata
    参考文档:https://blog.csdn.net/qq_38066812/article/details/136238350版本1.6.1注意点:配置文件中关于nacos的addr,namespace,username,password,group,data-id等要与nacos中一致;IP地址相关的配置要考虑在容器内是否可以访问到安装dockerpullseataio/seata-server:1.6.0......
  • 开源大模型本地私有化部署
    1、安装ollamaollma下载https://ollama.com/download/windowslinux安装curl-fsSLhttps://ollama.com/install.sh|sh运行ollamarungemma:2bollamarungemma:7b使用端口114342、下载open-webui代码https://github.com/open-webui/open-webui.git生成目录open-webuidoc......
  • ubuntu2204 部署 stable-diffusion-webui
    显卡:(一个实例仅能用一张卡)顶配:rtx6000ada48g,a10040g,a100 80g,a100 96g,a80080g,h100,h200高端:rtx409024g,rtx4090D24g,rtxa600048g,rtxa500024g,rtx5000ada32g魔改:rtx2080ti22g,rtx308020g性价比:rtx4060ti16g,rtx206012g,rtx306012g,rtx309024g,rtxtitan24g其......
  • 从模型到部署,教你如何用Python构建机器学习API服务
    本文分享自华为云社区《Python构建机器学习API服务从模型到部署的完整指南》,作者:柠檬味拥抱。在当今数据驱动的世界中,机器学习模型在解决各种问题中扮演着重要角色。然而,将这些模型应用到实际问题中并与其他系统集成,往往需要构建API服务。本文将介绍如何使用Python构建机器学习......
  • Springboot计算机毕业设计橙心优购微信小程序的设计与实现【附源码】开题+论文+mysql+
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容研究背景随着移动互联网的快速发展和普及,微信小程序作为一种新兴的移动应用形态,受到了广大用户的青睐。微信小程序不仅具备即用即走、无需安装的特点,而且能够......
  • Springboot计算机毕业设计宠物领养与物品捐赠小程序【附源码】开题+论文+mysql+程序+
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容研究背景随着人们生活质量的提升,越来越多的人选择宠物作为生活中的伴侣。然而,宠物数量的增长也带来了一系列问题,如流浪宠物数量的增加、宠物养护知识的缺乏等......