从0到1去搭建一整套openGauss生态(1)-openGauss

一、环境准备

系统:openeuler22.03

软件:openGauss-All-6.0.0-openEuler22.03-x86_64.tar.gz 企业版 全包

官网下载链接
在这里插入图片描述

选择你的架构和操作系统后点击立即下载

jdk11+
jdk下载链接
在这里插入图片描述

点击下载,解压到linux目录后:下面以/usr/local/为例
在/etc/profile中增加
export JAVA_HOME=/usr/local/jdk-11.0.1 
export PATH=$JAVA_HOME/bin:$PATH
保存后
source /etc/profile
测试
java -version
出现
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

1.上传安装包到/home下

新环境需要tar

yum install tar -y

解压安装包,检查安装目录及文件是否齐全。在安装包所在目录执行以下命令:

tar -zxvf openGauss-All-6.0.0-openEuler22.03-x86_64.tar.gz
ls -lb

在这里插入图片描述

2.关闭防火墙

vi /etc/selinux/config
新增或修改
SELINUX=disabled
重启操作系统
reboot
查看防火墙状态
systemctl status firewalld
若未关闭执行下面命令
systemctl disable firewalld.service
systemctl stop firewalld.service

3.检查时间

date

4.关闭RemoveIPC

修改/etc/systemd/logind.conf文件中的“RemoveIPC”值为“no”。
修改/usr/lib/systemd/system/systemd-logind.service文件中的“RemoveIPC”值为“no”。(没有,不做处理)
vi  /etc/systemd/logind.conf
vi /usr/lib/systemd/system/systemd-logind.service
刷新缓存
systemctl daemon-reload
systemctl restart systemd-logind
查看是否生效
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC

---
[root@localhost ~]# loginctl show-session | grep RemoveIPC
RemoveIPC=no
[root@localhost ~]# systemctl show systemd-logind | grep RemoveIPC
RemoveIPC=no
---

5.设置root用户远程登录

openeuler22.03已经是开放的 不需要修改

修改Banner配置,注释掉“Banner”所在的行。

#Banner XXXX

vim /etc/ssh/sshd_config

systemctl restart sshd.service

二、开始安装

cd /home/openGauss/

tar -zxvf openGauss-OM-6.0.0-openEuler22.03-x86_64.tar.gz
修改权限
chmod 755 -R /home
cd /home/openGauss/script
./gs_preinstall -U omm -G dbgroup --one-stop-install

[root@localhost script]# ./gs_preinstall -U omm -G dbgroup --one-stop-install
请选择是英文还是中文导航一键式生成xml文件?
>> 1) 中文
   2) 英文
-------------------------------
请输入1/2进行选择,默认选项为1)中文:1
请输入xml的路径和文件名(默认:./cluster.xml):./cluster.xml
请输入数据库安装目录(默认:/opt/openGauss/install):/home/openGauss/install
请输入数据库端口(默认:15000):5432
请选择是否主备部署?
>> 1) 主备部署
   2) 单机部署
-------------------------------
请输入 1/2 进行选择,默认选项是 1)主备部署2
输入完成
生成的xml路径是:   /home/openGauss/script/base_utils/template/cluster.xml
xml内容是:
<ROOT>
    <CLUSTER>
        <PARAM name="clusterName" value="Cluster_template" />
        <PARAM name="nodeNames" value="localhost.localdomain" />
        <PARAM name="gaussdbAppPath" value="/homehome/openGauss/install/app" />
        <PARAM name="gaussdbLogPath" value="/homehome/openGauss/install/log" />
        <PARAM name="tmpMppdbPath" value="/homehome/openGauss/install/tmp" />
        <PARAM name="gaussdbToolPath" value="/homehome/openGauss/install/tool" />
        <PARAM name="corePath" value="/homehome/openGauss/install/corefile" />
        <PARAM name="backIp1s" value="127.0.0.1" />
        </CLUSTER>

    <DEVICELIST>
        <DEVICE sn="node1_hostname">
            <PARAM name="name" value="localhost.localdomain" />
            <PARAM name="azName" value="AZ1" />
            <PARAM name="azPriority" value="1" />
            <PARAM name="backIp1" value="127.0.0.1" />
            <PARAM name="sshIp1" value="127.0.0.1" />
            <PARAM name="dataNum" value="1" />
            <PARAM name="dataPortBase" value="5432" />
            <PARAM name="dataNode1" value="/homehome/openGauss/install/data/dn1" />
            <PARAM name="dataNode1_syncNum" value="0" />
        </DEVICE>

        </DEVICELIST>
</ROOT>
请确认xml的内容是否正确,正确输入yes;如需修改xml内容请自行修改,然后输入yes确认yes
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)? yes
Please enter password for cluster user.
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 "/home/openGauss/script/gs_checkos -i A -h localhost.localdomain -X /home/openGauss/script/base_utilstemplate/cluster.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.

一站式安装后文件夹openGauss的权限也已经设置为 omm dbgroup了

su - omm
gs_install -X /home/openGauss/script/base_utils/template/cluster.xml (自动生成的cluster配置目录)
在安装过程中需要设置数据库密码

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.
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 /homehome/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..

三、安装验证

gs_om -t status
出现Normal
cluster_name    : Cluster_template
cluster_state   : Normal
redistributing  : No

连接数据库
gsql -d postgres -p 5432

gsql ((openGauss 6.0.0 build aee4abd5) compiled at 2024-09-29 19:14:27 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=#
创建用户和密码
create user aaa password "aaaa@@@";
给管理员权限
alter role aaa sysadmin;

停止数据库
gs_ctl stop -D /opt/Gauss/install/data/dn1
启动数据库
gs_ctl start -D /opt/Gauss/install/data/dn1
gs_ctl restart -D /opt/Gauss/install/data/dn1
看数据库状态
gs_ctl status -D /opt/Gauss/install/data/dn1

查看状态
ps ux| grep gaussdb
进入数据库
gsql -d postgres
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值