前言

openGauss社区全新升级社区工具DataKit,其集成目前openGauss所有相关工具,形成工具超市,开发和运维人员可快速按需找到所需工具,方便快捷

📣 1.openGauss Datakit

openGaussDatakit让运维如丝般顺滑!-LMLPHP

✨ 1.1 原理简介

✨ 1.2 特性优势

📣 2.安装包下载解压

openGaussDatakit让运维如丝般顺滑!-LMLPHP

📣 3.安装openGauss数据库

openGaussDatakit让运维如丝般顺滑!-LMLPHP

✨ 3.1 前提条件

已完成用户组和普通用户的创建。
所有服务器操作系统和网络均正常运行。
普通用户必须有数据库包解压路径、安装路径的读、写和执行操作权限,并且安装路径必须为空。
普通用户对下载的openGauss压缩包有执行权限。
安装前请检查指定的openGauss端口是否被占用,如果被占用请更改端口或者停止当前使用端口进程。

##host设置
echo "192.168.6.20 centos79" >>/etc/hosts

/etc/security/limits.conf内的值修改
* hard nofile 1048576
* soft nofile 1048576

##java jdk安装 jdk-11.0.21_linux-x64_bin.rpm
https://www.oracle.com/java/technologies/downloads/#java11

[root@centos79 opt]# rpm -ivh jdk-11.0.21_linux-x64_bin.rpm
warning: jdk-11.0.21_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk-11-2000:11.0.21-9            ################################# [100%]
   
##关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

✨ 3.2 用户及组

✨ 3.3 解压安装包

✨ 3.4 安装openGauss

openGaussDatakit让运维如丝般顺滑!-LMLPHP

#登录opengauss
[opengauss@centos79 ~]$ gsql -d postgres
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# \l
                                   List of databases
   Name    |   Owner   | Encoding |   Collate   |    Ctype    |    Access privileges    
-----------+-----------+----------+-------------+-------------+-------------------------
 finance   | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 school    | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss           +
           |           |          |             |             | opengauss=CTc/opengauss
 template1 | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss           +
           |           |          |             |             | opengauss=CTc/opengauss
(5 rows)

✨ 3.5 参数修改

##编辑 postgresql.conf
[opengauss@centos79 ~]$ cd $GAUSSHOME/data/single_node
修改下面两个参数
listen_addresses = '*'
max_connections = 1000


##编辑 pg_hba.conf
文末追加
host    all             all             0.0.0.0/0                 sha256

重启openGauss服务
gs_ctl restart -D $GAUSSHOME/data/single_node -Z single_node

登录数据库
[opengauss@centos79 ~]$ gsql -d postgres

修改openGauss密码即可
ALTER ROLE opengauss PASSWORD 'Admin@123';

创建用户
CREATE USER jeames IDENTIFIED BY  'jeames@123';

授权
alter user jeames sysadmin;

创建数据库
create database admindb;

📣 4 jar离线部署Datakit

✨ 4.1 datakit工作目录

✨ 4.2 修改配置文件

将配置文件application-temp.yml 复制到 /app/ogdatakit/config/下
修改application-temp.yml文件中的数据链链接ip、port、database、dbuser、dbpassword。

[root@centos79 ~]# cp /opt/application-temp.yml /app/ogdatakit/config/
[root@centos79 ~]# chmod 755 -R /app/ogdatakit
[root@centos79 ~]# chown opengauss:dbgroup -R /app/ogdatakit


修改如下部分内容
vi /app/ogdatakit/config/application-temp.yml

system:
  # File storage path
  defaultStoragePath: /ops/files
  # Whitelist control switch
  whitelist:
    enabled: false
server:
  port: 9494
  ssl:
    key-store: /home/opengauss/ssl/keystore.p12
    key-store-password: 123456
    key-store-type: PKCS12
    enabled: true
  servlet:
    context-path: /
logging:
  file:
    path: /home/opengauss/server/openGauss-visualtool/logs/
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: org.opengauss.Driver
    url: jdbc:opengauss://192.168.6.20:5432/admindb?currentSchema=public
    username: jeames
    password: jeames@123
    druid:
      test-while-idle: false
      test-on-borrow: true
      validation-query: "select 1"
      validation-query-timeout: 10000
      connection-error-retry-attempts: 0
      break-after-acquire-failure: true
      max-wait: 3000
management:
  server:
    port: 9494

openGaussDatakit让运维如丝般顺滑!-LMLPHP

✨ 4.3. 创建ssl文件

keytool -genkey 命令用于创建 SSL 文件(包括密钥对和证书),并且它与 JDK(Java Development Kit)是有关系的。
keytool 是 JDK 提供的一个工具,用于管理密钥库和证书,用于加密和身份验证等安全通信。

切换到openJDK11环境,并验证版本
alternatives --config java
java -version


[root@centos79 ~]# mkdir -p /ops/ssl/
[root@centos79 ~]# chmod 755 -R /ops/ssl/
[root@centos79 ~]# chown opengauss:dbgroup -R /ops/ssl/
[root@centos79 ~]# su - opengauss

keytool -genkey -noprompt \
    -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Beijing, S=Beijing, C=CN"\
    -alias opengauss\
    -storetype PKCS12 \
    -keyalg RSA \
    -keysize 2048 \
    -keystore /home/opengauss/ssl/keystore.p12 \
    -validity 3650 \
    -storepass 123456

openGaussDatakit让运维如丝般顺滑!-LMLPHP

✨ 3.6 启动命令

[root@centos79 ~]# su  - opengauss

nohup java -Xms2048m -Xmx4096m -jar /app/ogdatakit/visualtool-main.jar \
--spring.profiles.active=temp >/app/ogdatakit/logs/visualtool-main.out 2>&1 &


##查看日志
tail -200f /app/ogdatakit/logs/visualtool-main.out

在浏览器中打开如下地址:https://192.168.6.20:9494
平台默认的登录账号密码:admin/admin123,请在首次登录后及时修改密码。

openGaussDatakit让运维如丝般顺滑!-LMLPHP
openGaussDatakit让运维如丝般顺滑!-LMLPHP

10-24 17:29