系统架构OS
硬件需求:2c4g
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# uname -m
x86_64
[root@localhost ~]# hostname -I
192.168.92.32
下载地址:https://opengauss.org/zh/download/
下载安装包
cd /opt/
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.1/x86/openGauss-5.0.1-CentOS-64bit.tar.bz2
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/tools/Datakit-5.0.0.tar.gz
安装openGauss
环境配置
-
环境防火墙,关闭selinux,设置内核参数
systemctl disable firewalld --now sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 sysctl -w kernel.sem="250 85000 250 330"
-
安装所需软件
yum -y install bzip2 libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel net-tools
-
创建openGauss用户组和用户
groupadd gaussdb useradd -g gaussdb omm echo "omm@123" | passwd --stdin omm
-
创建安装目录,并授权给omm用户
mkdir -p /app/openGauss chown omm:gaussdb /app/openGauss -R
-
切换到omm用户,将 /opt/openGauss-5.0.1-CentOS-64bit.tar.bz2 解压到 /app/openGauss
[omm@localhost ~]$ tar Cjxf /app/openGauss/ /opt/openGauss-5.0.1-CentOS-64bit.tar.bz2
-
进入到/app/openGauss目录进行安装
[omm@localhost openGauss]$ cd /app/openGauss/ [omm@localhost openGauss]$ cd simpleInstall/ [omm@localhost simpleInstall]$ sh install.sh -w "gaussdb@123"
[2024-03-25 22:38:36.506][8693][][gs_ctl]: done [2024-03-25 22:38:36.506][8693][][gs_ctl]: server started (/app/openGauss/data/single_node) import sql file Would you like to create a demo database (yes/no)? yes Load demoDB [school,finance] success. [complete successfully]: You can start or stop the database server using: gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node
最后有一项交互,是否创建模板数据库,yes和no都可以
-
配置环境变量
将 omm 用户下新加的环境变量直接放入到 全局变量文件/etc/profile 中(添加完这里的就不要了)[omm@localhost ~]$ cat .bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= # User specific aliases and functions export GAUSSHOME=/app/openGauss export PATH=$GAUSSHOME/bin:$PATH export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH export GS_CLUSTER_NAME=dbCluster ulimit -n 1000000
[root@localhost ~]# cat /etc/profile
export GAUSSHOME=/app/openGauss export PATH=$GAUSSHOME/bin:$PATH export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH export GS_CLUSTER_NAME=dbCluster ulimit -n 1000000
source /etc/profile
-
配置远程访问
如果需要navicat可连接需要吧加密算法修改为md5
修改pg_hba.conf文件配置,用户加密算法和远程可访问终端
[omm@localhost single_node]$ cd /app/openGauss/data/single_node cat pg_hba.conf
修改 postgresql.conf 文件配置监听主机,和选择加密算法(默认是sha256)
cat postgresql.conf
重启配置生效gs_ctl restart -D /app/openGauss/data/single_node/
-
创建Datakit 数据库和用户
登录openGauss数据库(默认是5432端口)$ gsql -d postgres
创建数据库和用户并授权
create database datakit; create user datakit_admin with password "datakit_admin@123"; GRANT ALL PRIVILEGES TO datakit_admin;
使用datakit_admin用户登录,并查看数据库
\q 退出数据库
gsql -d datakit -U datakit_admin -W datakit_admin@123
\l 展示数据库
安装Datakit
-
创建安装目录并将安装包解压到安装目录
[root@localhost opt]# mkdir /app/datakit [root@localhost opt]# tar Czxf /app/datakit/ Datakit-5.0.0.tar.gz
-
进入到安装目录,创建 ssl confi files logs visualtool-plugin目录
[root@localhost opt]# cd /app/datakit/ [root@localhost datakit]# mkdir ssl config files logs visualtool-plugin
-
将所有jar包 放入到 visualtool-plugin目录除了 visualtool-main.jar
[root@localhost datakit]# mv *jar visualtool-plugin/ [root@localhost datakit]# mv visualtool-plugin/visualtool-main.jar ./
-
修改配置文件
[root@localhost datakit]# cp application-temp.yml config/ [root@localhost datakit]# cd application-temp.yml [root@localhost datakit]# cat application-temp.yml
修改一下部分:
defaultStoragePath: /app/datakit/files
key-store: /app/datakit/ssl/keystore.p12
path: /app/datakit/logs/
url: jdbc:opengauss://127.0.0.1:5432/datakit?currentSchema=public
username: datakit_admin
password: datakit_admin@123system: # File storage path defaultStoragePath: /app/datakit/files # Whitelist control switch whitelist: enabled: false server: port: 9494 ssl: key-store: /app/datakit/ssl/keystore.p12 key-store-password: 123456 key-store-type: PKCS12 enabled: true servlet: context-path: / logging: file: path: /app/datakit/logs/ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: org.opengauss.Driver url: jdbc:opengauss://127.0.0.1:5432/datakit?currentSchema=public username: datakit_admin password: datakit_admin@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 ~
-
创建密钥文件(需要使用到jdk11,这里用yum安装)
yum -y install java-11-openjdk.x86_64 java-11-openjdk-devel.x86_64
[root@localhost config]# java -version openjdk version "11.0.22" 2024-01-16 LTS OpenJDK Runtime Environment (Red_Hat-11.0.22.0.7-1.el7_9) (build 11.0.22+7-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.22.0.7-1.el7_9) (build 11.0.22+7-LTS, mixed mode, sharing)
生成密钥注意位置:我的密钥位置在:/app/datakit/ssl/keystore.p12
keytool -genkey -noprompt \ -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Fujian, S=Fujian, C=CN"\ -alias opengauss\ -storetype PKCS12 \ -keyalg RSA \ -keysize 2048 \ -keystore /app/datakit/ssl/keystore.p12 \ -validity 3650 \ -storepass 123456
- storepass与配置文件application-temp.yml中的key-store-password保持一致
- keystore路径与配置文件application-temp.yml中的key-store路径保持一致
-
启动datakit
使用omm用户启动,启动前授权一下/app/datakit目录权限给 omm 用户chown omm:gaussdb /app/datakit -R su omm nohup java -Xms2048m -Xmx4096m -jar /app/datakit/visualtool-main.jar --spring.profiles.active=temp > /app/datakit/logs/visualtool-main.out 2>&1 &
可以访问 /app/datakit/logs/visualtool-main.out 日志文件查看运行状态
-
访问datakit
必须使用https协议访问
初始密码是admin/admin123