有个虚拟机,以前用obd自动配置过oceanbase集群做测试,测试完之后就把这个集群删除了。现在,已经过了一段时间了,oceanbase已经有了新版本,在7月18日更新了3.1.4版,想测试体验一下这个新版本,需要怎么操作?
说起来,这个操作其实很简单,只要使用obd重新部署一个集群即可。集群的配置文件可以使用以前集群的配置文件,当然,这个配置文件里不能有版本配置信息。下面记录了obd配置数据库集群所作的操作、过程及输出。
[admin@my_ob ~]$ obd cluster deploy my_cluster -c single_cluster.yaml
Update OceanBase-community-stable-el7 ok
Update OceanBase-development-kit-el7 ok
更新数据库社区版及开发工具信息
Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 100% [###############] Time: 0:02:48 293.95 kB/s
Found a higher version
name: oceanbase-ce
version: 3.1.4
release:10000092022071511.el7
arch: x86_64
md5: c5cd94f4f190317b6a883c58a26460a506205ce6
Do you want to use it? [y/n]: y
Package oceanbase-ce-3.1.4 is available.
下载了数据库最新版3.1.4。
obproxy-ce-3.2.3 already installed.
install oceanbase-ce-3.1.4 for local ok
+-------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+-----------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+-----------------------+------------------------------------+
| obproxy-ce | 3.2.3 | 2.el7 | bdd299bda2bdf71fd0fd3f155b6a2e39dffd2be1 |
| oceanbase-ce | 3.1.4 | 10000092022071511.el7 | c5cd94f4f190317b6a883c58a26460a506205ce6 |
+--------------+---------+-----------------------+-----------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote obproxy-ce-3.2.3-bdd299bda2bdf71fd0fd3f155b6a2e39dffd2be1 repository install ok
Remote obproxy-ce-3.2.3-bdd299bda2bdf71fd0fd3f155b6a2e39dffd2be1 repository lib check ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository install ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check !!
远程仓库包含数据库社区版3.1.4,proxy社区版3.2.3
[WARN] 192.168.56.101 oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 require: libmariadb.so.3
社区版3.1.4 需要libmariadb.so.3包
Try to get lib-repository
Download oceanbase-ce-libs-3.1.4-10000092022071511.el7.x86_64.rpm (155.26 K): 100% [#########] Time: 0:00:00 287.03 kB/s
Found a higher version
name: oceanbase-ce-libs
version: 3.1.4
release:10000092022071511.el7
arch: x86_64
md5: 6d5437b0cad486b55963f89b8ef3769af7995350
ce-libs也有了3.14版本
Do you want to use it? [y/n]: y
你要使用它吗?选择yes
Package oceanbase-ce-libs-3.1.4 is available.
install oceanbase-ce-libs-3.1.4 for local ok
准备安装oceanbase-ce-libs到本地
Use oceanbase-ce-libs-3.1.4-6d5437b0cad486b55963f89b8ef3769af7995350 for oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6
Remote oceanbase-ce-libs-3.1.4-6d5437b0cad486b55963f89b8ef3769af7995350 repository install ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check ok
所有组件都已就绪。
Cluster status check ok
Initializes obproxy work home ok
Initializes observer work home ok
初始化obproxy及observer工作目录。
my_cluster deployed
完成部署。
查看已经部署好的集群
[admin@my_ob ~]$ obd cluster list
+--------------------------------------------------------------------+
| Cluster List |
+------------+-------------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+------------+-------------------------------------+-----------------+
| my_cluster | /home/admin/.obd/cluster/my_cluster | deployed |
+------------+-------------------------------------+-----------------+
启动集群
[admin@my_ob ~]$ obd cluster start my_cluster
Get local repositories and plugins ok
获取本地仓库和插件
Open ssh connection ok
打开ssh连接,自动化部署需要配置ssh免登录,即使是在一台虚拟机上部署也需要配置免登录,否则这一步会失败。
Load cluster param plugin ok
Check before start obproxy ok
Check before start observer ok
启动前检查就绪。
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
启动数据库代理,代理程序健康检查就绪,代理服务器连接成功。
Initialize cluster
+--------------------------------------------------+
| obproxy |
+----------------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+----------------+------+-----------------+--------+
| 192.168.56.101 | 2883 | 2884 | active |
+----------------+------+-----------------+--------+
上面显示的代理服务器的连接信息。
Start observer ok
observer program health check ok
Connect to observer ok
启动observer就绪,observer健康检查就绪,连接到observer成功。
Initialize cluster
Cluster bootstrap ok
开始数据库集群自举,第一次启动数据库集群时需要做这个操作。
Wait for observer init ok
等待observer初始化,observer初始化成功,
+--------------------------------------------------+
| observer |
+----------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+----------------+---------+------+-------+--------+
| 192.168.56.101 | 3.1.4 | 2881 | zone1 | active |
+----------------+---------+------+-------+--------+
my_cluster running
集群已经处于running状态,可以正常登录了。
登录数据库sys租户,检查一下集群版本
[admin@my_ob ~]$ obclient -h 192.168.56.101 -P 2883 -uroot@sys -A -c -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
+--------------------+
7 rows in set (0.003 sec)
MySQL [(none)]> select version();
+--------------------+
| version() |
+--------------------+
| 3.1.4-OceanBase CE |
+--------------------+
1 row in set (0.006 sec)
数据库时社区版3.1.4
可以看到,oceanbase3.1.4 的启动顺序发生变化,以前的版本是先启动observer,再启动obproxy,现在则是先启动obproxy,再启动observer。启动的过程好像也做了优化,以前启动过程中(4C16G的虚拟机)经常发生obproxy和observer连接不上的情况,需要重新运行一下集群启动命令才能启动成功。还是那台虚拟机,却没有发生这种情况。