openGauss系列_Centos 7.6 使用 PTK v0.5 安装部署 MogDB v3.0.3 一主两备级联集群

news/2024/12/25 15:25:40/

MogDBv3.0.3一主两备级联集群-一、安装环境准备">一、安装环境准备

本次选择在集群环境规划的节点一节点使用PTK来部署MogDB集群,初期未创建omm数据库操作系统用户,通过PTK来创建omm用户及对应组。

本次部署一主两备环境,计划后期测试集群的增删节点。

MogDBv3.0.3一主两备级联集群-1.1硬件环境要求">1.1 硬件环境要求

根据MogDB官网信息,安装部署MogDB对于硬件有一定要求,如部署生产环境请参照要求进行配置。

项目

配置描述

内存功能调试32GB以上。 性能测试和商业部署时,单实例部署建议128GB以上。 复杂的查询对内存的需求量比较高,在高并发场景下,可能出现内存不足。此时建议使用大内存的机器,或使用负载管理限制系统的并发。
CPU功能调试最小1×8 核,2.0GHz。 性能测试和商业部署时,单实例部署建议1×16核,2.0GHz。 CPU超线程和非超线程两种模式都支持。但是,MogDB各节点的设置需保持一致。
硬盘用于安装MogDB的硬盘需最少满足如下要求: - 至少1GB用于安装MogDB的应用程序。 - 每个主机需大约300MB用于元数据存储。 - 预留70%以上的磁盘剩余空间用于数据存储。 建议系统盘配置为RAID1,数据盘配置为RAID5,且规划4组RAID5数据盘用于安装MogDB。有关RAID的配置方法在本手册中不做介绍。请参考硬件厂家的手册或互联网上的方法进行配置,其中Disk Cache Policy一项需要设置为Disabled,否则机器异常掉电后有数据丢失的风险。 MogDB支持使用SSD盘作为数据库的主存储设备,支持SAS接口和NVME协议的SSD盘,以RAID的方式部署使用。
网络要求300兆以上以太网。 建议网卡设置为双网卡冗余bond。有关网卡冗余bond的配置方法在本手册中不做介绍。请参考硬件厂商的手册或互联网上的方法进行配置。 MogDB网络如果配置bond,请保证bond模式一致,不一致的bond配置可能导致MogDB工作异常。

MogDBv3.0.3一主两备级联集群-1.2软件环境要求">1.2 软件环境要求

根据MogDB官网信息,安装部署MogDB对于部分软件有一定要求,请参照官网要求配置如下软件。

软件类型

配置描述

rdtscp指令集(x86)执行lscpu | grep rdtscp命令查看是否支持rdtscp指令集。
bmi2指令集(CentOS)执行lscpu | grep bmi2命令查看是否支持bmi2指令集。
工具Huawei JDK 1.8.0、psmisc、bzip2
Python- openEuler:支持Python 3.7.X - CentOS:支持Python 3.6.X - 麒麟:支持Python 3.7.X 说明: python需要通过–enable-shared方式编译。

MogDBv3.0.3一主两备级联集群-1.3操作系统要求">1.3 操作系统要求

根据MogDB官网信息,安装部署MogDB对于操作系统版本是有一定要求,在安装部署MogDB前要检测所使用的操作系统是否符合要求。

操作系统

PTK方式

OM方式

手动方式

CentOS 7 (x86_64)
CentOS 8 (arm64)
CentOS 8 (x86_64)
EulerOS 2 (arm64)
EulerOS 2 (x86_64)
Kylin V10 (arm64)
Kylin V10 (x86_64)
NeoKylin V7 (x86_64)
Oracle Linux 7 (x86_64)
Oracle Linux 8 (x86_64)
Red Hat Enterprise Linux 7 (x86_64)
Red Hat Enterprise Linux 8 (x86_64)
Rocky Linux 7 (x86_64)
Rocky Linux 8 (x86_64)
SLES 12 (arm64)
UOS 20 (arm64)
UOS 20 (x86_64)
Ubuntu 18 (x86_64)
openEuler 20 (arm64)
openEuler 20 (x86_64)
openEuler 22 (arm64)
openEuler 22 (x86_64)

MogDBv3.0.3一主两备级联集群-1.4软件依赖要求">1.4 软件依赖要求

根据MogDB官网信息,安装部署MogDB需要依赖一些软件包,所以在部署MogDB前,要检查如下依赖包是否已安装。

所需软件

建议版本

libaio-devel建议版本:0.3.109-13
flex要求版本:2.5.31 以上
bison建议版本:2.7-4
ncurses-devel建议版本:5.9-13.20130511
glibc-devel建议版本:2.17-111
patch建议版本:2.7.1-10
redhat-lsb-core建议版本:4.1
readline-devel建议版本:7.0-13
libnsl(openEuler+x86环境中)建议版本:2.28-36
openSSH建议版本 :8.4p1
expect建议版本 :5.45.4

-- 检查操作系统依赖包

-- root 用户【所有节点】

rpm  -qa  --queryformat  "%{NAME}-%{VERSION}-%{RELEASE}  (%{ARCH})\n"  |  grep  -E "libaio-devel|flex|bison|ncurses-devel|glibc-devel|patch|redhat-lsb-core|readline-devel|openSSH|expect|zlib*|lsof|bzip2|numactl"

-- 安装依赖包

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel openSSH expect zlib* lsof bzip2 numactl

MogDBv3.0.3一主两备级联集群-二、操作系统设置">二、操作系统设置

MogDBv3.0.3一主两备级联集群-2.1安装python3">2.1 安装python3

-- 本次选择安装python 3.6.5版本

-- root 用户【所有节点】

mkdir /usr/local/python3

cd /usr/local/python3

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

tar -zxf Python-3.6.5.tgz

cd /usr/local/python3/Python-3.6.5

-- 不加CFLAGS=-fPIC,会在升级3.0的时候遇到编译问题

./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC 

make && make install

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

-- 设置环境变量

cat >>/etc/profile<<EOF

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/python3/bin

EOF

source /etc/profile

MogDBv3.0.3一主两备级联集群-2.2关闭操作系统防火墙">2.2 关闭操作系统防火墙

-- root 用户【所有节点】

systemctl disable firewalld.service

systemctl stop firewalld.service

systemctl status firewalld.service

MogDBv3.0.3一主两备级联集群-2.3设置字符集参数">2.3 设置字符集参数

-- root 用户【所有节点】

cat >>/etc/profile <<EOF

export LANG=en_US.UTF-8

EOF

source /etc/profile

# 检查字符集

cat /etc/profile | grep LANG

env |grep -i lang

MogDBv3.0.3一主两备级联集群-2.4设置时区和时间">2.4 设置时区和时间

-- root 用户【所有节点】

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

-- 查看

date

MogDBv3.0.3一主两备级联集群-2.5关闭swap交换内存">2.5 关闭swap交换内存

-- root 用户【所有节点】

-- 永久关闭

注释 swap 行

vim /etc/fstab

-- 查看

free -h 查看 swap一行全是 0 表示swap关闭

MogDBv3.0.3一主两备级联集群-2.6设置网卡MTU">2.6 设置网卡MTU

-- root 用户【所有节点】

-- 设置网卡为1500

ifconfig 网卡名 mtu 1500

-- 查看

ifconfig -a |grep -i mtu

MogDBv3.0.3一主两备级联集群-2.7设置root用户远程登录">2.7 设置root用户远程登录

-- root 用户【所有节点】

cat >>/etc/ssh/sshd_config<<EOF

PermitRootLogin yes

EOF

-- 检查

cat /etc/ssh/sshd_config |grep PermitRootLogin

MogDBv3.0.3一主两备级联集群-2.8关闭透明大页">2.8 关闭透明大页

-- root 用户【所有节点】

cat >> /etc/rc.d/rc.local<<EOF

if test -f /sys/kernel/mm/transparent_hugepage/enabled;

    then

        echo never > /sys/kernel/mm/transparent_hugepage/enabled

fi

if test -f /sys/kernel/mm/transparent_hugepage/defrag;

    then

        echo never > /sys/kernel/mm/transparent_hugepage/defrag

fi

EOF

-- 查看是否关闭:

cat /sys/kernel/mm/transparent_hugepage/enabled

cat /sys/kernel/mm/transparent_hugepage/defrag

MogDBv3.0.3一主两备级联集群-2.9修改Banner配置">2.9 修改 Banner 配置

-- root 用户【所有节点】

cat >>/etc/ssh/sshd_config<<EOF

Banner none

EOF

-- 检查

cat /etc/ssh/sshd_config | grep Banner

-- 重启生效

systemctl restart sshd.service

MogDBv3.0.3一主两备级联集群-三、安装MogDB集群">三、安装MogDB集群

MogDBv3.0.3一主两备级联集群-3.1在线安装PTK">3.1 在线安装PTK

-- 本次选择在集群节点一节点在线安装最新版PTK

-- root 用户 【节点一】

[root@mogdb-db1 ~]# curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh

Downloading ptk package...

Detected shell: bash

Shell profile:  /root/.bash_profile

ptk has been added to PATH in /root/.bash_profile

open a new terminal or source /root/.bash_profile to active it

Installed path: /root/.ptk/bin/ptk

-- 配置环境变量

根据在线安装提示,重新打开一个会话窗口或执行 source /root/.bash_profile生效PTK环境变量

[root@mogdb-db1 ~]# source /root/.bash_profile

[root@mogdb-db1 ~]# more /root/.bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export PATH=/root/.ptk/bin:$PATH

-- 查看PTK版本

[root@mogdb-db1 ~]# ptk -v

PTK Version: v0.5.5 release

Go Version: go1.18.1

Build Date: 2022-12-05T19:41:46

Git Hash: 6c0ef5f

MogDBv3.0.3一主两备级联集群-3.2下载MogDB安装包">3.2 下载MogDB安装包

登陆https://www.mogdb.io/downloads/allDownload链接下载地址,下载对应操作系统数据库安装包。

-- root 用户 【节点一】

[root@mogdb-db1 ~]# cd /opt/software/mogdb/

[root@mogdb-db1 mogdb]# wget https://cdn-mogdb.enmotech.com/mogdb-media/3.0.3/MogDB-3.0.3-CentOS-x86_64.tar.gz

--2022-12-07 11:22:41--  https://cdn-mogdb.enmotech.com/mogdb-media/3.0.3/MogDB-3.0.3-CentOS-x86_64.tar.gz

Resolving cdn-mogdb.enmotech.com (cdn-mogdb.enmotech.com)... 122.193.130.107

Connecting to cdn-mogdb.enmotech.com (cdn-mogdb.enmotech.com)|122.193.130.107|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 139260078 (133M) [application/gzip]

Saving to: ‘MogDB-3.0.3-CentOS-x86_64.tar.gz’

100%[=====================================================================================================] 139,260,078 21.4MB/s   in 6.8s  

2022-12-07 11:22:48 (19.6 MB/s) - ‘MogDB-3.0.3-CentOS-x86_64.tar.gz’ saved [139260078/139260078]

MogDBv3.0.3一主两备级联集群-3.3创建config.yaml配置文件">3.3 创建config.yaml配置文件

PTK安装集群环境需配置config.yaml集群配置文件。

参照官网可使用ptk template > config.yaml方式进行手动配置生成集群yaml文件;

也可以采用ptk template create根据提示交互式一步步生成集群ymal文件。

PTK详细用法及参数说明请参阅官网文档:https://docs.mogdb.io/zh/ptk/v0.5/usage-config

-- 加密 root口令

[root@mogdb-db1 mogdb]# ptk encrypt root

root: pTk6YjEwYWI2ZGE9PjxDPUJAQ2VmYzZpOHBHMUdzSWd0dTRWUmNpM1hobDNtSmRxdlMya1kzOGxkMGxzcTA=

-- 加密 db_password 口令

[root@mogdb-db1 mogdb]# ptk encrypt Mogdb@passwd

Mogdb@passwd: pTk6YjQ4ZjhkYTY9PjxDPUJARFhFWGVjNUV1SFVCMVJQWi1xWFNXcnhwN2lYN184SUpvSG1fZS0xNjV6SW8=

-- root 用户 【节点一】

[root@opensource-db ~]# cd /opt/software/mogdb/

-- 创建config.yaml配置文件

cat>> config.yaml <<EOF

global:

    <!-- 集群名称 -->

    cluster_name: cluster_mogdb

    <!-- 运行数据库操作系统用户名 -->

    user: omm

    <!-- 运行数据库的操作系统用户组  -->

    group: dbgrp

    <!-- 数据库的初始用户密码,若配置文件中未填写,会在安装时通过交互式要求输入  -->

    db_password: pTk6YjQ4ZjhkYTY9PjxDPUJARFhFWGVjNUV1SFVCMVJQWi1xWFNXcnhwN2lYN184SUpvSG1fZS0xNjV6SW8=

    <!-- 数据库安装的基础目录,指定该目录后,app_dir,data_dir,log_dir和tool_dir 参数中若未配置的,PTK 会自动在该安装目录下会创建对应的目录 -->

    base_dir: /opt/mogdb

    <!-- CM 配置信息 (可选) -->

    cm_option:

        <!-- CM 安装目录 -->

        dir: /opt/mogdb/cm

        <!-- cm server 监听端口 -->

        cm_server_port: 15300

        <!-- 数据库提供服务的虚拟IP -->

        db_service_vip: ""

<!-- 集群内的数据库实例服务器配置信息 -->

db_servers:

    <!-- 数据库实例服务器 IP (仅支持 IPv4) -->

    - host: 192.168.17.112

      <!-- 数据库端口 -->

      db_port: 27000

      <!-- 数据库主备实例IP地址列表 -->

      ha_ips:

        -

      <!-- 数据库主备实例日志传输端口 -->

      ha_port: 27001

      <!-- 数据库实例角色,若不填,PTK 会随机选择一个实例作为主库,其余自动为备库 -->

      role: primary

      <!-- Available Zone (可用区) 名称 -->

      az_name: BJ

      <!-- 可用区使用的优先级,数值越小优先级越高 -->

      az_priority: 1

      <!-- SSH 登录信息,登录用户需为 **root** 或者具有 sudo 权限的用户 -->

      ssh_option:

        <!-- SSH 登录用户端口 -->

        port: 22

        <!-- SSH 登录用户账号 -->

        user: root

        <!-- SSH 登录用户账号口令 -->

        password: pTk6YjEwYWI2ZGE9PjxDPUJAQ2VmYzZpOHBHMUdzSWd0dTRWUmNpM1hobDNtSmRxdlMya1kzOGxkMGxzcTA=

        <!-- SSH 执行单条命令时的超时时间 -->

        conn_timeout: 5m0s

        <!-- 跳板服务器登录信息,如果目标服务器无法直连时,支持通过中间跳板机方式连接 -->

        exec_timeout: 5m0s

    - host: 192.168.17.113

      db_port: 27000

      ha_ips:

        -

      ha_port: 27001

      role: standby

      az_name: SH

      az_priority: 2

      ssh_option:

        port: 22

        user: root

        password: pTk6YjEwYWI2ZGE9PjxDPUJAQ2VmYzZpOHBHMUdzSWd0dTRWUmNpM1hobDNtSmRxdlMya1kzOGxkMGxzcTA=

        conn_timeout: 5m0s

        exec_timeout: 5m0s

    - host: 192.168.17.139

      db_port: 27000

      ha_ips:

        -

      ha_port: 27001

      <!-- cascade_standby 表示级联备库 -->

      role: cascade_standby

      <!-- 当实例角色为 cascade_standby 时,该字段表示要跟随的上游备库 IP -->

      upstream_host: 192.168.17.113

      -- 注意级联备库的az_name要和standby备库相同,否则集群部署完毕后会显示级联备库状态为Need Repar(Connecting...)

      az_name: SH

      -- 注意级联备库的az_priority要和standby备库相同

      az_priority: 2

      ssh_option:

        port: 22

        user: root

        password: pTk6YjEwYWI2ZGE9PjxDPUJAQ2VmYzZpOHBHMUdzSWd0dTRWUmNpM1hobDNtSmRxdlMya1kzOGxkMGxzcTA=

        conn_timeout: 5m0s

        exec_timeout: 5m0s

<!-- 集群内的CM服务部署机器列表 -->

cm_servers:

    <!-- CM Server 服务器 IP (仅支持 IPv4) -->

    - host: 192.168.17.112

    <!-- CM Server 监听端口 -->

      port: 25300

      role: ""

    - host: 192.168.17.113

      port: 25300

      role: ""

    - host: 192.168.17.139

      port: 25300

      role: "" 

EOF 

MogDBv3.0.3一主两备级联集群-3.4执行预检查">3.4 执行预检查

-- root 用户执行

[root@opensource-db mogdb]# ptk checkos -f config.yaml

[root@mogdb-db1 mogdb]# ptk checkos -f config.yaml

INFO[2022-12-07T16:09:45.364] prechecking dependent tools...              

WARN[2022-12-07T16:09:46.761] [192.168.17.112][omm] vm.min_free_kbytes=813306, expect 813374

INFO[2022-12-07T16:09:46.767] [192.168.17.112][omm] check kernel.core_pattern

INFO[2022-12-07T16:09:46.777] [192.168.17.112][omm] check removeIPC value 

WARN[2022-12-07T16:09:47.635] [192.168.17.139][omm] vm.min_free_kbytes=503638, expect 503721

WARN[2022-12-07T16:09:48.040] [192.168.17.113][omm] vm.min_free_kbytes=813306, expect 813374

INFO[2022-12-07T16:09:48.083] [192.168.17.113][omm] check kernel.core_pattern

INFO[2022-12-07T16:09:48.171] [192.168.17.113][omm] check removeIPC value 

INFO[2022-12-07T16:09:49.176] [192.168.17.139][omm] check kernel.core_pattern

INFO[2022-12-07T16:09:49.274] [192.168.17.139][omm] check removeIPC value 

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(sda) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(sdb) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(sr0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(dm-0) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(dm-1) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.336] [192.168.17.112][omm] device(fd0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.370] [192.168.17.139][omm] device(sdc) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sdf) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sr0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sda) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(dm-1) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sdb) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sdd) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(sdg) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(dm-0) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(dm-4) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(dm-3) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.371] [192.168.17.139][omm] device(fd0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.372] [192.168.17.139][omm] device(sde) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.372] [192.168.17.139][omm] device(dm-2) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.439] [192.168.17.113][omm] device(fd0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.439] [192.168.17.113][omm] device(sda) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.439] [192.168.17.113][omm] device(sdb) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.439] [192.168.17.113][omm] device(sr0) 'IO Request'=32768, expect 256

WARN[2022-12-07T16:09:49.440] [192.168.17.113][omm] device(dm-0) 'IO Request'=128, expect 256

WARN[2022-12-07T16:09:49.440] [192.168.17.113][omm] device(dm-1) 'IO Request'=128, expect 256

INFO[2022-12-07T16:09:50.257] [192.168.17.112][omm] kernel version: 3.10.0-693.el7.x86_64

INFO[2022-12-07T16:09:50.303] [192.168.17.113][omm] kernel version: 3.10.0-693.el7.x86_64

INFO[2022-12-07T16:09:50.312] [192.168.17.139][omm] kernel version: 3.10.0-693.el7.x86_64

INFO[2022-12-07T16:09:50.318] [192.168.17.112][omm] swap memory 0kB, total memory 16267496kB

INFO[2022-12-07T16:09:50.358] [192.168.17.113][omm] swap memory 0kB, total memory 16267496kB

INFO[2022-12-07T16:09:50.373] [192.168.17.139][omm] swap memory 0kB, total memory 10074432kB

INFO[2022-12-07T16:09:50.554] [192.168.17.139][omm] platform: centos_7_64bit

INFO[2022-12-07T16:09:50.554] [192.168.17.112][omm] platform: centos_7_64bit

INFO[2022-12-07T16:09:50.554] [192.168.17.113][omm] platform: centos_7_64bit

ERRO[2022-12-07T16:09:59.604] [192.168.17.139][omm] not found package: numactl

INFO[2022-12-07T16:10:03.249] [192.168.17.139][omm] check port 27000      

INFO[2022-12-07T16:10:03.249] [192.168.17.112][omm] check port 27000      

? executing...INFO[2022-12-07T16:10:03.249] [192.168.17.113][omm] check port 27000      

INFO[2022-12-07T16:10:03.452] [192.168.17.112][omm] port 27000 is free    

INFO[2022-12-07T16:10:03.688] [192.168.17.139][omm] port 27000 is free    

INFO[2022-12-07T16:10:04.041] [192.168.17.113][omm] port 27000 is free    

INFO[2022-12-07T16:10:04.149] [192.168.17.112][omm] locale: LANG=en_US.UTF-8

INFO[2022-12-07T16:10:04.181] [192.168.17.139][omm] locale: LANG=en_US.UTF-8

INFO[2022-12-07T16:10:04.186] [192.168.17.113][omm] locale: LANG=en_US.UTF-8

INFO[2022-12-07T16:10:06.718] [192.168.17.112][omm] timezone: +0800       

INFO[2022-12-07T16:10:06.815] [192.168.17.113][omm] timezone: +0800       

INFO[2022-12-07T16:10:06.818] [192.168.17.139][omm] timezone: +0800       

INFO[2022-12-07T16:10:06.818] all checkers finished                       

INFO[2022-12-07T16:10:06.818] write fix os script to root_fix_os.2022.1207.161006.sh success

INFO[2022-12-07T16:10:06.819] Time elapsed: 22s                           

# Check Results

                Item                |  Level   

------------------------------------+-----------

  A1.Check_OS_Version               | OK       

  A2.Check_Kernel_Version           | OK       

  A3.Check_Unicode                  | OK       

  A4.Check_TimeZone                 | OK       

  A5.Check_Swap_Memory_Configure    | OK       

  A6.Check_SysCtl_Parameter         | Warning  

  A7.Check_FileSystem_Configure     | OK       

  A8.Check_Disk_Configure           | OK       

  A9.Check_Logical_Block            | OK       

  A9.Check_BlockDev_Configure       | OK       

  A10.Check_IO_Request              | Warning  

  A10.Check_Asynchronous_IO_Request | OK       

  A10.Check_IO_Configure            | OK       

  A11.Check_Network_Configure       | OK       

  A12.Check_Time_Consistency        | OK       

  A13.Check_Firewall_Service        | OK       

  A14.Check_THP_Service             | OK       

  A15.Check_Dependent_Package       | Abnormal 

  A16.Check_CPU_Instruction_Set     | Abnormal 

  A17.Check_Port                    | OK       

Total count 20, abnormal count 2, warning count 2

Failed to check os, can’t perform installation unless fix all the abnormal items

You can use 'ptk checkos -i ITEM --detail' to get detail message

Please check root_fix_os.[TIMESTAMP].sh for commands to resolve.

# 确保输出的检查结果均为 OK 或 Warning ,如有 Abnormal 或 ExecuteError出现,需根据日志提示修正系统参数后再安装

每次执行ptk checkos -f config.yaml都会在当前目录下生成诸如 root_fix_os.年.月日.时分秒.sh这样的文件,查看该文件,如果提示缺少包,会在该sh脚本文件里提示,并可以按照该脚本来执行一些缺少的包,该文件内容如下。

[root@mogdb-db1 mogdb]# cat root_fix_os.2022.1207.161006.sh

#!/usr/bin/env bash

local_ips=$(ip addr | grep 'inet' | grep -v 'inet6\|127.0.0.1' | grep -v grep | awk -F '/' '{print $1}' | awk '{print $2}')

# fix suggestions for host: 192.168.17.139

for ip in ${local_ips}; do

if [[ "${ip}" == "192.168.17.139" ]]; then

yum install -y numactl

exit 0

fi

done

根据ptk checkos -f config.yaml执行的结果,可通过如下方式查看具体的告警信息。

[root@mogdb-db1 mogdb]# ptk checkos -i A6 --detail

INFO[2022-12-07T16:11:57.801] prechecking dependent tools...              

WARN[2022-12-07T16:11:58.007] [192.168.17.112][omm] vm.min_free_kbytes=813306, expect 813374

INFO[2022-12-07T16:11:58.025] [192.168.17.112][omm] check kernel.core_pattern

INFO[2022-12-07T16:11:58.033] [192.168.17.112][omm] check removeIPC value 

INFO[2022-12-07T16:11:58.039] all checkers finished                       

INFO[2022-12-07T16:11:58.039] Time elapsed: 0s                            

# Check Results

            Item            |  Level  |                              Message                               

----------------------------+---------+----------------------------------------------------------------

A6.Check_SysCtl_Parameter | Warning | [192.168.17.112] Warning: vm.min_free_kbytes=813306, expect 813374 

Total count 1, abnormal count 0, warning count 1

-- 根据提示进行修改设置

MogDBv3.0.3一主两备级联集群-3.5执行安装">3.5 执行安装

对于预检查的 一些Abnormal告警信息,本次选择采用如下安装方式暂时忽略。

-- root 用户执行

[root@mogdb-db1 ~]#  cd /opt/software/mogdb/

[root@mogdb-db1 mogdb]# ptk install --assumeyes --pkg /opt/software/mogdb/MogDB-3.0.3-CentOS-x86_64.tar.gz --skip-check-distro --skip-check-os --file=/opt/software/mogdb/config.yaml

# 执行过程及结果如下

INFO[2022-12-07T17:15:39.875] PTK Version: 0.5.5 release                  

INFO[2022-12-07T17:15:39.875] load config from /opt/software/mogdb/config.yaml

INFO[2022-12-07T17:15:40.700] skip check os                               

INFO[2022-12-07T17:15:40.700] skip check distro                           

INFO[2022-12-07T17:15:40.700] start check user ...                        

INFO[2022-12-07T17:15:40.795] check user success                          

INFO[2022-12-07T17:15:40.795] start check port ...                        

INFO[2022-12-07T17:15:41.605] check port success                          

INFO[2022-12-07T17:15:41.605] start prepare installation package ...      

INFO[2022-12-07T17:15:41.605] installation package is ready               

INFO[2022-12-07T17:15:41.606] start validate installation package ...     

INFO[2022-12-07T17:15:44.450] parsed kernel package name: MogDB-3.0.3-CentOS-64bit.tar.gz

INFO[2022-12-07T17:15:49.234] db product: MogDB, version: 3.0.3, number: 92.605, commit_id: 23ba838d

INFO[2022-12-07T17:15:49.235] validate installation package success       

INFO[2022-12-07T17:15:49.235] start complete the configuration ...        

INFO[2022-12-07T17:15:49.235] complete the configuration success          

INFO[2022-12-07T17:15:49.236] start distribute installation package ...   

> upload MogDB-3.0.3-CentOS-x...: 132.81 MiB / 132.81 MiB [----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 22.06 MiB p/s 6.2s

> upload MogDB-3.0.3-CentOS-x...: 132.81 MiB / 132.81 MiB [----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 22.06 MiB p/s 6.2s

INFO[2022-12-07T17:15:55.578] distrubite packages success                 

INFO[2022-12-07T17:15:55.578] start setup db ...                          

INFO[2022-12-07T17:15:55.584] [192.168.17.112][omm] create os user omm, group dbgrp

INFO[2022-12-07T17:15:55.628] [192.168.17.113][omm] create os user omm, group dbgrp

INFO[2022-12-07T17:15:55.637] [192.168.17.139][omm] create os user omm, group dbgrp

INFO[2022-12-07T17:15:55.805] [192.168.17.112][omm] set ulimit configs    

INFO[2022-12-07T17:15:55.810] [192.168.17.112][omm] set user omm profiles 

INFO[2022-12-07T17:15:55.939] [192.168.17.113][omm] set ulimit configs    

INFO[2022-12-07T17:15:55.984] [192.168.17.113][omm] set user omm profiles 

INFO[2022-12-07T17:15:55.987] [192.168.17.112][omm] check or set C library

INFO[2022-12-07T17:15:56.030] [192.168.17.139][omm] set ulimit configs    

INFO[2022-12-07T17:15:56.060] [192.168.17.112][omm] make dir(s): /opt/mogdb/tool,/opt/mogdb/tool/ptk_tool/bin

INFO[2022-12-07T17:15:56.124] [192.168.17.139][omm] set user omm profiles 

INFO[2022-12-07T17:15:56.696] [192.168.17.112][omm] decompress MogDB-3.0.3-CentOS-x86_64.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:15:56.902] [192.168.17.113][omm] check or set C library

INFO[2022-12-07T17:15:56.990] [192.168.17.113][omm] make dir(s): /opt/mogdb/tool,/opt/mogdb/tool/ptk_tool/bin

INFO[2022-12-07T17:15:57.089] [192.168.17.139][omm] check or set C library

INFO[2022-12-07T17:15:57.253] [192.168.17.139][omm] make dir(s): /opt/mogdb/tool,/opt/mogdb/tool/ptk_tool/bin

INFO[2022-12-07T17:15:57.718] [192.168.17.113][omm] decompress MogDB-3.0.3-CentOS-x86_64.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:15:58.067] [192.168.17.139][omm] decompress MogDB-3.0.3-CentOS-x86_64.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:15:58.706] [192.168.17.112][omm] decompress *-om.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:15:59.498] [192.168.17.112][omm] try to fix psutil python lib

WARN[2022-12-07T17:15:59.503] [192.168.17.112][omm]

Not found python3.6 or 3.7, skip fix psutil dynamic lib,

please install proper python and fix it manually or reinstall by ptk

if you don't fix this, it will cause that gs_om and cm_ctl cannot run properly, but not ptk and database

INFO[2022-12-07T17:15:59.503] [192.168.17.112][omm] write file /opt/mogdb/tool/ptk_tool/bin/README.md

INFO[2022-12-07T17:15:59.526] [192.168.17.112][omm] write file /opt/mogdb/tool/ptk_tool/bin/pscp

INFO[2022-12-07T17:15:59.550] [192.168.17.112][omm] write file /opt/mogdb/tool/ptk_tool/bin/pssh

INFO[2022-12-07T17:15:59.571] [192.168.17.112][omm] write file /opt/mogdb/tool/ptk_tool/bin/task_pool.py

INFO[2022-12-07T17:15:59.596] [192.168.17.112][omm] change /opt/mogdb/tool owner to omm

INFO[2022-12-07T17:15:59.610] [192.168.17.112][omm] make dir(s): /opt/mogdb/app

INFO[2022-12-07T17:15:59.842] [192.168.17.112][omm] decompress MogDB-3.0.3-CentOS-64bit.tar.gz to dir /opt/mogdb/app

INFO[2022-12-07T17:16:00.046] [192.168.17.139][omm] decompress *-om.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:16:00.061] [192.168.17.113][omm] decompress *-om.tar.gz to dir /opt/mogdb/tool

INFO[2022-12-07T17:16:00.726] [192.168.17.139][omm] try to fix psutil python lib

WARN[2022-12-07T17:16:00.784] [192.168.17.139][omm]

Not found python3.6 or 3.7, skip fix psutil dynamic lib,

please install proper python and fix it manually or reinstall by ptk

if you don't fix this, it will cause that gs_om and cm_ctl cannot run properly, but not ptk and database

INFO[2022-12-07T17:16:00.784] [192.168.17.139][omm] write file /opt/mogdb/tool/ptk_tool/bin/README.md

INFO[2022-12-07T17:16:00.980] [192.168.17.139][omm] write file /opt/mogdb/tool/ptk_tool/bin/pscp

INFO[2022-12-07T17:16:01.136] [192.168.17.113][omm] try to fix psutil python lib

INFO[2022-12-07T17:16:01.194] [192.168.17.139][omm] write file /opt/mogdb/tool/ptk_tool/bin/pssh

WARN[2022-12-07T17:16:01.203] [192.168.17.113][omm]

Not found python3.6 or 3.7, skip fix psutil dynamic lib,

please install proper python and fix it manually or reinstall by ptk

if you don't fix this, it will cause that gs_om and cm_ctl cannot run properly, but not ptk and database

INFO[2022-12-07T17:16:01.203] [192.168.17.113][omm] write file /opt/mogdb/tool/ptk_tool/bin/README.md

INFO[2022-12-07T17:16:01.337] [192.168.17.139][omm] write file /opt/mogdb/tool/ptk_tool/bin/task_pool.py

INFO[2022-12-07T17:16:01.435] [192.168.17.113][omm] write file /opt/mogdb/tool/ptk_tool/bin/pscp

INFO[2022-12-07T17:16:01.479] [192.168.17.139][omm] change /opt/mogdb/tool owner to omm

INFO[2022-12-07T17:16:01.534] [192.168.17.139][omm] make dir(s): /opt/mogdb/app

INFO[2022-12-07T17:16:01.721] [192.168.17.113][omm] write file /opt/mogdb/tool/ptk_tool/bin/pssh

INFO[2022-12-07T17:16:01.942] [192.168.17.139][omm] decompress MogDB-3.0.3-CentOS-64bit.tar.gz to dir /opt/mogdb/app

INFO[2022-12-07T17:16:02.053] [192.168.17.113][omm] write file /opt/mogdb/tool/ptk_tool/bin/task_pool.py

INFO[2022-12-07T17:16:02.375] [192.168.17.113][omm] change /opt/mogdb/tool owner to omm

INFO[2022-12-07T17:16:02.497] [192.168.17.113][omm] make dir(s): /opt/mogdb/app

INFO[2022-12-07T17:16:03.059] [192.168.17.113][omm] decompress MogDB-3.0.3-CentOS-64bit.tar.gz to dir /opt/mogdb/app

INFO[2022-12-07T17:16:05.397] [192.168.17.112][omm] fix dynamic linker for gs_initdb

INFO[2022-12-07T17:16:05.493] [192.168.17.112][omm] fix dynamic linker for mogdb

INFO[2022-12-07T17:16:05.631] [192.168.17.112][omm] change /opt/mogdb/app owner to omm

INFO[2022-12-07T17:16:05.661] [192.168.17.112][omm] make dir(s): /opt/mogdb/log/gs_profile,/opt/mogdb/log/pg_log,/opt/mogdb/log/pg_audit,/opt/mogdb/log/bin,/opt/mogdb/log/pg_log/dn_6001,/opt/mogdb/log/pg_audit/dn_6001

INFO[2022-12-07T17:16:06.749] [192.168.17.139][omm] fix dynamic linker for gs_initdb

INFO[2022-12-07T17:16:06.970] [192.168.17.139][omm] fix dynamic linker for mogdb

INFO[2022-12-07T17:16:07.202] [192.168.17.139][omm] change /opt/mogdb/app owner to omm

INFO[2022-12-07T17:16:07.317] [192.168.17.139][omm] make dir(s): /opt/mogdb/log/gs_profile,/opt/mogdb/log/pg_log,/opt/mogdb/log/pg_audit,/opt/mogdb/log/bin,/opt/mogdb/log/pg_log/dn_6003,/opt/mogdb/log/pg_audit/dn_6003

INFO[2022-12-07T17:16:08.961] [192.168.17.112][omm] make dir(s): /opt/mogdb/tmp

INFO[2022-12-07T17:16:09.068] [192.168.17.113][omm] fix dynamic linker for gs_initdb

INFO[2022-12-07T17:16:09.229] [192.168.17.112][omm] save version to upgrade_version

INFO[2022-12-07T17:16:09.330] [192.168.17.113][omm] fix dynamic linker for mogdb

INFO[2022-12-07T17:16:09.381] [192.168.17.112][omm] create file cluster_manual_start

INFO[2022-12-07T17:16:09.500] [192.168.17.112][omm] generate cluster_static_config file

INFO[2022-12-07T17:16:09.516] [192.168.17.112][omm] change /opt/mogdb/app/bin/cluster_static_config owner to omm

INFO[2022-12-07T17:16:09.523] [192.168.17.112][omm] make dir(s): /opt/mogdb/data

INFO[2022-12-07T17:16:09.545] [192.168.17.113][omm] change /opt/mogdb/app owner to omm

INFO[2022-12-07T17:16:09.653] [192.168.17.113][omm] make dir(s): /opt/mogdb/log/gs_profile,/opt/mogdb/log/pg_log,/opt/mogdb/log/pg_audit,/opt/mogdb/log/bin,/opt/mogdb/log/pg_log/dn_6002,/opt/mogdb/log/pg_audit/dn_6002

INFO[2022-12-07T17:16:09.782] [192.168.17.112][omm] change /opt/mogdb/data owner to omm

INFO[2022-12-07T17:16:09.789] [192.168.17.112][omm] the database is initializing, please wait a few minutes

INFO[2022-12-07T17:16:11.690] [192.168.17.139][omm] make dir(s): /opt/mogdb/tmp

INFO[2022-12-07T17:16:11.954] [192.168.17.139][omm] save version to upgrade_version

INFO[2022-12-07T17:16:12.182] [192.168.17.139][omm] create file cluster_manual_start

INFO[2022-12-07T17:16:12.290] [192.168.17.139][omm] generate cluster_static_config file

INFO[2022-12-07T17:16:12.346] [192.168.17.139][omm] change /opt/mogdb/app/bin/cluster_static_config owner to omm

INFO[2022-12-07T17:16:12.391] [192.168.17.139][omm] make dir(s): /opt/mogdb/data

INFO[2022-12-07T17:16:12.643] [192.168.17.139][omm] change /opt/mogdb/data owner to omm

INFO[2022-12-07T17:16:12.699] [192.168.17.139][omm] the database is initializing, please wait a few minutes

INFO[2022-12-07T17:16:14.099] [192.168.17.113][omm] make dir(s): /opt/mogdb/tmp

INFO[2022-12-07T17:16:14.369] [192.168.17.113][omm] save version to upgrade_version

INFO[2022-12-07T17:16:14.592] [192.168.17.113][omm] create file cluster_manual_start

INFO[2022-12-07T17:16:14.700] [192.168.17.113][omm] generate cluster_static_config file

INFO[2022-12-07T17:16:14.760] [192.168.17.113][omm] change /opt/mogdb/app/bin/cluster_static_config owner to omm

INFO[2022-12-07T17:16:14.816] [192.168.17.113][omm] make dir(s): /opt/mogdb/data

INFO[2022-12-07T17:16:15.123] [192.168.17.113][omm] change /opt/mogdb/data owner to omm

INFO[2022-12-07T17:16:15.202] [192.168.17.113][omm] the database is initializing, please wait a few minutes

INFO[2022-12-07T17:16:36.930] [192.168.17.112][omm] config postgresql.conf

INFO[2022-12-07T17:16:37.162] [192.168.17.112][omm] config pg_hba.conf    

INFO[2022-12-07T17:16:40.917] [192.168.17.113][omm] config postgresql.conf

INFO[2022-12-07T17:16:41.024] [192.168.17.139][omm] config postgresql.conf

INFO[2022-12-07T17:16:41.089] [192.168.17.113][omm] config pg_hba.conf    

INFO[2022-12-07T17:16:41.219] [192.168.17.139][omm] config pg_hba.conf    

INFO[2022-12-07T17:16:41.453] setup db success                            

INFO[2022-12-07T17:16:41.454] generate certification files                

INFO[2022-12-07T17:16:42.567] download certification files                

INFO[2022-12-07T17:16:42.684] upload certification files to (192.168.17.113,omm)

INFO[2022-12-07T17:16:44.055] upload certification files to (192.168.17.139,omm)

INFO[2022-12-07T17:16:44.996] certification files setup success           

INFO[2022-12-07T17:16:44.996] start build ssh trust ...                   

INFO[2022-12-07T17:16:46.047] ssh trust build success                     

INFO[2022-12-07T17:16:46.048] start launch db ...                         

INFO[2022-12-07T17:16:46.048] [192.168.17.113][omm] start db by gs_ctl ...

INFO[2022-12-07T17:16:46.048] [192.168.17.112][omm] start db by gs_ctl ...

INFO[2022-12-07T17:16:46.048] [192.168.17.112][omm] the database is starting, please wait a few minutes

INFO[2022-12-07T17:16:46.048] [192.168.17.139][omm] start db by gs_ctl ...

INFO[2022-12-07T17:16:46.049] [192.168.17.139][omm] the database is starting, please wait a few minutes

INFO[2022-12-07T17:16:46.048] [192.168.17.113][omm] the database is starting, please wait a few minutes

INFO[2022-12-07T17:16:48.354] [192.168.17.112][omm] start db success      

INFO[2022-12-07T17:16:48.354] [192.168.17.112][omm] start alter db initial password ...

INFO[2022-12-07T17:16:48.569] [192.168.17.112][omm] alter db password success

INFO[2022-12-07T17:16:48.648] [192.168.17.113][omm] start db success      

INFO[2022-12-07T17:16:48.840] [192.168.17.139][omm] start db success      

INFO[2022-12-07T17:16:48.841] build standbys ...                          

INFO[2022-12-07T17:16:48.841] [192.168.17.113][omm] start build db ...    

INFO[2022-12-07T17:16:48.841] [192.168.17.113][omm] the database is building from upstream,  please wait a few minutes

INFO[2022-12-07T17:17:01.595] [192.168.17.113][omm] build db success      

INFO[2022-12-07T17:17:01.595] standbys build success                      

INFO[2022-12-07T17:17:01.595] build cascade standbys ...                  

INFO[2022-12-07T17:17:01.595] [192.168.17.139][omm] start build db ...    

INFO[2022-12-07T17:17:01.595] [192.168.17.139][omm] the database is building from upstream,  please wait a few minutes

INFO[2022-12-07T17:17:15.634] [192.168.17.139][omm] build db success      

INFO[2022-12-07T17:17:15.634] cascade standbys build success              

INFO[2022-12-07T17:17:15.634] launch db success                           

INFO[2022-12-07T17:17:15.634] clear temp dirs ...                         

INFO[2022-12-07T17:17:15.730] clear temp dirs success                     

INFO[2022-12-07T17:17:15.731] Time elapsed: 1m35s                         

   cluste_name  |      host      | user | port  |    status     | message 

----------------+----------------+------+-------+---------------+----------

  cluster_mogdb | 192.168.17.112 | omm  | 27000 | start_success | success 

                | 192.168.17.113 | omm  | 27000 | start_success | success 

                | 192.168.17.139 | omm  | 27000 | start_success | success

MogDBv3.0.3一主两备级联集群-3.6查看实例信息">3.6 查看实例信息

[root@mogdb-db1 opt]# ptk ls

  cluster_name  |  id  |         addr         | user |    data_dir     |          db_version          |     create_time     | comment 

----------------+------+----------------------+------+-----------------+------------------------------+---------------------+----------

  cluster_mogdb | 6001 | 192.168.17.112:27000 | omm  | /opt/mogdb/data | MogDB 3.0.3 (build 23ba838d) | 2022-12-07 17:15:49 |         

                | 6002 | 192.168.17.113:27000 | omm  | /opt/mogdb/data |                              |                     |         

                | 6003 | 192.168.17.139:27000 | omm  | /opt/mogdb/data |

MogDBv3.0.3一主两备级联集群-3.7查看集群状态">3.7 查看集群状态

[root@mogdb-db1 mogdb]# ptk cluster -n cluster_mogdb status

[   Cluster State   ]

database_version                        : MogDB 3.0.3 (build 23ba838d)

cluster_name                            : cluster_mogdb

cluster_state                           : Normal

[  Datanode State   ]

  cluster_name  |  id  |       ip       | port  | user | nodename |     db_role     | state  |    upstream    

----------------+------+----------------+-------+------+----------+-----------------+--------+-----------------

  cluster_mogdb | 6001 | 192.168.17.112 | 27000 | omm  | dn_6001  | primary         | Normal | -              

                | 6002 | 192.168.17.113 | 27000 | omm  | dn_6002  | standby         | Normal | -              

                | 6003 | 192.168.17.139 | 27000 | omm  | dn_6003  | cascade_standby | Normal | 192.168.17.113

MogDBv3.0.3一主两备级联集群-3.8访问数据库">3.8 访问数据库

MogDBv3.0.3一主两备级联集群-3.8.1访问数据库">3.8.1 访问数据库

[omm@mogdb-db1 ~]$ gsql -d postgres -p 27000

gsql ((MogDB 3.0.3 build 23ba838d) compiled at 2022-10-22 09:50:41 commit 0 last mr  )

Non-SSL connection (SSL connection is recommended when requiring high-security)

Type "help" for help.

MogDB=# \l

                                 List of databases

   Name    | Owner | Encoding | Collate | Ctype | Access privileges | Compatibility

-----------+-------+----------+---------+-------+-------------------+---------------

 postgres  | omm   | UTF8     | C       | C     |                   | A

 template0 | omm   | UTF8     | C       | C     | =c/omm           +| A

           |       |          |         |       | omm=CTc/omm       |

 template1 | omm   | UTF8     | C       | C     | =c/omm           +| A

           |       |          |         |       | omm=CTc/omm       |

(3 rows)

MogDB=# \db

      List of tablespaces

    Name    | Owner | Location

------------+-------+----------

 pg_default | omm   |

 pg_global  | omm   |

(2 rows)

MogDB=# \dn+

                                         List of schemas

      Name       | Owner | Access privileges |           Description            | WithBlockChain

-----------------+-------+-------------------+----------------------------------+----------------

 blockchain      | omm   |                   | blockchain schema                | f

 cstore          | omm   |                   | reserved schema for DELTA tables | f

 db4ai           | omm   | omm=UC/omm       +| db4ai schema                     | f

                 |       | =U/omm            |                                  |

 dbe_perf        | omm   |                   | dbe_perf schema                  | f

 dbe_pldebugger  | omm   | omm=UC/omm       +| dbe_pldebugger schema            | f

                 |       | =U/omm            |                                  |

 dbe_pldeveloper | omm   | omm=UC/omm       +| dbe_pldeveloper schema           | f

                 |       | =U/omm            |                                  |

 pkg_service     | omm   |                   | pkg_service schema               | f

 public          | omm   | omm=UC/omm       +| standard public schema           | f

                 |       | =U/omm            |                                  |

 snapshot        | omm   |                   | snapshot schema                  | f

 sqladvisor      | omm   | omm=UC/omm       +| sqladvisor schema                | f

                 |       | =U/omm            |                                  |

(10 rows)

可以看到MogDB的访问方式和openGauss一样。

MogDBv3.0.3一主两备级联集群-3.8.2查询数据库信息">3.8.2 查询数据库信息

查询数据库版本信息

[omm@mogdb-db1 ~]$ gsql -d postgres -p 27000

gsql ((MogDB 3.0.3 build 23ba838d) compiled at 2022-10-22 09:50:41 commit 0 last mr  )

Non-SSL connection (SSL connection is recommended when requiring high-security)

Type "help" for help.

MogDB=# show server_version;

 server_version

----------------

 9.2.4

(1 row)

MogDB=# SELECT * FROM pg_settings WHERE NAME='server_version';

      name      | setting | unit |    category    |        short_desc         | extra_desc | context  | vartype | source  | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline

----------------+---------+------+----------------+---------------------------+------------+----------+---------+---------+---------+---------+----------+----------+-----------+------------+------------

 server_version | 9.2.4   |      | Preset Options | Shows the server version. |            | internal | string  | default |         |         |          | 9.2.4    | 9.2.4     |            |          

(1 row)

可以看到MogDB 3.0 同 openGauss 3.0 一样也是基于 postgres 9.2.4 基础上开发的。

MogDBv3.0.3一主两备级联集群-四、卸载MogDB集群">四、卸载MogDB集群

卸载MogDB集群时,要先停集群,然后再进行卸载,/opt/mogdb卸载后需手工删除。

[root@mogdb-db1 mogdb]# ptk cluster -n cluster_mogdb stop

INFO[2022-12-07T17:33:18.781] operation: stop                             

INFO[2022-12-07T17:33:18.782] ========================================    

INFO[2022-12-07T17:33:18.782] stop db [192.168.17.139:27000] ...          

INFO[2022-12-07T17:33:20.041] stop db [192.168.17.139:27000] successfully 

INFO[2022-12-07T17:33:20.041] stop db [192.168.17.113:27000] ...          

INFO[2022-12-07T17:33:21.304] stop db [192.168.17.113:27000] successfully 

INFO[2022-12-07T17:33:21.304] stop db [192.168.17.112:27000] ...          

INFO[2022-12-07T17:33:22.480] stop db [192.168.17.112:27000] successfully 

INFO[2022-12-07T17:33:22.480] ========================================    

INFO[2022-12-07T17:33:22.480] stop successfully                           

[root@mogdb-db1 mogdb]#

[root@mogdb-db1 mogdb]# ptk uninstall -n cluster_mogdb  

INFO[2022-12-07T17:33:37.842] PTK Version: 0.5.5 release                  

Cluster Name: "cluster_mogdb"

+--------------+----------------+-------------+-------+-----------------+-----------------+----------------+

| az(priority) |       ip       | user(group) | port  |      role       |    data dir     |    upstream    |

+--------------+----------------+-------------+-------+-----------------+-----------------+----------------+

| BJ(1)        | 192.168.17.112 | omm(dbgrp)  | 27000 | primary         | /opt/mogdb/data | -              |

| SH(2)        | 192.168.17.113 | omm(dbgrp)  | 27000 | standby         | /opt/mogdb/data | -              |

| GZ(3)        | 192.168.17.139 | omm(dbgrp)  | 27000 | cascade_standby | /opt/mogdb/data | 192.168.17.113 |

+--------------+----------------+-------------+-------+-----------------+-----------------+----------------+

Do you really want to uninstall this cluster? Please confirm carefully[Y/N](default=N) Y

Do you want to delete db data?[Y/N](default=N) Y

Do you want to delete os user?[Y/N](default=N) Y

INFO[2022-12-07T17:33:44.200] check db dirs owner                           host=192.168.17.112

INFO[2022-12-07T17:33:44.201] check db dirs owner                           host=192.168.17.113

INFO[2022-12-07T17:33:44.201] check db dirs owner                           host=192.168.17.139

INFO[2022-12-07T17:33:44.222] check db process status                       host=192.168.17.112

INFO[2022-12-07T17:33:44.390] check db process status                       host=192.168.17.113

INFO[2022-12-07T17:33:44.408] check db process status                       host=192.168.17.139

INFO[2022-12-07T17:33:44.535] clean crontab                                 host=192.168.17.112

INFO[2022-12-07T17:33:44.535] clean crontab                                 host=192.168.17.113

INFO[2022-12-07T17:33:44.535] clean crontab                                 host=192.168.17.139

INFO[2022-12-07T17:33:44.691] kill omm's processes                          host=192.168.17.112

INFO[2022-12-07T17:33:44.755] kill omm's processes                          host=192.168.17.139

INFO[2022-12-07T17:33:44.803] kill omm's processes                          host=192.168.17.113

INFO[2022-12-07T17:33:44.906] remove files /opt/mogdb/app,/opt/mogdb/tool,/opt/mogdb/tmp,/opt/mogdb/data,/opt/mogdb/log,/opt/mogdb/cm  host=192.168.17.112

INFO[2022-12-07T17:33:44.991] remove files /opt/mogdb/app,/opt/mogdb/tool,/opt/mogdb/tmp,/opt/mogdb/data,/opt/mogdb/log,/opt/mogdb/cm  host=192.168.17.139

INFO[2022-12-07T17:33:45.180] remove files /opt/mogdb/app,/opt/mogdb/tool,/opt/mogdb/tmp,/opt/mogdb/data,/opt/mogdb/log,/opt/mogdb/cm  host=192.168.17.113

INFO[2022-12-07T17:33:45.342] delete os user omm                            host=192.168.17.139

INFO[2022-12-07T17:33:45.468] delete os user omm                            host=192.168.17.112

INFO[2022-12-07T17:33:45.548] clearing /etc/cron.allow                      host=192.168.17.139

INFO[2022-12-07T17:33:45.568] clearing /etc/cron.allow                      host=192.168.17.112

INFO[2022-12-07T17:33:45.577] delete os user omm                            host=192.168.17.113

INFO[2022-12-07T17:33:45.580] clearing /etc/security/limits.conf            host=192.168.17.112

INFO[2022-12-07T17:33:45.648] clearing /etc/security/limits.conf            host=192.168.17.139

INFO[2022-12-07T17:33:45.835] clearing /etc/cron.allow                      host=192.168.17.113

INFO[2022-12-07T17:33:45.953] clearing /etc/security/limits.conf            host=192.168.17.113

-- 卸载集群前应该先停止集群,否则直接卸载会报如下提示

[192.168.17.112omm]: db process still alive (pid[4482]), please stop it first

[192.168.17.113omm]: db process still alive (pid[7368]), please stop it first

[192.168.17.139omm]: db process still alive (pid[9238]), please stop it first


http://www.ppmy.cn/news/1558029.html

相关文章

Go by Example学习

2024.12.21 000array slicemaprange函数结构体接口 参考资料&#xff1a; https://gobyexample-cn.github.io/ 000 package mainimport ("fmt""math" )const s string "constant"func main() {fmt.Println("hello world")var a &qu…

es 3期 第18节-分页查询使用避坑的一些事

#### 1.Elasticsearch是数据库&#xff0c;不是普通的Java应用程序&#xff0c;传统数据库需要的硬件资源同样需要&#xff0c;提升性能最有效的就是升级硬件。 #### 2.Elasticsearch是文档型数据库&#xff0c;不是关系型数据库&#xff0c;不具备严格的ACID事务特性&#xff…

ECharts散点图-气泡图,附视频讲解与代码下载

引言&#xff1a; ECharts散点图是一种常见的数据可视化图表类型&#xff0c;它通过在二维坐标系或其它坐标系中绘制散乱的点来展示数据之间的关系。本文将详细介绍如何使用ECharts库实现一个散点图&#xff0c;包括图表效果预览、视频讲解及代码下载&#xff0c;让你轻松掌握…

websocket的心跳检测和断线重连

心跳检测和断线重连可以通过WebSocket的事件和属性来实现。以下是一个简单的JavaScript示例&#xff0c;使用WebSocket API实现心跳检测和断线重连的功能&#xff1a; let ws;function connectWebSocket() {ws new WebSocket(ws://your-websocket-server-url);ws.onopen fun…

【uni-app】2025最新uni-app一键登录保姆级教程(包含前后端获取手机号方法)(超强避坑指南)

前言&#xff1a; 最近在配置uni-app一键登录时遇到了不少坑&#xff0c;uni-app的配套文档较为混乱&#xff0c;并且有部分更新的内容也没有及时更改在文档上&#xff0c;导致部分开发者跟着uni-app配套文档踩坑&#xff01;而目前市面上的文章质量也层次不齐&#xff0c;有的…

基于Spring Boot的动漫交流与推荐平台

一、开发背景与意义 动漫产业的蓬勃发展&#xff1a;随着动漫产业的不断壮大&#xff0c;动漫文化逐渐深入人心&#xff0c;吸引了大量爱好者。这一趋势推动了动漫作品的多样化和创新&#xff0c;同时也促进了相关产业的发展。 传统交流方式的局限性&#xff1a;传统的动漫交流…

ffmpeg.exe 命令使用

1. 视频分片&#xff1a;裁剪分割视频成小片段&#xff0c; ffmpeg Documentation Seeking – FFmpeg 1.指定持续时间 使用-t命令。前者要比后者快。 ffmpeg -ss [start] -i [input] -t [duration] -c copy [output] ffmpeg -i [input] -ss [start] -t [duration] -c cop…

告别卡顿:CasaOS轻NAS设备安装Gopeed打造高效下载环境

文章目录 前言1. 更新应用中心2.Gopeed安装与配置3. 本地下载测试4. 安装内网穿透工具5. 配置公网地址6. 配置固定公网地址 前言 无论你是需要大量文件传输的专业人士&#xff0c;还是只是想快速下载电影或音乐的普通用户&#xff0c;都会使用到下载工具。如果你对现有的下载工…