YashanDB 23.2 YAC 共享集群部署和使用自带YMP迁移工具进行数据迁移,效果很city
1. 环境准备
本文以经典架构(2 台服务器,1 共享存储且包含 3 个及以上 LUN)为例,搭建双实例单库的共享集群环境。
主机名 | IP | 版本 | CPU | 内存 | 硬盘 | 用途 |
yac1 | 192.168.50.60 | Kylin-Server-V10-SP3 | 4C | 8G | 100G | YAC 集群 1 |
yac2 | 192.168.50.61 | Kylin-Server-V10-SP3 | 4C | 8G | 100G | YAC 集群 2 |
yashan | 192.168.50.183 | Linux Centos 7.9 | 4C | 8G | 100G | YMP 迁移平台 |
hfzcdb | 192.168.50.1 | RedHat 7.6 | 4C | 8G | 100G | Oracle19c 迁移源端 |
本文用的工具,在云盘可以下载:
链接:https://pan.baidu.com/s/1jKb3o52uReHuO9oDXvd4gg?pwd=poe5
提取码:poe5
共享存储规划
YashanDB v23.2 共享集群要求共享存储规划 3 类磁盘(在 v23.3 有所改动,变为 2 类):
- 数据盘:一块或多块,根据业务实际情况规划,其中一块数据盘的路径将作为 yasboot package ce gen 命令的 data 选项参数。
- 投票盘:一块,建议规划为 1G 及以上,该盘路径将作为 yasboot package ce gen 命令的 vote 选项参数。
- YCR 盘:一块,建议规划为 1G 及以上,该盘路径将作为 yasboot package ce gen 命令的 YCR 选项参数。
既定共享存储上已划分 3 块盘:
- 数据盘:规划绑定至 /dev/yasdata 路径。
- 投票盘:规划绑定至 /dev/yasvote 路径。
- YCR盘:规划绑定至 /dev/yasycr 路径。
绑定目录(/dev/yfs)与磁盘名称(yasdata、yasvote、yasycr等)均为示例值,请根据实际业务需求调整,但命名时需注意:
2. 安装前准备(所有节点)
2.1. 网络配置
[root@yca1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
[root@yca1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=b73f1511-14ad-459a-8fbb-2f41fb597640
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.50.60
PREFIX=24
GATEWAY=192.168.50.1
IPV6_PRIVACY=no##重启网卡
[root@yca1 ~]# systemctl restart network#测试下网络是否正常,有返回值就是正常的,网络不通需要解决,这里不再追叙。
[root@yca1 ~]# ping 192.168.50.1
PING 192.168.50.1 (192.168.50.1) 56(84) bytes of data.
64 bytes from 192.168.50.1: icmp_seq=1 ttl=128 time=0.372 ms
^C
--- 192.168.50.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.372/0.372/0.372/0.000 ms
[root@yca1 ~]# ping 192.168.50.61
PING 192.168.50.61 (192.168.50.61) 56(84) bytes of data.
64 bytes from 192.168.50.61: icmp_seq=1 ttl=64 time=0.540 ms
^C
--- 192.168.50.61 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.540/0.540/0.540/0.000 ms
[root@yca1 ~]#--节点yac2也要配置
[root@yca2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=4b7ce079-19ec-4f80-961f-44846bf39d79
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.50.61
PREFIX=24
GATEWAY=192.168.50.1
IPV6_PRIVACY=no##重启网卡
[root@yca1 ~]# systemctl restart network##测试网络是否正常
[root@yca2 ~]# ping 192.168.50.1
PING 192.168.50.1 (192.168.50.1) 56(84) bytes of data.
64 bytes from 192.168.50.1: icmp_seq=1 ttl=128 time=0.350 ms
^C
--- 192.168.50.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.350/0.350/0.350/0.000 ms
[root@yca2 ~]# ping 192.168.50.60
PING 192.168.50.60 (192.168.50.60) 56(84) bytes of data.
64 bytes from 192.168.50.60: icmp_seq=1 ttl=64 time=0.438 ms
^C
--- 192.168.50.60 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.438/0.438/0.438/0.000 ms
2.2. 建议配置主机名解析:
## 以节点一为例
cat<<-EOF>>/etc/hosts
192.168.50.60 yac1
192.168.50.61 yac2
EOF--操作
[root@yca1 ~]# cat<<-EOF>>/etc/hosts
> 192.168.50.60 yac1
> 192.168.50.61 yac2
> EOF
[root@yca1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.50.60 yac1
192.168.50.61 yac2##使用域名直接ping,要求可以ping通
[root@yca1 ~]# ping yac1
PING yac1 (192.168.50.60) 56(84) bytes of data.
64 bytes from yac1 (192.168.50.60): icmp_seq=1 ttl=64 time=0.042 ms
^C
--- yac1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.042/0.042/0.042/0.000 ms
[root@yca1 ~]# ping yac2
PING yac2 (192.168.50.61) 56(84) bytes of data.
64 bytes from yac2 (192.168.50.61): icmp_seq=1 ttl=64 time=0.386 ms
^C
--- yac2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.386/0.386/0.386/0.000 ms
[root@yca1 ~]#--节点2
[root@yca2 ~]# cat<<-EOF>>/etc/hosts
> 192.168.50.60 yac1
> 192.168.50.61 yac2
> EOF
[root@yca2 ~]# ping yac1
PING yac1 (192.168.50.60) 56(84) bytes of data.
64 bytes from yac1 (192.168.50.60): icmp_seq=1 ttl=64 time=0.398 ms
^C
--- yac1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.398/0.398/0.398/0.000 ms
[root@yca2 ~]# ping yca2
^C
[root@yca2 ~]# ping yac2
PING yac2 (192.168.50.61) 56(84) bytes of data.
64 bytes from yac2 (192.168.50.61): icmp_seq=1 ttl=64 time=0.038 ms
^C
--- yac2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.038/0.038/0.038/0.000 ms
[root@yca2 ~]#
2.3. 关闭防火墙
数据库安装均建议关闭防火墙:
#两个节点上面都要执行
systemctl stop firewalld
systemctl disable firewalld#操作
[root@yca1 ~]# systemctl stop firewalld
[root@yca1 ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@yca1 ~]#[root@yca2 ~]# systemctl stop firewalld
[root@yca2 ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@yca2 ~]#
2.4. 创建用户和组
主机创建用户如果有密码复杂性要求,不想设置密码太复杂的话,可以取消密码复杂度:
sed -i 's/^password\+[[:space:]]\+requisite[[:space:]]\+pam_pwquality.so/#&/g' /etc/pam.d/system-auth
sed -i 's/use_authtok$//' /etc/pam.d/system-authgroupadd YASDBA
useradd -d /home/yashan -m yashan
usermod -a -G YASDBA yashan
echo "yashan:yashan" | chpasswd
id yashanchmod +w /etc/sudoerscat<<-EOF>>/etc/sudoers
yashan ALL=(ALL)NOPASSWD:ALL
EOFcat /etc/sudoers
chmod -w /etc/sudoers
2.5. 创建目录
mkdir /soft
mkdir -p /data/yashan
chown -R yashan:yashan /data/yashan
chmod -R 777 /data/yashan
2.6. 系统参数配置
## 以节点一为例
echo "vm.swappiness = 0" >>/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 32768 60999" >>/etc/sysctl.conf
echo "vm.max_map_count=2000000" >>/etc/sysctl.conf
sysctl -p#解释:
## 关闭交换分区
[root@yac01 ~]# echo "vm.swappiness = 0" >>/etc/sysctl.conf
## 调整自动分配本地端口范围
[root@yac01 ~]# echo "net.ipv4.ip_local_port_range = 32768 60999" >>/etc/sysctl.conf
## 调整进程的VMA上限
[root@yac01 ~]# echo "vm.max_map_count=2000000" >>/etc/sysctl.conf
## 生效配置
[root@yac01 ~]# sysctl -p
2.7. 资源配置
将部分资源限制值(使用 ulimit -a 可查看所有的资源限制值)调整为推荐值或以上。
## 以节点一为例,两个节点都要执行
cat<<-EOF>>/etc/security/limits.conf
yashan soft nofile 1048576
yashan hard nofile 1048576
yashan soft nproc 1048576
yashan hard nproc 1048576
yashan soft rss unlimited
yashan hard rss unlimited
yashan soft stack 8192
yashan hard stack 8192
EOFcat /etc/security/limits.conf
2.8. 清理共享内存
部署 YashanDB 共享集群,还需在所有服务器上清理共享内存:
## 以节点一为例
[root@yac01 ~]# ipcrm -a
2.9. 配置软件源
配置本地软件源的方式需要先挂载本地 ISO 安装镜像:
## 以节点一为例
[root@yac01 ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.[root@yca1 ~]# mount /dev/sr0 /mnt
mount: /mnt: 在 /dev/sr0 上找不到媒体. ##这里需要在虚拟机软件上面修改设备状态信息
[root@yca1 ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
一键配置 KylinV10 本地软件源:
## 以节点一为例
mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bakcat<<-EOF>/etc/yum.repos.d/local.repo
[server]
name=server
baseurl=file:///mnt
enabled=1
gpgcheck=0
EOFcat /etc/yum.repos.d/local.repo##操作
[root@yca1 ~]# mkdir -p /etc/yum.repos.d/bak
[root@yca1 ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
mv: 无法将目录'/etc/yum.repos.d/bak' 移动至自身的子目录'/etc/yum.repos.d/bak/bak' 下
[root@yca1 ~]# cat<<-EOF>/etc/yum.repos.d/local.repo
> [server]
> name=server
> baseurl=file:///mnt
> enabled=1
> gpgcheck=0
> EOF
[root@yca1 ~]# cat /etc/yum.repos.d/local.repo
[server]
name=server
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@yca1 ~]#
2.10. 安装依赖包
为保障 YashanDB 的正常安装和运行,请按如下来源及最低版本要求,在所有服务器环境中配置所需依赖项:
安装依赖包:## 以节点一为例
[root@yac01 ~]# dnf install -y openssl gmssl lz4 zlib zstd monit --skip-broken
Package openssl-1:1.1.1f-31.p23.ky10.x86_64 is already installed.
No match for argument: gmssl
Package lz4-1.9.2-4.ky10.x86_64 is already installed.
Package zlib-1.2.11-23.ky10.x86_64 is already installed.
Package zstd-1.4.5-2.ky10.x86_64 is already installed.
No match for argument: monit
Dependencies resolved.
Nothing to do.
Complete!安装完成后检查是否安装成功:## 以节点一为例
[root@yac01 ~]# rpm -q openssl gmssl lz4 zlib zstd monit
openssl-1.1.1f-31.p23.ky10.x86_64
未安装软件包 gmssl
lz4-1.9.2-4.ky10.x86_64
zlib-1.2.11-23.ky10.x86_64
zstd-1.4.5-2.ky10.x86_64
未安装软件包 monit
YashanDB 在 23.2 版本开始增加了一个 openssl 的限制,要求版本必须为 1.1.1,否则安装过程可能出错:
## 以节点一为例
## 需要大于 1.1.1
[root@yac01 ~]# openssl version
OpenSSL 1.1.1f 31 Mar 2020
gmssl 需要手动编译安装,工具在云盘下载,安装步骤如下:
## 以节点一为例
## 使用 cmake 安装需要先安装以下依赖包
[root@yac01 soft]# yum install -y cmake openssl-devel gcc gcc-c++ unzip zlib-devel## 编译安装 gmssl
[root@yac01 soft]# tar -xf GmSSL-3.1.1.tar.gz
[root@yac01 soft]# cd GmSSL-3.1.1/
[root@yac01 GmSSL-3.1.1]# ls
cmake CMakeLists.txt demos docs include INSTALL.md LICENSE README.md src tests tools
[root@yac01 GmSSL-3.1.1]# mkdir build && cd build
[root@yac01 build]# cmake ..
## 在 make install 完成后,GmSSL 会在默认安装目录中安装 gmssl 命令行工具,在头文件目录中创建 gmssl 目录,并且在库目录中安装 libgmssl.a、libgmssl.so 等库文件
[root@yac01 build]# make && make test && make install## 编译出来的动态库需要指定路径,配置环境变量
[root@yac01 build]# cat<<-EOF>>/etc/profile
export PATH=\$PATH:/usr/local/bin
EOF
[root@yac01 build]# source /etc/profile
[root@yac01 build]# echo /usr/local/lib > /etc/ld.so.conf.d/gmssl.conf
[root@yac01 build]# ldconfig## 查看 gmssl 版本,安装成功
[root@yac01 build]# gmssl version
GmSSL 3.1.1
monit 也需要手动编译安装:工具在云盘下载,安装步骤如下:
## 以节点一为例
## 编译安装 monit
[root@yac01 soft]# tar -xf monit-5.34.2.tar.gz
[root@yac01 soft]# cd monit-5.34.2/
[root@yac01 monit-5.34.2]# ls
aclocal.m4 bootstrap CHANGES config configure configure.ac CONTRIBUTORS COPYING doc libmonit m4 Makefile.am Makefile.in monit.1 monitrc src system
[root@yac01 monit-5.34.2]# ./configure && make && make install## 查看 monit 版本,安装成功
[root@yac01 monit-5.34.2]# monit -V
This is Monit version 5.34.2
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2024 Tildeslash Ltd. All Rights Reserved.
2.11. 挂载共享盘
2.11.1. 配置共享存储
使用 StarWind 软件配置 3 个共享存储。这里可以 参考 讲的非常详细,就是在添加磁盘的时候需要添加 3 块,就是在 devices 上再新建 3 个,如下图。
2.11.2.Linux 客户端安装 iscsi 软件
## 以节点一为例
## 如果遇到报错 -bash: iscsiadm:未找到命令,就需要安装 iscsi 软件
[root@yac01 ~]# yum install -y iscsi-initiator-utils*
[root@yac01 ~]# systemctl start iscsid.service
[root@yac01 ~]# systemctl enable iscsid.service
搜索服务端 iscsi target
## 以节点一为例
## 192.168.50.1 为 iscsi 服务端 IP 地址
[root@yac01 ~]# iscsiadm -m discovery -t st -p 192.168.50.1
192.168.50.1:3260,-1 iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei
2.11.3.连接服务端 iscsi 共享存储
## 以节点一为例
iscsiadm -m node -T iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei -p 192.168.50.1 -l[root@yca1 monit-5.34.2]# iscsiadm -m node -T iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei -p 192.168.50.1 -l
Logging in to [iface: default, target: iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei, portal: 192.168.50.1,3260]
Login to [iface: default, target: iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei, portal: 192.168.50.1,3260] successful.
[root@yca1 monit-5.34.2]#[root@yca2 monit-5.34.2]# iscsiadm -m node -T iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei -p 192.168.50.1 -l
Logging in to [iface: default, target: iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei, portal: 192.168.50.1,3260]
Login to [iface: default, target: iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei, portal: 192.168.50.1,3260] successful.
[root@yca2 monit-5.34.2]#
2.11.4.配置开机自动挂载
## 以节点一为例
iscsiadm -m node -T iqn.2008-08.com.starwindsoftware:win-hfuu2hth136-hefei -p 192.168.50.1 --op update -n node.startup -v automatic
2.11.5.查看挂载成功的共享盘
## 以节点一为例,sdb、sdc、sdd 为挂载的共享盘
[root@yca1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part├─klas-root 253:0 0 61.2G 0 lvm /├─klas-swap 253:1 0 7.9G 0 lvm [SWAP]└─klas-backup 253:2 0 29.9G 0 lvm
sdb 8:16 0 5G 0 disk ##新增加的共享存储
sdc 8:32 0 10G 0 disk ##新增加的共享存储
sdd 8:48 0 5G 0 disk ##新增加的共享存储
sr0 11:0 1 4.3G 0 rom##节点2上面也要配置
[root@yca2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part├─klas-root 253:0 0 61.2G 0 lvm /├─klas-swap 253:1 0 7.9G 0 lvm [SWAP]└─klas-backup 253:2 0 29.9G 0 lvm
sdb 8:16 0 5G 0 disk ##新增加的共享存储
sdc 8:32 0 10G 0 disk ##新增加的共享存储
sdd 8:48 0 5G 0 disk ##新增加的共享存储
sr0 11:0 1 4.3G 0 rom
[root@yca2 ~]#
挂载好共享盘之后就可以配置 UDEV 绑盘了。
2.12. UDEV 绑盘
如果共享盘是多路径,建议可以先使用 multipath 进行绑盘,便于管理。
我这里只有一条路径,查看节点磁盘 wwid:## 以节点一为例
/usr/lib/udev/scsi_id -g -u /dev/sdb
/usr/lib/udev/scsi_id -g -u /dev/sdc
/usr/lib/udev/scsi_id -g -u /dev/sdd[root@yca1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb
2ab81cc0e9b241aa8
[root@yca1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc
29f2a918447c768cc
[root@yca1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdd
2001dc9f0ce384826
[root@yca1 ~]###节点1和结点2上面的值是一样的,因为都是一块磁盘。
执行 udev 绑定:
## 以节点一为例
cat<<-EOF>/etc/udev/rules.d/yashan-device-rule.rules
KERNEL=="sd*",ENV{ID_SERIAL}=="29f2a918447c768cc",SYMLINK+="yas/data",OWNER="yashan",GROUP="YASDBA",MODE="0666",RUN+="/bin/sh -c 'chown -R yashan:yashan /dev/yas/data'"
KERNEL=="sd*",ENV{ID_SERIAL}=="2ab81cc0e9b241aa8",SYMLINK+="yas/vote",OWNER="yashan",GROUP="YASDBA",MODE="0666",RUN+="/bin/sh -c 'chown -R yashan:yashan /dev/yas/vote'"
KERNEL=="sd*",ENV{ID_SERIAL}=="2001dc9f0ce384826",SYMLINK+="yas/ycr",OWNER="yashan",GROUP="YASDBA",MODE="0666",RUN+="/bin/sh -c 'chown -R yashan:yashan /dev/yas/ycr'"
EOF##这里在两个节点上面都要执行,主要修改的是ENV{ID_SERIAL}=="29f2a918447c768cc"这个值,另外,注意将磁盘空间较大的一块盘给data盘。
生效 udev:
## 以节点一为例
udevadm control --reload-rules
udevadm trigger --type=devices --action=change[root@yca1 ~]# udevadm control --reload-rules
[root@yca1 ~]# udevadm trigger --type=devices --action=change
[root@yca1 ~]#[root@yca2 ~]# udevadm control --reload-rules
[root@yca2 ~]# udevadm trigger --type=devices --action=change
[root@yca2 ~]#
查看绑定后的盘:
## 以节点一为例
ll /dev/yas/*[root@yca1 ~]# ll /dev/yas/*
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/data -> ../sdc
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/vote -> ../sdb
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/ycr -> ../sdd
[root@yca1 ~]#[root@yca2 ~]# ll /dev/yas/*
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/data -> ../sdc
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/vote -> ../sdb
lrwxrwxrwx 1 yashan yashan 6 12月 12 05:59 /dev/yas/ycr -> ../sdd
[root@yca2 ~]#
确保两个节点都绑定成功。
关闭透明大页
YashanDB 建议关闭透明大页,部分操作系统默认开启了透明大页选项,可执行以下命令确认:
## 以节点一为例
[root@yac01 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never显示结果:
[always] madvise never:透明大页已开启。
always [madvise] never:透明大页已开启。
always madvise [never]:透明大页已关闭。
修改 /etc/default/grub 文件,在 GRUB_CMDLINE_LINUX 中添加或修改参数 transparent_hugepage=never:## 以节点一为例
[root@yac01 ~]# sed -i 's/quiet/quiet transparent_hugepage=never/' /etc/default/grub
通过以下指令检查当前系统的引导类型:## 以节点一为例
[root@yac01 ~]# [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
BIOS
两种引导的启动文件路径分别为:
BIOS:/boot/grub2/grub.cfg
UEFI:/boot/efi/EFI/<distro_name>/grub.cfg,distro_name 为系统发行版本名称,例如 ubuntu、fedora、debian 等。
执行 grub2–mkconfig 指令重新配置 grub.cfg:
## 以节点一为例
## BIOS 引导
[root@yac01 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.90-89.11.v2401.ky10.x86_64
Found initrd image: /boot/initramfs-4.19.90-89.11.v2401.ky10.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-3a1c3f06e89644e5b9b560f2ba64fd98
Found initrd image: /boot/initramfs-0-rescue-3a1c3f06e89644e5b9b560f2ba64fd98.img
done
## UEFI 引导
# grub2-mkconfig -o /boot/efi/EFI/<distro_name>/grub.cfg
重启操作系统,使配置永久生效:
## 以节点一为例
[root@yac01 ~]# reboot
验证透明大页已关闭:
## 以节点一为例
cat /sys/kernel/mm/transparent_hugepage/enabled[root@yca1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@yca1 ~]#[root@yca2 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@yca2 ~]#
3. YAC 安装(主节点)
YashanDB 安装可以使用两种方式:
- 命令行安装
- 可视化安装
由于本人喜欢使用命令行模式,所以演示也是使用命令行。共享集群安装操作均在主节点执行即可!
3.1. 解压安装软件
执行安装部署前,请以安装用户(yashan)登录数据库服务器,并进入 /home/yashan/install 安装目录:
## 在 yashan 用户下创建 install 安装目录
[yashan@yac01 ~]$ mkdir -p /home/yashan/install
## 上传并授权 yashan 用户权限
[root@yac01 ~]# chown yashan:yashan /home/yashan/install/yashandb-23.2.4.100-linux-x86_64.tar.gz
-- 给目录授权
[root@yac01 ~]# chown -R yashan:yashan /home/yashan/install## 使用 yashan 用户解压安装包
[root@yac01 ~]# su - yashan
[yashan@yac01 ~]$ cd install/
[yashan@yac01 install]$ tar -zxf /home/yashan/install/yashandb-23.2.4.100-linux-x86_64.tar.gz
[yashan@yac01 install]$ ll
drwxr-xr-x 6 yashan yashan 70 9月 4 17:29 admin
drwxr-xr-x 2 yashan yashan 243 9月 4 17:29 bin
drwxr-xr-x 2 yashan yashan 176 9月 4 17:28 conf
drwxr-xr-x 4 yashan yashan 33 9月 4 17:28 ext
-rw-r--r-- 1 yashan yashan 10701 9月 4 17:28 gitmoduleversion.dat
drwxr-xr-x 2 yashan yashan 64 9月 4 17:28 include
drwxr-xr-x 3 yashan yashan 17 9月 4 17:29 java
drwxr-xr-x 2 yashan yashan 4096 9月 4 17:29 lib
-rw-r----- 1 yashan yashan 14989 9月 4 17:28 LICENSE
drwxr-xr-x 3 yashan yashan 21 9月 4 17:29 plug-in
drwxr-xr-x 2 yashan yashan 61 9月 4 17:29 scripts
-rwxr-xr-x 1 yashan yashan 189823431 12月 4 17:58 yashandb-23.2.4.100-linux-x86_64.tar.gz
3.2. 生成部署文件
执行 yasboot package 命令生成配置文件:
## 注意这里的 yashan 用户密码需要根据自己的环境进行配置,如果安装教程走的话,可以不用修改,密码就是 yashan
[yashan@yca1 install]$ ./bin/yasboot package ce gen --cluster yashandb -u yashan -p yashan --ip 192.168.50.60,192.168.50.61 --port 22 --install-path /data/yashan/yasdb_home --data-path /data/yashan/yasdb_data --begin-port 1688 --node 2 --data /dev/yas/data --vote /dev/yas/vote --ycr /dev/yas/ycr
host host0001 openssl version: OpenSSL 1.1.1f 31 Mar 2020
OpenSSL version is 1.1.1 or greater
host host0002 openssl version: OpenSSL 1.1.1f 31 Mar 2020
OpenSSL version is 1.1.1 or greaterhostid | group | node_type | node_name | listen_addr | inter_connect | data_path
--------------------------------------------------------------------------------------------------------------host0001 | ceg1 | ce | 1-1 | 192.168.50.60:1688 | 192.168.50.60:1689 | /data/yashan/yasdb_data
----------+-------+-----------+-----------+--------------------+--------------------+-------------------------host0002 | ceg1 | ce | 1-2 | 192.168.50.61:1688 | 192.168.50.61:1689 | /data/yashan/yasdb_data
----------+-------+-----------+-----------+--------------------+--------------------+-------------------------
执行完毕后,当前目录下将生成 yashandb.toml 和 hosts.toml 两个配置文件,可手动修改,但不建议删除文件中任何行,否则可能导致后续安装过程报错,或所搭建的环境后续无法进行扩展配置。
- yashandb.toml:数据库集群的配置文件。
- hosts.toml:服务器的配置文件。
根据实际需要调整 yashandb.toml 配置文件中的安装参数,可在 group 级别设置 YashanDB 的所有建库参数,可在 node 级别设置 YashanDB 的所有配置参数:(下面都是默认的参数,未修改,记录下方便查看)
[yashan@yac01 install]$ cat yashandb.toml
cluster = "yashandb" # 安装后修改也不会生效,除非重新安装
create_simple_schema = false # 为 true 部署完会执行示例的 SQL,若改为 true 需要在 deploy 时指定 sys-password 参数
uuid = "675028ea25cd37de2ae1eda1fcae7f67" # 系统自动生成,不建议修改
yas_type = "CE" # 部署模式,安装后修改也不会生效,除非重新安装[[group]]database_role = "primary"group_type = "ce" # 节点组类型,安装后修改也不会生效,除非重新安装name = "ceg1" # 节点组名称,安装后修改也不会生效,除非重新安装[group.cedisk]vote = "/dev/yas/vote" # 投票盘,安装后不可修改,除非重新安装ycr = "/dev/yas/ycr" # ycr 盘,安装后不可修改,除非重新安装[group.config] # 可配置所有建库参数,不配置时采用默认值CHARACTER_SET = "utf8"ISARCHIVELOG = trueREDO_FILE_NUM = 4REDO_FILE_SIZE = "128M"[[group.diskgroup]] # 磁盘组信息au_size = "1M" # 分配磁盘空间时的 AU 大小disk_size = "" # 指定可以由 diskgroup 进行管理的 disk 大小,可省略,则默认为该 disk 的总大小name = "DG0" # 磁盘组的名称redundancy = "EXTERNAL" # 磁盘组的冗余度yfs_force_create = false # 强制格式化磁盘[[group.diskgroup.failgroup]]disk = ["/dev/yas/data"]name = "DG0_0"[[group.node]] # 节点配置data_path = "/data/yashan/yasdb_data" # 为 DATA 目录,安装后修改也不会生效,除非重新安装hostid = "host0001" # 服务器标识,安装后修改也不会生效,除非重新安装role = 1 # 数据库主备角色,共享集群的实例没有主备概念,不支持修改[group.node.config] # 可配置所有数据库参数,不配置时采用默认值,安装后修改也不会生效,除非重新安装CLUSTER_DATABASE = "TRUE"CLUSTER_INTERCONNECT = "192.168.50.60:1689"DATA_BUFFER_SIZE = "1G"HA_ELECTION_TIMEOUT = 18HA_HEARTBEAT_INTERVAL = 6INTER_URL = "192.168.50.60:1788"LISTEN_ADDR = "192.168.50.60:1688"REDO_BUFFER_PARTS = 8REDO_BUFFER_SIZE = "64M"RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.4.100/log/yashandb/ce-1-1/run"SHARE_POOL_SIZE = "1G"SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.4.100/log/yashandb/ce-1-1/slow"SQL_POOL_PARTS = 8[[group.node]]data_path = "/data/yashan/yasdb_data"hostid = "host0002"role = 2[group.node.config]CLUSTER_DATABASE = "TRUE"CLUSTER_INTERCONNECT = "192.168.50.61:1689"DATA_BUFFER_SIZE = "1G"HA_ELECTION_TIMEOUT = 18HA_HEARTBEAT_INTERVAL = 6INTER_URL = "192.168.50.61:1788"LISTEN_ADDR = "192.168.50.61:1688"REDO_BUFFER_PARTS = 8REDO_BUFFER_SIZE = "64M"RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.4.100/log/yashandb/ce-1-2/run"SHARE_POOL_SIZE = "1G"SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.4.100/log/yashandb/ce-1-2/slow"SQL_POOL_PARTS = 8[group.ycsconfig] # YCS 配置参数,不配置时使用默认值DISK_HB_KEEP_ALIVE = 30LOG_LEVEL = "DEBUG"LOG_NUMBER = 10LOG_SIZE = "20M"NETWORK_HB_TIMEOUT = 30RESTART_INTERVAL = 30RESTART_TIMES = 3WAIT_STOP_FIN_TIME = 90[group.yfsconfig] # YFS 配置参数,不配置时采用默认值SHM_POOL_SIZE = "2G"SYS_AREA_SIZE = "1G"YFS_PACKET_SIZE = "1M"
3.3. 安装软件
我这里是选择直接安装(由于一开始没有找到插件包下载地址):
[yashan@yca1 install]$ ./bin/yasboot package install -t hosts.toml -i /home/yashan/install/yashandb-23.2.4.100-linux-x86_64.tar.gz
host host0001 openssl version: OpenSSL 1.1.1f 31 Mar 2020
OpenSSL version is 1.1.1 or greater
host host0002 openssl version: OpenSSL 1.1.1f 31 Mar 2020
OpenSSL version is 1.1.1 or greater
checking install package...
install version: yashandb 23.2.4.100
host0001 100% [====================================================================] 3s
host0002 100% [====================================================================] 3s
update host to yasom...
如果有插件包的话可以使用以下命令进行安装:
## ./bin/yasboot package install -t hosts.toml -i yashandb-23.2.1.100-linux-x86_64.tar.gz --plugin yashandb-plugins-all-23.2.1.100-linux-x86_64.tar.gz
插件包可以直接在官网下载:
注意:如需使用 DBLINK 功能和更丰富的内置函数(例如 LSFA_LISTAGG),需先下载 plugin 插件包并在安装命令中指定 --plugin
参数(安装完成后,无法单独安装该插件包)。
3.4. 数据库部署
## 安装部署 yasdb,-p 指定的是 sys 用户密码;通过指定 [ -d, --child ] 参数展示任务以及子任务信息,从而了解部署进度。[yashan@yca1 install]$ ./bin/yasboot cluster deploy -t yashandb.toml -p yasdb_123 -d --yfs-force-createtype | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------------------task | 33d01a0d06165154 | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 268
-------+------------------+--------------------+----------+-------------------+---------+-------------+----------+------child | 820e58493b15e5f3 | DeployCePrimary | host0001 | yashandb.1-1 | SUCCESS | 0 | 100 | 243+------------------+--------------------+----------+-------------------+---------+-------------+----------+------| ebc07fc76721fcb4 | DeployCeNormal | host0002 | yashandb.1-2 | SUCCESS | 0 | 100 | 23+------------------+--------------------+----------+-------------------+---------+-------------+----------+------| befac0b1b55b992a | SyncNodeConfig | - | yashandb | SUCCESS | 0 | 100 | 1+------------------+--------------------+----------+-------------------+---------+-------------+----------+------| 1fc1b8cf0b8af902 | MonitReload | host0001 | yashandb-host0001 | SUCCESS | 0 | 100 | 1+------------------+--------------------+----------+-------------------+---------+-------------+----------+------| 6862f5697e70af09 | MonitReload | host0002 | yashandb-host0002 | SUCCESS | 0 | 100 | 1
-------+------------------+--------------------+----------+-------------------+---------+-------------+----------+------
task completed, status: SUCCESS
返回以上信息表示已成功部署。
4. 安装后检查
4.1. 配置环境变量(所有节点)
部署命令成功执行后将会在 $YASDB_HOME 目录下的 conf 文件夹中生成 <<集群名称>>.bashrc 环境变量文件:
## 以节点一为例
[yashan@yac01 ~]$ cd /data/yashan/yasdb_home/yashandb/23.2.4.100/conf/
[yashan@yac01 conf]$ ls yashandb.bashrc
yashandb.bashrc
[yashan@yac01 conf]$ cat yashandb.bashrc >>~/.bashrc
[yashan@yac01 conf]$ echo "alias ys='yasql / as sysdba'" >> ~/.bashrc
[yashan@yac01 conf]$ source ~/.bashrc
ycsctl 是 YashanDB 的 YCS 管理工具,用户可使用本工具实现对共享集群的管理操作,包括集群级别的管理和节点级别的管理。
其中,节点级别的 ycsctl 命令要求节点上的 YCS 启动后才能执行,并配置 $YASCS_HOME 环境变量:
# 如下路径需更换为实际的节点路径
[yashan@yac01 ~]$ echo "export YASCS_HOME=/data/yashan/yasdb_data/ycs/ce-1-1" >> ~/.bashrc
[yashan@yac02 ~]$ echo "export YASCS_HOME=/data/yashan/yasdb_data/ycs/ce-1-2" >> ~/.bashrc
4.2. 检查集群
查看集群状态:
[yashan@yca1 ~]$exit
[root@yca1 install]# su - yashan
[yashan@yca1 ~]$ ycsctl status
---------------------------------------------------------------------------------------------
Self Host ID|Cluster Master ID|YasFS Master ID|YasDB Master ID|Active Host Count
---------------------------------------------------------------------------------------------
1 1 1 1 2
---------------------------------------------------------------------------------------------
Host ID |Target |State |YasFS |YasDB
---------------------------------------------------------------------------------------------
1 online online online online
2 online online online online[yashan@yca2 ~]$ ycsctl status
---------------------------------------------------------------------------------------------
Self Host ID|Cluster Master ID|YasFS Master ID|YasDB Master ID|Active Host Count
---------------------------------------------------------------------------------------------
2 1 1 1 2
---------------------------------------------------------------------------------------------
Host ID |Target |State |YasFS |YasDB
---------------------------------------------------------------------------------------------
1 online online online online
2 online online online online-- 注意两条语句不是一样,如果也是执行yac01的语句,会报:[yashan@yca2 ~]$ ycsctl status
load profile failed, can not open /data/yashan/yasdb_data/ycs/ce-1-1/config/yascs.ini.
YAS-00313 failed to open file /data/yashan/yasdb_data/ycs/ce-1-1/config/yascs.ini, errno 2, error message "No such file or directory".重新在节点2上面执行一遍就好了。
查看集群配置:
[yashan@yca1 ~]$ ycsctl show configCluster name: yashandb, config version: 4Cluster id: 675af7f4f4df34639b362bd04357bf9aVoting disk: /dev/yas/voteNetwork timeout: 30sDisk heartbeat keep alive: 30sDefault resource yasfs: enabledShell in cluster:Start shell: start.shStop shell: stop.shMonitor shell: monitor.shNodes in cluster:Node name: yca1, yascs/yasfs inter connect URL: 192.168.50.60:1788, Node ID: 1yasdb instance name:yasdb, yasdb instance id:1Node name: yca2, yascs/yasfs inter connect URL: 192.168.50.61:1788, Node ID: 2yasdb instance name:yasdb, yasdb instance id:1
[yashan@yca1 ~]$
更多 ycsctl 用法可使用 ycsctl -H
查看。
4.3. 检查数据库
检查数据库状态:
[yashan@yca1 ~]$ yasboot cluster status -c yashandb -dhostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
--------------------------------------------------------------------------------------------------------------------------------------------------host0001 | ce | 1-1:1 | 57146 | open | normal | primary | 192.168.50.60:1688 | /data/yashan/yasdb_data/ce-1-1
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+--------------------------------host0002 | ce | 1-2:2 | 160563 | open | normal | primary | 192.168.50.61:1688 | /data/yashan/yasdb_data/ce-1-2
----------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+--------------------------------
[yashan@yca1 ~]$## 以 host 或组为索引展示,默认为 host[yashan@yca1 ~]$ yasboot cluster status -b group -c yashandb -dgroup_name | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
----------------------------------------------------------------------------------------------------------------------------------------------------ceg1 | ce | 1-1:1 | 57146 | open | normal | primary | 192.168.50.60:1688 | /data/yashan/yasdb_data/ce-1-1+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+--------------------------------| ce | 1-2:2 | 160563 | open | normal | primary | 192.168.50.61:1688 | /data/yashan/yasdb_data/ce-1-2
------------+-----------+--------+--------+-----------------+-----------------+---------------+--------------------+--------------------------------
[yashan@yca1 ~]$
查看实例状态:
## 系统认证方式登录,可以直接使用 ys 别名:yasql / as sysdba 方式连接
[yashan@yca1 ~]$ ys
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit LinuxSQL>
## 也可以使用简单连接方式连接
[yashan@yca1 ~]$ yasql sys/yasdb_123@192.168.50.60:1688
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit LinuxSQL> exit
[yashan@yca1 ~]$ yasql sys/yasdb_123@192.168.50.61:1688
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit LinuxSQL>
SQL> select instance_number,instance_name from gv$instance;INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------------------------------------------------------2 yasdb1 yasdb2 rows fetched.SQL>
4.4. 创建用户和表
创建用户和表,一是测试数据库是否正常,二是为下一章节的数据迁移做准备。
新建 hefei 用户密码也是 hefei。
-- 创建用户
SQL> create user hefei identified by hefei;Succeed.
-- 授予 DBA 权限
SQL> grant dba to hefei;Succeed.
-- 连接用户
SQL> conn hefei/hefeiConnected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit Linux
-- 创建表
SQL> create table hefei(id number,name varchar2(20));Succeed.
-- 插入数据
SQL> insert into hefei values (1,'hefei');1 row affected.
-- 提交
SQL> commit;Succeed.
-- 查询数据
SQL> select * from hefei;ID NAME
----------- ---------------------1 hefei1 row fetched.
-- 创建索引
SQL> create index idx_hefei_id on hefei(id);Succeed.
4.5. 配置 monit
启动所有服务器上的 monit 进程:
[yashan@yca1 ~]$ yasboot monit start -c yashandb -dtype | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------------------task | 09940235e804c88d | MonitParentStart | - | yashandb | SUCCESS | 0 | 100 | 1
-------+------------------+------------------+----------+-------------------+---------+-------------+----------+------child | c6f2b5b272d86723 | MonitStart | host0001 | yashandb-host0001 | SUCCESS | 0 | 100 | 1+------------------+------------------+----------+-------------------+---------+-------------+----------+------| f3ce68ff736deb36 | MonitStart | host0002 | yashandb-host0002 | SUCCESS | 0 | 100 | 1
-------+------------------+------------------+----------+-------------------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yca1 ~]$
查看 monit 的监控状态简略信息:
[yashan@yca1 ~]$ yasboot monit summary -c yashandb
--------------------------------------------------------------------------------
HostID: host0001, ManageIP: 192.168.50.60
--------------------------------------------------------------------------------
Monit 5.34.2 uptime: 0mService Name Status Typeyca1 OK Systemyasom OK Processyashandb-ce-1-1 OK Processyasagent OK Process--------------------------------------------------------------------------------
HostID: host0002, ManageIP: 192.168.50.61
--------------------------------------------------------------------------------
Monit 5.34.2 uptime: 0mService Name Status Typeyca2 OK Systemyashandb-ce-1-2 OK Processyasagent OK Process[yashan@yca1 ~]$
4.6. 配置开机自启(所有节点)
由于每次开机都需要启动 yasom 和 yasagent,然后再启动数据库:
## 手动启动 yasom 和 yasagent 进程
[root@yac01 ~]# yasboot process yasom start -c yashandb
[root@yac01 ~]# yasboot process yasagent start -c yashandb## 待 yasom 和 yasagent 进程启动后,才能启动数据库
[root@yac01 ~]# yasboot cluster start -c yashandbprocess /data/yashan/yasdb_home/yashandb/23.2.4.100/bin/yasom already running
[yashan@yca1 ~]$ yasboot process yasagent start -c yashandb
process /data/yashan/yasdb_home/yashandb/23.2.4.100/bin/yasagent already running
[yashan@yca1 ~]$ yasboot cluster start -c yashandbtype | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------task | 7327dc092adddc31 | StartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 1
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yca1 ~]$[yashan@yca2 ~]$ yasboot process yasom start -c yashandb
can not find conf /data/yashan/yasdb_home/yashandb/23.2.4.100/om/yashandb/conf/yasom.toml,plz check it
[yashan@yca2 ~]$ yasboot process yasagent start -c yashandb
process /data/yashan/yasdb_home/yashandb/23.2.4.100/bin/yasagent already running
[yashan@yca2 ~]$ yasboot cluster start -c yashandbtype | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------task | f2995f3d0326012c | StartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 1
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yca2 ~]$
以上方式比较麻烦,所以建议配置开机自启,配置开机自启动,需在 yasagent 进程所在服务器(即每台服务器)中执行以下操作:
## 获取 monit 命令位置
[yashan@yac01 ~]$ which monit
/usr/local/bin/monit## monit 的安装路径需更换为实际获取到的内容
[root@yac01 ~]# cat<<-EOF>>/etc/rc.local
su - yashan -c '/usr/local/bin/monit -c /data/yashan/yasdb_home/yashandb/23.2.4.100/ext/monit/monitrc'
EOF[root@yac01 ~]# chmod +x /etc/rc.d/rc.local[root@yac02 ~]# cat<<-EOF>>/etc/rc.local
su - yashan -c '/usr/local/bin/monit -c /data/yashan/yasdb_home/yashandb/23.2.4.100/ext/monit/monitrc'
EOF[root@yac02 ~]# chmod +x /etc/rc.d/rc.local
重启主机测试是否会开启:
[root@ymp ~]# reboot
## 重启后连接数据库,正常开启
[root@yca1 ~]# su - yashan
上一次登录: 四 12月 12 23:25:39 CST 2024
[yashan@yca1 ~]$ ys
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit LinuxSQL>
5. 使用崖山运维监控工具管理
Yashan 数据库拥有自带的数据库运维管理软件 YCM,YCM安装见这里。
安装完成后,通过 ip:9060 端口进入崖山运维管理平台。添加管理的需要的主机和数据库。
崖山后台也是通过集成了普罗米修斯的监控平台,进行的主机和数据库数据采集和监控。
6. 集群数据迁移测试
Yashan 数据库拥有自带的数据库迁移软件 YMP,YMP 安装见这里。
安装完成后,通过 ip:8090 端口进入崖山迁移平台。选择数据源管理。
点击添加数据源
这里添加我们上面部署好的崖山数据库的 IP 和数据库名,点击测试连接,需要显示连接成功后,确认保存。
再添加一个 oracle 数据库,可以自己安装一台 oracle 数据库,安装教程可以参考这里,文末有安装好的虚拟机,下载下来,直接可以应用。
添加好两个数据源。
点击任务管理,创建任务
任务名称:oracle2yashan
迁移步骤默认
源端数据库,选择我们上面添加的 oracle 数据库
目标数据库,选择我们上面添加的 崖山数据库集群。
选择评估对象,点击开始迁移评估
进行迁移评估检查,这里时间比较长,是跟你数据量有关系。
评估结果
可以看下详细的信息
如果兼容率不达100,是无法跳转下一步的,需要手动修改不兼容对象的目标端DDL或忽略不兼容项,并刷新报告。
可以查看不兼容的原因
在线修改不兼容的语句,这个很赞👍,很方便。
修改完后,继续进行迁移评估,评估通过。
提示表空间未通过,到集群数据库中新增表空间
#新增表空间:
[yashan@yca1 ~]$ yasql / as sysdba
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit LinuxSQL> create tablespace itpux datafile'+DG0/dbfiles/itpux.dbf'size 100m;[1:62]YAS-04204 number of FILE SIZE must be between 1048576 and 549755813888SQL> create tablespace itpux datafile'+DG0/dbfiles/itpux.dbf'size 100M;Succeed.SQL>
检查过程中 YMP 应用的数据库版本要和集群数据库版本一致,否则验证无法通过。
这样演示怎么将 ymp 版本升级匹配和集群一致的。
[root@yashan ~]# cd /app/install/
[root@yashan install]# ll
total 452580
drwxrwxr-x. 6 yashan yashan 70 Jul 8 17:12 admin
drwxrwxr-x. 2 yashan yashan 229 Jul 8 17:12 bin
drwxrwxr-x. 2 yashan yashan 199 Nov 12 21:41 conf
drwxrwxr-x. 4 yashan yashan 33 Jul 8 17:12 ext
-rw-rw-r--. 1 yashan yashan 10698 Jul 8 17:12 gitmoduleversion.dat
-rw-------. 1 yashan yashan 454 Nov 14 14:04 hosts.toml
drwxrwxr-x. 2 yashan yashan 42 Jul 8 17:12 include
drwxrwxr-x. 3 yashan yashan 17 Jul 8 17:12 java
drwxrwxr-x. 2 yashan yashan 4096 Jul 8 17:12 lib
-rw-r-----. 1 yashan yashan 14989 Jul 8 17:12 LICENSE
drwxrwxr-x. 3 yashan yashan 41 Nov 12 20:26 om
drwxrwxr-x. 3 yashan yashan 21 Jul 8 17:12 plug-in
drwxrwxr-x. 2 yashan yashan 61 Jul 8 17:12 scripts
-rw-r--r--. 1 root root 189823431 Dec 12 19:39 yashandb-23.2.4.100-linux-x86_64.tar.gz
-rw-r--r--. 1 root root 183555278 Nov 12 19:53 yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
-rw-------. 1 yashan yashan 751 Nov 14 14:04 yashandb.toml
-rw-r--r--. 1 root root 90012826 Dec 12 19:37 yashan-migrate-platform-v23.3.1.0-linux-x86-64.zip
drwxr-xr-x. 20 yasmanager yasmanager 4096 Nov 14 16:16 ycm
drwxr-xr-x. 2 root root 6 Nov 14 16:06 ycm-agent
[root@yashan install]# su - ymp
Last login: Thu Dec 12 17:16:37 CST 2024 on pts/1
[ymp@yashan ~]$ cd /home/ymp/yashan-migrate-platform/
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh status
2024-12-12 19:41:59 INFO --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","status"]
2024-12-12 19:42:00 INFO --- [main] com.sics.command.serviceimpl.StatusServiceImpl : YMP is running, pid is 10907.
2024-12-12 19:42:00 INFO --- [main] com.sics.command.serviceimpl.StatusServiceImpl : Built-in database is used, pid is 10907.
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh stop
2024-12-12 19:42:05 INFO --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","stop"]type | uuid | name | hostid | index | status | return_code | progress | cost
2024-12-12 19:42:09 INFO --- [main] com.sics.command.util.CommandUtil : -------------------------------------------------------------------------------------------------------
2024-12-12 19:42:09 INFO --- [main] com.sics.command.util.CommandUtil : task | 8c845548368f2f1b | StopYasdbCluster | - | ymp | SUCCESS | 0 | 100 | 3
2024-12-12 19:42:09 INFO --- [main] com.sics.command.util.CommandUtil : ------+------------------+------------------+--------+-------+---------+-------------+----------+------
2024-12-12 19:42:09 INFO --- [main] com.sics.command.util.CommandUtil : task completed, status: SUCCESS
2024-12-12 19:42:09 INFO --- [main] com.sics.command.operation.DbOperation : YMP stop successfully!
[ymp@yashan yashan-migrate-platform]$ rm -rf /home/ymp/.yasboot/ymp.env
[ymp@yashan yashan-migrate-platform]$ cd /home/ymp/yashan-migrate-platform/db
[ymp@yashan db]$ rm -rf *
[ymp@yashan db]$ cd ..
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh install --db /app/install/yashandb-23.2.4.100-linux-x86_64.tar.gz --path /home/ymp/instantclient_19_19/
2024-12-12 19:43:21 INFO --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","install","--db","/app/install/yashandb-23.2.4.100-linux-x86_64.tar.gz","--path","/home/ymp/instantclient_19_19/","--ip","192.168.50.183","--memory","4G"]
2024-12-12 19:43:22 ERROR --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Port 8093 has been used, pid is 10435
!
2024-12-12 19:43:22 ERROR --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Port 8094 has been used, pid is 10415
!
YMP install failed!
[ymp@yashan yashan-migrate-platform]$ kill -9 10435
[ymp@yashan yashan-migrate-platform]$ kill -9 10415
[ymp@yashan yashan-migrate-platform]$ sh bin/ymp.sh install --db /app/install/yashandb-23.2.4.100-linux-x86_64.tar.gz --path /home/ymp/instantclient_19_19/
2024-12-12 19:43:50 INFO --- [main] com.sics.command.YmpCommandMain : 指令入参:["--operation","install","--db","/app/install/yashandb-23.2.4.100-linux-x86_64.tar.gz","--path","/home/ymp/instantclient_19_19/","--ip","192.168.50.183","--memory","4G"]
2024-12-12 19:43:50 INFO --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Check for env before install is successfully!
2024-12-12 19:43:57 INFO --- [main] com.sics.command.serviceimpl.PackageServiceImpl : Db package unpackage successfully!
2024-12-12 19:43:57 INFO --- [main] com.sics.command.serviceimpl.CheckServiceImpl : OCI version is 19.19.0.0.0!
2024-12-12 19:44:04 INFO --- [main] com.sics.command.serviceimpl.PackageServiceImpl : Yasldr package unpackage successfully!
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : OpenSSL version is 1.1.1 or greater
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : OpenSSL version is 1.1.1 or greater
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : hostid | group | node_type | node_name | listen_addr | replication_addr | data_path
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : ----------------------------------------------------------------------------------------------------------------------------
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : host0001 | dbg1 | db | 1-1 | 0.0.0.0:8091 | 127.0.0.1:8092 | /home/ymp/yashan-migrate-platform/db/data/ymp
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : ----------+-------+-----------+-----------+--------------+------------------+-----------------------------------------------
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil :
2024-12-12 19:44:04 INFO --- [main] com.sics.command.util.CommandUtil : Generate config completed
2024-12-12 19:44:14 INFO --- [main] com.sics.command.util.CommandUtil : host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
2024-12-12 19:44:14 INFO --- [main] com.sics.command.util.CommandUtil : OpenSSL version is 1.1.1 or greater
2024-12-12 19:44:14 INFO --- [main] com.sics.command.util.CommandUtil : checking install profile.toml...
2024-12-12 19:44:14 INFO --- [main] com.sics.command.util.CommandUtil : install version: yashandb 23.2.4.100
2024-12-12 19:44:14 INFO --- [main] com.sics.command.util.CommandUtil : update host to yasom...type | uuid | name | hostid | index | status | return_code | progress | cost
2024-12-12 19:44:26 INFO --- [main] com.sics.command.util.CommandUtil : ---------------------------------------------------------------------------------------------------------
2024-12-12 19:44:26 INFO --- [main] com.sics.command.util.CommandUtil : task | cf31860c57d94c50 | DeployYasdbCluster | - | ymp | SUCCESS | 0 | 100 | 11
2024-12-12 19:44:26 INFO --- [main] com.sics.command.util.CommandUtil : ------+------------------+--------------------+--------+-------+---------+-------------+----------+------
2024-12-12 19:44:26 INFO --- [main] com.sics.command.util.CommandUtil : task completed, status: SUCCESStype | uuid | name | hostid | index | status | return_code | progress | cost
2024-12-12 19:44:30 INFO --- [main] com.sics.command.util.CommandUtil : -------------------------------------------------------------------------------------------------------
2024-12-12 19:44:30 INFO --- [main] com.sics.command.util.CommandUtil : task | d760ddd7ebd57dbc | StopYasdbCluster | - | ymp | SUCCESS | 0 | 100 | 3
2024-12-12 19:44:30 INFO --- [main] com.sics.command.util.CommandUtil : ------+------------------+------------------+--------+-------+---------+-------------+----------+------
2024-12-12 19:44:30 INFO --- [main] com.sics.command.util.CommandUtil : task completed, status: SUCCESS
2024-12-12 19:44:30 INFO --- [main] com.sics.command.util.CommandUtil : YashanDB Loader Enterprise Edition Release 23.2.4.100 x86_64 6db1237type | uuid | name | hostid | index | status | return_code | progress | cost
2024-12-12 19:44:34 INFO --- [main] com.sics.command.util.CommandUtil : --------------------------------------------------------------------------------------------------------
2024-12-12 19:44:34 INFO --- [main] com.sics.command.util.CommandUtil : task | 7be829e5f605d6a1 | StartYasdbCluster | - | ymp | SUCCESS | 0 | 100 | 3
2024-12-12 19:44:34 INFO --- [main] com.sics.command.util.CommandUtil : ------+------------------+-------------------+--------+-------+---------+-------------+----------+------
2024-12-12 19:44:34 INFO --- [main] com.sics.command.util.CommandUtil : task completed, status: SUCCESS
[Mem:, 15885, 5626, 5072, 16, 5186, 9920]
2024-12-12 19:44:35 INFO --- [main] com.sics.command.util.CommandUtil : Dec 12, 2024 7:44:35 PM com.sics.migrate.port.common.jna.CallDts dtscInitLog
2024-12-12 19:44:35 INFO --- [main] com.sics.command.util.CommandUtil : INFO: ### call dtscInitLog!
2024-12-12 19:44:35 INFO --- [main] com.sics.command.util.CommandUtil : Dec 12, 2024 7:44:35 PM com.sics.migrate.port.common.jna.CallDts dtscInitLog
2024-12-12 19:44:35 INFO --- [main] com.sics.command.util.CommandUtil : INFO: ### finished dtscInitLog!
2024-12-12 19:44:35 INFO --- [main] com.sics.command.serviceimpl.CheckServiceImpl : Yasdts environment check successfully!
2024-12-12 19:44:35 INFO --- [main] com.sics.command.serviceimpl.PasswordServiceImpl : Update sys password and salt successfully!
YMP started successfully!
[ymp@yashan yashan-migrate-platform]$
重新检查:
忽略告警,进行离线迁移
进行数据初始化
进行数据一致性校验
校验完成。
7. 使用 DBeaver 连接数据库
使用 DBeaver 登录崖山数据库查询数据是否导入,具体配置请参考改文章。
通过登录数据库,查询数据导入正常,至此,Oracle 数据库迁移至崖山数据库集群结束,谢谢。