首页 > 其他分享 >openGauss Datakit安装部署

openGauss Datakit安装部署

时间:2023-04-12 14:12:08浏览次数:52  
标签:ops 部署 server Datakit visualtool openGauss echo config

一、问题描述:目前找不到任何关于opengauuss Datakit安装部署的文档,自己来尝试踩坑。

DataKit是一个以资源(物理机,数据库)为底座的开发运维工具,将上层的开发运维工具插件化,各插件之间相互独立,方便用户按需引入。各插件围绕DataKit的资源中心进行扩展开,完成数据库的运维,监控,迁移,开发,建模等复杂的操作。

Datakit安装部署在服务器上,是一个自动化运维的平台。可以部署不同类型的插件来实现不同的功能,是跟随opengauss5.0发布的新软件,也可以用来监控小于5.0的opengauss版本

 

二、环境准备:

Datakit官方文档:https://docs.opengauss.org/zh/docs/5.0.0/docs/ToolandCommandReference/DataKit.html

DataKit使用文档和开发文档:https://gitee.com/opengauss/openGauss-workbench/tree/master/openGauss-visualtool/doc

openGauss-workbench下载链接:https://gitee.com/opengauss/openGauss-workbench.git

Datakit下载链接:https://opengauss.org/zh/download/

JDK下载链接:https://www.oracle.com/in/java/technologies/javase/jdk11-archive-downloads.html#license-lightbox

 

linux操作系统的jdk版本要与datakit打的jar包jdk版本保持一致,要不然通过不了

 

 

 

 

三、安装部署

部署环境:redhat7,opengauss3.0.3,Datakit5.0

1.上传压缩包

# 此时如果没有/ops/server/openGauss-visualtool目录,可以临时手动创建,也可以把这一步在初始化环境中进行解压
[root@test01 tmp]# tar -xvf Datakit-5.0.0.tar.gz -C /ops/server/openGauss-visualtool

jdk手动安装
workbench-master有启动和初始化的脚本可以拿来用
datakit除了visualtool-main.jar 放在/ops/server/openGauss-visualtool目录中,其余几个打包好的插件需要放在/ops/server/openGauss-visualtool/visualtool-plugin/ 目录中

 

2.更新jdk版本,如果需要

# 检查
rpm -qa | grep java rpm -qa | grep jdk
# 卸载 rpm -qa | grep java | xargs rpm -e --nodeps rpm -qa | grep jdk | xargs rpm -e --nodeps
# 安装
rpm -ivh jdk-11.0.17_linux-x64_bin.rpm
# 验证
[root@test01 tmp]# java -version
java version "11.0.17" 2022-10-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.17+10-LTS-269)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.17+10-LTS-269, mixed mode)

 

3.创建远程用户

# 创建用户
openGauss=# CREATE USER jack WITH MONADMIN password "xxxxxxxx"; openGauss=# alter user jack sysadmin;
# 写入pg_hba.conf文件
[omm@test01 ~]$ gs_guc set -N all -I all -h "host all jack 192.168.1.0/24 sha256"

 

4.编辑安装和启动脚本

安装脚本在\openGauss-workbench-master\openGauss-workbench-master\openGauss-visualtool中

 

 

 使用安装脚本初始化环境,或者使用https://docs.opengauss.org/zh/docs/5.0.0/docs/ToolandCommandReference/DataKit.html文档中初始化环境,安装脚本需要修改一下。如果脚本执行不顺畅,也可以手动跑脚本中的内容,保障目录正常,以及加密文件生成

# 创建ops用户
useradd -m ops
vim install.sh
#!/usr/bin/env bash echo "begin install..." #sh ./uninstall.sh read -p "Do you want to automatically install dependencies (JDK, maven, node) ? (Press y|Y for Yes, any other key for No). " install_depency if [ "$install_depency" = "Y" -o "$install_depency" = "y" ]; then #sh ./install-depency.sh else echo "Please install the dependencies required by the system by yourself, including openjdk (11), maven (3), and node (16.15.1)." exit 1 fi read -p "Please enter the host of openGauss, Please ensure that the current host IP is in the whitelist of openGauss: " host if [ ! -n "$host" ]; then echo "Host cannot be empty." exit 1 fi read -p "Please enter the port of openGauss.: " port if [ ! -n "$port" ]; then echo "Port cannot be empty." exit 1 fi read -p "Please enter the database of openGauss.: " database if [ ! -n "$database" ]; then echo "Database cannot be empty." exit 1 fi read -p "Please enter the username of openGauss.: " username if [ ! -n "$username" ]; then echo "Username cannot be empty." exit 1 fi stty -echo read -p "Please enter the password of openGauss.: " password if [ ! -n "$password" ]; then echo "Password cannot be empty." exit 1 fi stty echo echo "host: $host, port: $port username: $username database: $database" cp config/application-temp.yml config/application-cus.yml sed -i "23s/ip:port/$host:$port/" config/application-cus.yml sed -i "23s/database/$database/" config/application-cus.yml sed -i "24s/dbuser/$username/" config/application-cus.yml sed -i "25s/dbpassword/$password/" config/application-cus.yml #mvn clean install -P prod -Dmaven.test.skip=true mkdir -p /ops/server/openGauss-visualtool/ mkdir -p /ops/files/ mkdir -p /ops/server/openGauss-visualtool/logs/ mkdir -p /ops/server/openGauss-visualtool/config/ mkdir -p /ops/ssl/ if [ ! -f "/ops/ssl/keystore.p12" ];then 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 /ops/ssl/keystore.p12 \ -validity 3650 \ -storepass 123456 fi echo "SSL is enabled, you can replace the keystore file at /ops/ssl/ folder and config the ssl options at file /ops/server/openGauss-visualtool/config/application-cus.yml" touch /ops/server/openGauss-visualtool/logs/visualtool-main.out cp visualtool-api/target/visualtool-main.jar /ops/server/openGauss-visualtool/ mv config/application-cus.yml /ops/server/openGauss-visualtool/config/ chown -R ops:ops /ops echo "end install"

 

编辑启动脚本

#!/usr/bin/env bash

SERVER_HOME=/ops/server/openGauss-visualtool
cd $SERVER_HOME
API_NAME=visualtool-main
JAR_NAME=$SERVER_HOME/$API_NAME\.jar
LOG=$SERVER_HOME/logs/$API_NAME\.out
PID=$SERVER_HOME/$API_NAME\.pid

usage() {
    echo "Usage: sh server.sh [start|stop|restart|status]"
    exit 1
}

is_exist(){
  pid=`ps -ef|grep $JAR_NAME|grep -v grep|awk '{print $2}' `
  if [ -z "${pid}" ]; then
   return 1
  else
    return 0
  fi
}

start(){
  is_exist
  if [ $? -eq "0" ]; then
    echo ">>> ${JAR_NAME} is already running PID=${pid} <<<"
  else
    echo '' > $LOG
    nohup java -Xms2048m -Xmx4096m -jar $JAR_NAME --spring.profiles.active=cus >$LOG 2>&1 &
    echo $! > $PID
    echo ">>> start $JAR_NAME successed PID=$! <<<"
   fi
  }

stop(){
  pidf=$(cat $PID)
  echo ">>> ${API_NAME} PID = $pidf begin kill $pidf <<<"
  kill $pidf
  rm -rf $PID
  sleep 2
  is_exist
  if [ $? -eq "0" ]; then
    echo ">>> ${API_NAME} 2 PID = $pid begin kill -9 $pid  <<<"
    kill -9  $pid
    sleep 2
    echo ">>> $JAR_NAME process stopped <<<"
  else
    echo ">>> ${JAR_NAME} is not running <<<"
  fi
}

status(){
  is_exist
  if [ $? -eq "0" ]; then
    echo ">>> ${JAR_NAME} is running PID is ${pid} <<<"
  else
    echo ">>> ${JAR_NAME} is not running <<<"
  fi
}

restart(){
  stop
  start
}

case "$1" in
  "start")
    start
    ;;
  "stop")
    stop
    ;;
  "status")
    status
    ;;
  "restart")
    restart
    ;;
  *)
    usage
    ;;
esac
exit 0
}

5.初始化环境

[root@test01 openGauss-visualtool]# mv application-temp.yml ./config/
[root@test01 openGauss-visualtool]# ./install.sh
begin install...
sh: ./uninstall.sh: No such file or directory
Do you want to automatically install dependencies (JDK, maven, node) ? (Press y|Y for Yes, any other key for No). Y
sh: ./install-depency.sh: No such file or directory
Please enter the host of openGauss, Please ensure that the current host IP is in the whitelist of openGauss: 10.83.239.211
Please enter the port of openGauss.: 26000
Please enter the database of openGauss.: postgres
Please enter the username of openGauss.: jack
Please enter the password of openGauss.: host: 192.168.163.21, port: 26000  username: jack database: postgres
SSL is enabled, you can replace the keystore file at /ops/ssl/ folder and config the ssl options at file /ops/server/openGauss-visualtool/config/application-cus.yml
cp: cannot stat ‘visualtool-api/target/visualtool-main.jar’: No such file or directory
mv: ‘config/application-cus.yml’ and ‘/ops/server/openGauss-visualtool/config/application-cus.yml’ are the same file
end install

 

[root@hktestmysqldb01 openGauss-visualtool]# ll config/
total 8
-rw------- 1 ops ops 873 Apr 11 16:42 application-cus.yml
-rw-r--r-- 1 ops ops 865 Mar 28 20:47 application-temp.yml
[root@hktestmysqldb01 openGauss-visualtool]# pwd
/ops/server/openGauss-visualtool

 

6. 启动服务

# 把模板移动到插件目录下。也可以后期启动好平台后手动补入插件
[ops@test01 openGauss-visualtool]$ mkdir -p /ops/server/openGauss-visualtool/visualtool-plugin
[ops@test01 openGauss-visualtool]$ mv base-ops-5.0.0-repackage.jar ./visualtool-plugin/
[ops@test01 openGauss-visualtool]$ mv data-migration-5.0.0-repackage.jar ./visualtool-plugin/
[ops@test01 openGauss-visualtool]$ mv observability-instance-5.0.0-repackage.jar ./visualtool-plugin/
[ops@test01 openGauss-visualtool]$ mv observability-log-search-5.0.0-repackage.jar ./visualtool-plugin/
[ops@test01 openGauss-visualtool]$ mv observability-sql-diagnosis-5.0.0-repackage.jar ./visualtool-plugin/
[ops@test01 openGauss-visualtool]$ mv webds-plugin-5.0.0-repackage.jar ./visualtool-plugin/

# ./server.sh start/stop/restart
[ops@test01 openGauss-visualtool]$ ./server.sh restart
>>> visualtool-main PID = 45148 begin kill 45148 <<<

>>> /ops/server/openGauss-visualtool/visualtool-main.jar is not running <<<
>>> start /ops/server/openGauss-visualtool/visualtool-main.jar successed PID=46530 <<<

 

7.检查是否启动成功

/ops/server/openGauss-visualtool/logs/visualtool-main.out 会记录实时日志

[root@test01 ~]# netstat -ntpl | grep 9494
tcp        0      0 0.0.0.0:9494            0.0.0.0:*               LISTEN      46530/java

前台访问链接:https://192.168.163.21:9494/

插件管理,如果没有做第6部在服务器上移动插件,也可以在前台手动导入一次

 

标签:ops,部署,server,Datakit,visualtool,openGauss,echo,config
From: https://www.cnblogs.com/avasteven/p/17306870.html

相关文章

  • Docker 应用部署
    一、mysql部署在Docker容器中部署mysql,并通过外部mysql客户端操作MySQLserver容器内的网络服务和外部机器不能直接通信外部机器和宿主机可以直接通信宿主机和容器可以直接通信当容器中的网络服务需要被外部机器访问时,可以将容器中提供服务的端口映射到宿主机的端口上,外......
  • kafka实践(二):部署Kafka需要衡量的问题
    该博文部分参考《Apachekafka实战》-胡夕的第三章Kafka线上环境部署,关于最佳实践的配置方面的建议,kafka在设计之初就需要考虑以下4个方面的问题:吞吐量/延时消息持久化负载均衡和故障转移伸缩性1.1 吞吐量/延时对于任何一个消息引擎而言,吞吐量都是至关重要的性能指标。那么何为吞......
  • 62、Prometheus-远端存储-Influxdb部署
    1、基础知识1.1、官方文档https://docs.influxdata.com/influxdb/v1.8/supported_protocols/prometh1.2、需求需把要prometheus数据存到其他远程服务器上2、Influxdb部署2.1、配置yum源cat<<EOF|sudotee/etc/yum.repos.d/influxdb.repo[influxdb]name=Influx......
  • Seal AppManager发布:基于平台工程理念的全新应用部署管理体验
    4月12日,数澈软件Seal(以下简称“Seal”)宣布推出新一代应用统一部署管理平台SealAppManager,采用平台工程的理念,降低基础设施操作的复杂度为研发和运维团队提供易用、一致的应用管理和部署体验,进而提升研发人员和运维人员的生产力。 平台工程(PlatformEngineering)专注于减少现代......
  • 极速免费部署,国内可用 ChatGPT 网页版
    极速免费部署,国内可用ChatGPT网页版我的星球微信群虽然接入了ChatGPT,但是依然有星友反馈说艾特机器人太麻烦,有些问题也不方便公开。昨天充值api成功了,终于有底气把网页版开放给星友了。这里就把部署方式和使用方法介绍给大家吧其实简单到离谱,这个开源项目里点击Deploy就行......
  • OpenEuler Linux 部署 HadoopHA
    OpenEulerLinux部署HadoopHAopenEulerLinux部署HadoopHA主机名IP地址spark01192.168.28.11spark02192.168.28.12spark03192.168.28.13升级操作系统和软件yum-yupdate升级后建议重启安装常用软件yum-yinstallgccgcc-c++autoconfautom......
  • openEuler Linux 部署 Zookeeper 集群
    openEulerLinux部署Zookeeper集群openEulerLinux部署Zookeeper集群主机名IP地址spark01192.168.28.11spark02192.168.28.12spark03192.168.28.13升级操作系统和软件yum-yupdate升级后建议重启安装常⽤软件yum-yinstallgccgcc-c++......
  • openEuler 单机部署 Hadoop SingleNode 模式
    openEuler单机部署HadoopSingleNode模式升级操作系统和软件yum-yupdate升级后建议重启安装常用软件yum-yinstallgccgcc-c++autoconfautomakecmakemakersyncopenssh-servervimmanzipunzipnet-toolszlibzlib-developensslopenssl-develpcre-devel......
  • Docker部署rancher
    Linux环境:centos7.61.创建挂载目录并授权mkdir-p/docker_v/rancher/{rancher,log,kubelet,cni}chmod777-R/docker_v/rancher/2.最新稳定版(v2.5.16)/k8s(1.20.15)dockerpullrancher/rancher:v2.5.163.启动容器dockerrun-d--namerancher--privileged--restart=u......
  • Rocky Linux 9 Minio 集群部署
    1、DockerCE安装参考:https://www.cnblogs.com/a120608yby/p/9883175.html2、DockerCompose安装参考:https://www.cnblogs.com/a120608yby/p/14582853.html3、Minio部署#编辑docker-compose.yaml#vimdocker-compose.yamlversion:'3.7'#Settingsandconfigu......