Yashandb 数据库 YMP安装和数据迁移

时间:2024-11-16 18:55:17

Yashandb 数据库 YMP安装和数据迁移

参考:安装前准备 | YashanDB Doc

下载地址

YMP的参考文档手册:

https://doc.yashandb.com/ymp/23.2/zh/%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2/%E5%AE%89%E8%A3%85%E4%B8%8E%E5%8D%B8%E8%BD%BD.html

YashanDB 相关安装包下载地址

https://download.yashandb.com/download

OCI下载地址

https://www.oracle.com/cn/database/technologies/instant-client/linux-x86-64-downloads.html

JDK下载地址(获取最新或旧版本)

https://www.oracle.com/java/technologies/downloads/#java8
https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

安装前准备

修改资源限制(root用户下)

# 查看最大用户线程数
ulimit -u

# 执行如下命令使最大用户线程数临时生效,重启后无效
ulimit -u 65536

# 执行执行如下命令将最大用户线程数写入/etc/security/limits.conf文件,重启后参数永久生效
echo "
* soft nproc 65536
* hard nproc 65536
" >> /etc/security/limits.conf

开放端口

ymp安装的默认端口如下:

YMP监听 数据库监听 主机间通信 yasom yasagent
8090 8091 8092 8093 8094

方式一:关闭防火墙(测试环境,可以考虑关闭)

# 查看是否关闭
[root@dba236 mnt]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2024-04-10 10:25:50 EDT; 1 weeks 5 days ago
     Docs: man:firewalld(1)
 Main PID: 871 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─871 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

Apr 10 10:25:49 dba236 systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 10 10:25:50 dba236 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@dba236 mnt]# firewall-cmd --add-port=1688/tcp --permanent
success
[root@dba236 mnt]# firewall-cmd --reload
success


# 关闭防火墙
systemctl stop firewalld 

# 关闭开机自启
systemctl disable firewalld

方式二:添加防火墙白名单(建议生产环境,按需开启,安全有放心)

# 查看防火墙已开放端口
firewall-cmd --zone=public --list-ports

# 添加端口到防火墙(以8090为例)
firewall-cmd --zone=public --add-port=8090/tcp --permanent

# 重新加载防火墙策略
firewall-cmd --reload

# 若需删除白名单中的端口,执行
firewall-cmd --zone=public --remove-port=8090/tcp --permanent

用户准备

创建一个用户用于安装YMP,以YMP为例,在用户创建和授权后,后续所有安装步骤均在该用户下操作。

# 新建YMP用户
# useradd -d /home/ymp -m ymp
# passwd ymp

上传YMP安装包至/home/ymp目录下然后解压:

# 切换至YMP安装目录
$ cd /home/ymp/
$ unzip yashan-migrate-platform-v23.2.1.3-linux-x86-64.zip

OCI环境设置(oracle迁移到yashanDB必备)

PS: ymp仅支持OCI 19.19.0.0及以上版本

$ cd /home/ymp/
[ymp@yashan ~]$ unzip instantclient-basic-linux.x64-19.19.0.0.0dbru.el9.zip
修改安装包及目录
chown -R ymp:ymp instantclient_19_19

进入安装目录

$ cd /home/ymp/yashan-migrate-platform/
\# 执行安装命令,这里--db指定的是内置数据库 -- 这里db后面需要指定数据库的安装包,如果是迁移oracle,则需要指定OCI路径
sh bin/ymp.sh install --db /app/install/yashandb-personal-23.2.3.100-linux-x86_64.tar.gz  --path /home/ymp/instantclient_19_19/
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh install --db /app/install/yashandb-personal-23.2.3.100-linux-x86_64.tar.gz  --path /home/ymp/instantclient_19_19/
2024-11-14 13:19:10 INFO    --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","install","--db","/app/install/yashandb-personal-23.2.3.100-linux-x86_64.tar.gz","--path","/home/ymp/instantclient_19_19/","--ip","192.168.50.183","--memory","4G"]
2024-11-14 13:19:11 INFO    --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Check for env before install is successfully!
2024-11-14 13:19:23 INFO    --- [main] com.sics.command.serviceimpl.PackageServiceImpl : Db package unpackage successfully!
2024-11-14 13:19:23 INFO    --- [main] com.sics.command.serviceimpl.CheckServiceImpl : OCI version is 19.19.0.0.0!
2024-11-14 13:19:50 INFO    --- [main] com.sics.command.serviceimpl.PackageServiceImpl : Yasldr package unpackage successfully!
2024-11-14 13:19:50 INFO    --- [main] com.sics.command.util.CommandUtil : host host0001 openssl version: OpenSSL 1.1.1l  24 Aug 2021
2024-11-14 13:19:50 INFO    --- [main] com.sics.command.util.CommandUtil : OpenSSL version is 1.1.1 or greater
2024-11-14 13:19:50 INFO    --- [main] com.sics.command.util.CommandUtil : host host0001 openssl version: OpenSSL 1.1.1l  24 Aug 2021
2024-11-14 13:19:50 INFO    --- [main] com.sics.command.util.CommandUtil : OpenSSL version is 1.1.1 or greater

[2024-11-14 13:27:51]  2024-11-14 13:27:54 ERROR   --- [main] com.sics.command.serviceimpl.CheckServiceImpl : The available memory does not meet the requirements, require: 4096 MB, available: 4046 MB.
[2024-11-14 13:27:51]  2024-11-14 13:27:54 ERROR   --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Please free up more memory or reduce the memory allocation of YMP.
[2024-11-14 13:27:51]  YMP install failed! -- 这里安装需要内存是4G以上,我的虚拟机时8G内存,还是报错,后面我改成16G内存就安装成功

-- 重新安装报错1:
2024-11-14 13:32:56 ERROR   --- [main] com.sics.command.serviceimpl.CheckServiceImpl : /home/ymp/.yasboot/ymp.env has been existed!
YMP install failed!
-- 解决:
[ymp@yashan yashan-migrate-platform]$ rm -rf /home/ymp/.yasboot/ymp.env
-- 重新安装报错2:
[2024-11-14 13:26:03]  2024-11-14 13:26:06 ERROR   --- [main] com.sics.command.serviceimpl.PackageServiceImpl : Please keep /home/ymp/yashan-migrate-platform/db clean!
[2024-11-14 13:26:03]  YMP install failed!
-- 解决:
[ymp@yashan ~]$ cd /home/ymp/yashan-migrate-platform/db
[ymp@yashan db]$ rm -rf *
-- 重新安装后成功
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh install --db /app/install/yashandb-personal-23.2.3.100-linux-x86_64.tar.gz  --path /home/ymp/instantclient_19_19/

查看ymp状态

[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh status
2024-11-14 13:40:57 INFO    --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","status"]
2024-11-14 13:40:57 INFO    --- [main] com.sics.command.serviceimpl.StatusServiceImpl : YMP is running, pid is 2611.
2024-11-14 13:40:57 INFO    --- [main] com.sics.command.serviceimpl.StatusServiceImpl : Built-in database is used, pid is 2611.

查看ymp的版本

[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh -v
2024-11-14 13:41:18 INFO    --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","version"]
2024-11-14 13:41:18 INFO    --- [main] com.sics.command.util.CommandUtil : YashanDB Loader Personal Edition Release 23.2.3.100 x86_64 f3452be
2024-11-14 13:41:18 INFO    --- [main] com.sics.command.operation.QueryOperation :
Yashan-migrate-platform version: Release v23.2.1.3
YashanDB SQL Enterprise Edition Release 23.2.3.100 x86_64
YashanDB Loader Personal Edition Release 23.2.3.100 x86_64 f3452be

2.2. 卸载YMP

$ cd /home/ymp/yashan-migrate-platform/
 $ sh bin/ymp.sh uninstall
 
 # 使用uninstall功能时可携带-f参数,强制清理环境
 $ sh bin/ymp.sh uninstall -f
  
 # 验证
 $ ps -ef | grep yas
 ymp       20840  6322  0 10:02 pts/14   00:00:00 grep --color=auto yas

从Oracle 迁移数据到YashanDB

登录

登录YMP平台,地址IP:PORT,默认端口8090,默认账号密码admin/admin

image-20241114134258172

修改密码:(Asdf123.)

【数据源管理】-> 添加数据源

image-20241114150711604

PS: 配置完后,顺手做下“测试连接”,确定连通性

1、源端配置(配置连接、端口、账号密码信息)

image-20241114135218729

YAS-00402 failed to connect socket, errno 111, error message "Connection refused"
在打开yasql / as sysdba时候报错,我是重新安装数据库解决的,网上没有找到好的办法。
-- [yashan@yashan install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-personal-23.2.3.100-linux-x86_64.tar.gz 
-- [yashan@yashan install]$ cd /app/yasdb_home/yashandb/23.2.3.100/conf/
-- [yashan@yashan instance]$ yasboot cluster password set -n yasdb_123 -c yashandb
#yanshandb上面新建用户并授权。
CREATE USER hefei IDENTIFIED BY hefei;
GRANT dba TO hefei;

image-20241114150528737

image-20241114150820141

image-20241114153420493

image-20241114151151016