当前位置: 首页 > article >正文

openGauss 6.0.0单机部署(企业版)

openGauss 6.0.0单机部署(企业版)

文章目录

    • openGauss 6.0.0单机部署(企业版)
      • 一、环境准备
        • 1.操作系统环境
        • 2.修改主机名
        • 3.设置字符集编码
        • 4.修改openEuler默认yum源
        • 5.安装所需工具
      • 二、安装openGauss数据库
        • 1.创建安装目录并修改其权限为755
        • 2.下载安装包到本地
        • 3.创建XML配置文件
        • 4.预安装
        • 5. 安装openGauss
      • 三、安装验证
        • 1.检查数据库状态
        • 2.登录postgres数据库
        • 3.启停openGauss
          • 3.1 启动openGauss
          • 3.2 停止openGauss

一、环境准备

1.操作系统环境
项目配置描述
CPU4核
(最低2核)
内存8G
( 最低4G)
操作系统x86架构
openEuler22.03
2.修改主机名
hostnamectl set-hostname openEuler

# 修改完成后退出重新连接
3.设置字符集编码
# 往环境变量配置文件/etc/profile最后添加字符集编码export LANG=en_US.UTF-8
echo -e  "\nexport LANG=en_US.UTF-8" >> /etc/profile

# 激活环境变量
source /etc/profile
4.修改openEuler默认yum源
# 复制原始yum源文件更名为.copy
cp /etc/yum.repos.d/openEuler.repo /etc/yum.repos.d/openEuler.repo.copy

# 将路径更换为华为镜像源
echo "
[osrepo]
name=osrepo
baseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-22.03-LTS-SP2/OS/x86_64/
enabled=1

gpgcheck=1
gpgkey=https://mirrors.huaweicloud.com/openeuler/openEuler-22.03-LTS-SP2/OS/x86_64/RPM-GPG-KEY-openEuler
" > /etc/yum.repos.d/openEuler.repo

# 清除原有 yum 缓存
yum clean all

# 生成新的缓存
yum makecache
5.安装所需工具
yum install tar -y

yum install libaio* -y

二、安装openGauss数据库

1.创建安装目录并修改其权限为755
mkdir -p /opt/software/openGauss

chmod 755 -R /opt/software
2.下载安装包到本地
# 切换到安装路径
cd /opt/software/openGauss

# 下载openGauss安装包到本地
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/6.0.0/openEuler22.03/x86/openGauss-All-6.0.0-openEuler22.03-x86_64.tar.gz

# 解压到当前路径
tar -zxf ./openGauss-All-6.0.0-openEuler22.03-x86_64.tar.gz
# 继续解压OM安装包
tar -zxf ./openGauss-OM-6.0.0-openEuler22.03-x86_64.tar.gz
# 解压后会在/opt/software/openGauss路径下自动生成script子目录,并且在script目录下生成gs_preinstall等各种OM工具脚本
3.创建XML配置文件
# 切换到存放安装包的目录
cd /opt/software/openGauss

# 创建XML配置文件,用于数据库安装
vi cluster_config.xml

往其中输入以下内容

注意:需要将IP替换为自己本地的IP

<?xml version="1.0" encoding="UTF-8"?> 
<ROOT> 
    <CLUSTER> 
        <PARAM name="clusterName" value="dbCluster" /> 
        <PARAM name="nodeNames" value="openEuler" /> 
        <!-- 注意:需要将IP替换为自己本地的IP -->
        <PARAM name="backIp1s" value="192.168.217.129"/> 
        <PARAM name="gaussdbAppPath" value="/opt/openGauss/install/app" /> 
        <PARAM name="gaussdbLogPath" value="/var/log/omm" /> 
        <PARAM name="tmpMppdbPath" value="/opt/openGauss/tmp" />
        <PARAM name="gaussdbToolPath" value="/opt/openGauss/install/om" /> 
        <PARAM name="corePath" value="/opt/openGauss/corefile"/> 
    </CLUSTER> 
   
    <DEVICELIST> 
        
        <DEVICE sn="ecs-b168"> 
            <PARAM name="name" value="openEuler"/> 
            <PARAM name="azName" value="AZ1"/> 
            <PARAM name="azPriority" value="1"/> 
            <!-- 注意:需要将IP替换为自己本地的IP -->
            <PARAM name="backIp1" value="192.168.217.129"/> 
            <PARAM name="sshIp1" value="192.168.217.129"/> 
             
	    <!--dbnode--> 
	    <PARAM name="dataNum" value="1"/> 
	    <PARAM name="dataPortBase" value="26000"/> 
	    <PARAM name="dataNode1" value="/opt/openGauss/install/data/dn"/>
       <PARAM name="dataNode1_syncNum" value="0"/> 
        </DEVICE> 
    </DEVICELIST> 
</ROOT>
4.预安装

预安装在执行过程中自动创建操作系统root用户互信和omm用户互信

# 自动创建数据库管理员omm(也是运行openGauss的操作系统用户)
python3 /opt/software/openGauss/script/gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
# -U omm 指定用户名
# -G dbgrp 指定组名
# -X /opt/software/openGauss/cluster_config.xml 指定openGauss配置文件路径

# ----------- 以下是执行后输出的内容 -----------
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.
# 下述语句为询问是否创建omm用户,输入yes后回车
Are you sure you want to create the user[omm] (yes/no)? yes
Please enter password for cluster user.
# 创建omm密码
# Password:
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.
Checking cpu instructions.
Successfully checked cpu instructions.
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 "/opt/software/openGauss/script/gs_checkos -i A -h openEuler -X /opt/software/openGauss/cluster_config.xml --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.
# ----------- 输出结束 -----------


# 出现下述内容则预安装成功
Preinstallation succeeded.
5. 安装openGauss
# 切换为omm用户
su - omm

# 执行安装
gs_install -X /opt/software/openGauss/cluster_config.xml
# -X /opt/software/openGauss/cluster_config.xml 指定安装所使用的配置文件

# ----------- 以下是执行后输出的内容 -----------
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
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.
# 加密数据库,需要输入密码,密码需要满足大小写+数字,且不小于8位
Please enter password for database:
# 再次输入密码
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/openGauss/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
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.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
# ----------- 输出结束 -----------


# 出现下述内容则安装成功
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..

三、安装验证

1.检查数据库状态
gs_om -t status --detail
# -t 指定gs_om命令的类型
	# start 启动openGauss数据库服务
	# stop  停止openGauss数据库服务
	# status 查看openGauss数据库服务状态
# --detail 显示详细信息。如果不指定,只提示该服务器是否正常


# ----------- 以下是执行后输出的内容 -----------
# cluster_state 集群状态
	# Normal 表示openGauss正常
	# Unavailable 表示openGauss不可用
	# Degraded 表示openGauss可用,但存在故障的数据库节点、数据库主节点实例
cluster_state   : Normal
# redistributing 数据重分布状态
	# Yes 表示openGauss处于数据重分布状态
	# No  表示openGauss未处于数据重分步状态
redistributing  : No
current_az      : AZ_ALL

# 节点状态
[  Datanode State   ]

# node 节点编号
# node_ip 节点所在IP
# port 端口号
# instance  instance 实例ID
# state 实例角色
	# Normal:表示单主机实例。
	# P Primary:表示实例为主实例。
	# S Standby:表示实例为备实例。
	# Cascade Standby:表示实例为级联备实例。
	# Pending:表示该实例在仲裁阶段。
	# Unknown:表示实例状态未知。
	# Down:表示实例处于宕机状态。
	# Abnormal:表示节点处于异常状态。
	# Manually stopped:表示节点已经被手动停止。
node node_ip port instance state
-----------------------------------------------------------------------------------------
1  openEuler 192.168.217.129 26000  6001 /opt/openGauss/install/data/dn  P Primary Normal
2.登录postgres数据库

数据库安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库

# 登录postgres数据
gsql -d postgres -p 26000
	# -d postgres 指定登录的数据库名为postgres
	# -p 指定连接的端口号为26000
	
# 退出openGauss命令行
# 使用元命令\q或者快捷键Ctrl q 退出openGauss命令行
\q
3.启停openGauss
3.1 启动openGauss
# 启动openGauss数据库服务
gs_om -t start

# ----------- 以下是执行后输出的内容 --------
Starting cluster.
=========================================
[SUCCESS] openEuler
2024-11-18 16:23:04.271 673af968.1 [unknown] 140525502319040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2024-11-18 16:23:04.271 673af968.1 [unknown] 140525502319040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2024-11-18 16:23:04.273 673af968.1 [unknown] 140525502319040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4482 Mbytes) is larger.
=========================================
Successfully started.

# 出现Successfully started.即启动成功
3.2 停止openGauss
# 停止openGauss数据库服务
gs_om -t stop

# ----------- 以下是执行后输出的内容 -----------
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.

http://www.kler.cn/a/400951.html

相关文章:

  • 统信UOS开发环境支持Golang
  • Stable Diffusion核心网络结构——CLIP Text Encoder
  • 【Qt】QTreeWidget的简单使用
  • java语言特性(持续更新)
  • ChatGPT学术专用版,一键润色纠错+中英互译+批量翻译PDF
  • Java项目实战II基于Java+Spring Boot+MySQL的共享汽车管理系统(源码+数据库+文档)
  • 单机顶集群的大数据技术来了
  • ks 小程序sig3
  • vue3绘制画图工具
  • EUV光刻胶行业全面且深入的分析
  • 集群聊天服务器(7)数据模块
  • sql server index FORCESEEK
  • 微搭低代码入门05循环
  • 【Redis_Day4】内部编码和单线程模型
  • 汽车资讯新纪元:Spring Boot技术引领
  • 深入解析大带宽服务器:性能优势与选择指南
  • 力扣.259 较小的三数之和
  • Redis 高并发缓存架构实战与性能优化
  • 从零开始仿抖音做一个APP(首页顶部T标签添加页面关联)
  • Android15之解决:Dex checksum does not match for dex:framework.jar问题(二百三十九)
  • ---usb 摄像头的Linux 下查询的命令
  • Go语言教程(一看就会)
  • 高级java每日一道面试题-2024年11月08日-RabbitMQ篇-RabbitMQ有哪些重要的角色?有哪些重要的组件?
  • 用AI来写SQL:让ChatGPT成为你的数据库助手
  • Spring Boot汽车资讯:科技与汽车的新融合
  • Spring Boot开箱即用可插拔实现过程演练与原理剖析