体系国产化替换方案(三)Mysql数据迁移至OpenGauss
相干文章:体系国产化替换方案(一)OpenEuler+OpenGauss-CSDN博客https://csdnimg.cn/release/blog_editor_html/release2.3.7/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=O83Ahttps://blog.csdn.net/qq_41057525/article/details/141804006?spm=1001.2014.3001.5501体系国产化替换方案(二)毕昇JDK-CSDN博客https://csdnimg.cn/release/blog_editor_html/release2.3.7/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=O83Ahttps://blog.csdn.net/qq_41057525/article/details/141817379?spm=1001.2014.3001.5501
一、卸载之前安装的openGauss
缘故起因是我还没试过这个版本行不行,需要重新安装新版本OpenGauss
yum remove opengauss
userdel opengauss 二、安装软件
服务器版本信息
https://i-blog.csdnimg.cn/direct/3ba023bb72604de6a5fc23b7ef723490.png
JDK 版本要求为:JDK11以上
https://i-blog.csdnimg.cn/direct/400a9e4a82c14640b30d1b16d556eb95.png
软件包下载
软件包 | openGausshttps://csdnimg.cn/release/blog_editor_html/release2.3.7/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=O83Ahttps://opengauss.org/zh/download/archive/
openGauss_5.1.0 极简版https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.1.0/x86/openGauss-5.1.0-CentOS-64bit.tar.bz2Datakit_5.1.0https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.1.0/tools/Datakit/Datakit-5.1.0.tar.gzPortalControl_5.1.0https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.1.0/tools/centos7/PortalControl-5.1.0-x86_64.tar.gz 2.1 安装opengauss
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld 创建用户并设置暗码
useradd -m opengauss
passwd opengauss 创建文件夹
mkdir -p /usr/local/opengauss
cd /usr/local 上传下载的openGauss安装包
https://i-blog.csdnimg.cn/direct/ce8d90f2ddbe42a59c149d4998f9effe.png
解压缩
tar -jxf openGauss-5.1.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss/ 给opengauss用户授权
chown -R opengauss:opengauss /usr/local/opengauss/ 执行命令
sysctl -w kernel.sem="250 85000 250 330" 切换用户
su - opengauss 执行脚本
cd /usr/local/opengauss/simpleInstall/
sh install.sh-w "数据库密码" &&source ~/.bashrc https://i-blog.csdnimg.cn/direct/6b48f17ba33a4e83bda700713cdef3b5.png
https://i-blog.csdnimg.cn/direct/ed31bb8ccc3c4197880c9eee8bdd1055.png 启动成功。
ps ux | grep gaussdb https://i-blog.csdnimg.cn/direct/5732fd5e042f4f038dce9ddd590a1cb7.png
cd /usr/local/opengauss/data/single_node 修改文件 postgresql.conf
listen_addresses = '*'
max_connections = 1000
wal_level = logical https://i-blog.csdnimg.cn/direct/e24c72c416ec49c4a3f73dee9d73fbc2.png
https://i-blog.csdnimg.cn/direct/b70be6f237b049c7a00c6a119094558a.png 修改文件pg_hba.conf
添加以下设置
host all all 0.0.0.0/0 sha256
host replication all 0.0.0.0/0 sha256 https://i-blog.csdnimg.cn/direct/4eb2df9c84e247b3970c44a2bc94ffa6.png
重启opengauss
cd /usr/local/opengauss/bin
gs_ctl restart -D $GAUSSHOME/data/single_node/ -Z single_node https://i-blog.csdnimg.cn/direct/b494cf0e183845eaa84598d996c53aa8.png
ps ux | grep gaussdb https://i-blog.csdnimg.cn/direct/d841f1b3bc2f477dba5a27fa4fd8ca58.png
重启成功。
连接opengauss
gsql -d postgres -r 创建用户
create user testuser with password '密码'; https://i-blog.csdnimg.cn/direct/95c936851f304458a9d0b1fe4b485267.png
grant all privileges to testuser; https://i-blog.csdnimg.cn/direct/d106510939854269bd678aa43043bb63.png
创建datakit数据库和迁移目标数据库testdb
create database datakit;
create database testdb with dbcompatibility='b'; https://i-blog.csdnimg.cn/direct/a618dfb5a4604b979e5e31aebefdd40b.png
利用Data Studio连接
https://i-blog.csdnimg.cn/direct/956fa1f34b2f4b61a0e0b477d07a99b2.png
https://i-blog.csdnimg.cn/direct/e71c3a74b1dd4d7e97a46ea8b2ca8b71.png
至此opengauss安装设置完成
2.2 安装Datakit
上传文件Datakit_5.1.0
https://i-blog.csdnimg.cn/direct/481e2d47a0184d0bac1e6c962d83d171.png
创建文件夹
mkdir -p /datakit/datakit5.1 解压缩
tar -zxvf Datakit-5.1.0.tar.gz -C /datakit/datakit5.1/
cd /datakit/datakit5.1/
#创建工作目录
mkdir -p logs config ssl files https://i-blog.csdnimg.cn/direct/3f79968321664a3bb7e06ed7e4610f25.png
执行ssl
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 /datakit/datakit5.1/ssl/keystore.p12 \
-validity 3650 \
-storepass 123456 https://i-blog.csdnimg.cn/direct/d1dd4b364d9e451085d9b837971cd298.png
拷贝设置文件
cp application-temp.yml ./config/
修改设置文件
vim ./config/application-temp.yml system:
# File storage path
defaultStoragePath: /datakit/datakit5.1/files
# Whitelist control switch
whitelist:
enabled: false
server:
port: 9494
ssl:
key-store: /datakit/datakit5.1/ssl/keystore.p12
key-store-password: 123456
key-store-type: PKCS12
enabled: true
servlet:
context-path: /
logging:
file:
path: /datakit/datakit5.1/logs/
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.opengauss.Driver
url: jdbc:opengauss://opengauss IP:5432/datakit?currentSchema=public&batchMode=off
username: testuser
password: 密码
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: 6000
keep-alive: true
max-active: 30
min-evictable-idle-time-millis: 600000
management:
server:
port: 9494 生存文件,进入
cd /datakit/datakit5.1/ 启动datakit
nohup java -Xms2048m -Xmx4096m -jar openGauss-datakit-5.1.0.jar --spring.profiles.active=temp > ./logs/datakit.out 2>&1 & https://i-blog.csdnimg.cn/direct/54c8f80c1623454992e1ad74f2d28242.png
https://i-blog.csdnimg.cn/direct/4c79d87fcb774006bf0ae9233a14e781.png 启动成功。访问https://ip:9494
admin
#默认密码
admin123 https://i-blog.csdnimg.cn/direct/caa2c5b9e30b42828d055f90b2e7a094.png
第一次登陆需要修改暗码,登陆成功之后
https://i-blog.csdnimg.cn/direct/07be73ed85454fd0944c5738891e10e1.png
三、数据迁移
3.1、检查Msql设置文件,大概需要添加一下设置
log-bin=mysql-bin
default_authentication_plugin=mysql_native_password
character_set_server=utf8mb4
enforce_gtid_consistency=on
gtid_mode=on 3.2、重启Mysql服务
3.3、页面新增MySQL数据源
https://i-blog.csdnimg.cn/direct/09e646908f4c49f8919d2c897d0ff266.png
3.4 页面新增openGauss数据源
https://i-blog.csdnimg.cn/direct/2a1baba2944e4fd2b8c6f2b247f1b74f.png
https://i-blog.csdnimg.cn/direct/81f61710f37b48cebda9612e9677efef.png
3.5 页面新增服务器管理
https://i-blog.csdnimg.cn/direct/4fe071807f364b6986b23b7ed6869f81.png
3.6 添加用户
注意:添加用户是大概添加不成功,大概是暗码复杂度不敷,暗码最好是包含大小写英文字母、特殊符号和数字,长度大于12位。
https://i-blog.csdnimg.cn/direct/9d0c41636c024f9ab943c8e8fbc0e5a5.png
https://i-blog.csdnimg.cn/direct/25f33950c3834d8ea1407798eb89fc1f.png
3.7 创建数据迁移任务
https://i-blog.csdnimg.cn/direct/3bdbaa3b43c34753be174930343f0498.png
https://i-blog.csdnimg.cn/direct/61f38af9105e496da6544bc14e5b1a84.png
https://i-blog.csdnimg.cn/direct/bcadc8ab250a42ed93e6d0d81d203473.png
https://i-blog.csdnimg.cn/direct/b6d8e33944354b0d92e58240fc8675ef.png
3.8 登陆服务器,切换root账号
chown -R testuser:testuser /datakit/
echo "服务器IP centos79" >> /etc/hosts 3.9 切换testuser 用户,新增一下内容
vim /home/testuser/.bashrc
export JAVA_HOME=/usr/local/bisheng-jdk-11.0.24
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
source /home/testuser/.bashrc 3.10 回到页面,上传插件
https://i-blog.csdnimg.cn/direct/87484dff610541e3bcaf933dea220d0a.png
https://i-blog.csdnimg.cn/direct/83a18092f7ba46b7a973812881961387.png
https://i-blog.csdnimg.cn/direct/e218e46b4814451cad68dd6eae03fb02.png
https://i-blog.csdnimg.cn/direct/d25857d0c78b41d7908df614bafe9e6d.png
https://i-blog.csdnimg.cn/direct/359980ec593f4ac1b6a39433f63e96ae.png
3.11 登陆Data Studio
https://i-blog.csdnimg.cn/direct/32225eac74f84d47b1773c9179764390.png
至此迁移完成。
吐槽一句:都是泪,踩了一遍又一遍的坑>~<
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]