OB 4.0 安装测试 夜深人静难掩激动

背景:
昨天下午收到消息ob出了4.0版本,虽然抓心挠肺,但是也要认真工作啊。只能等下班夜深人静,迫不及待来体验一下,我有看到官方文档更新,但是作为一个技术人员,大家应该都有买了电子产品先拆封,实在搞不定再看说明书的习惯吧,所以,是的我直接就来装环境了。
体验:
可以从社区下载安装包,看快速上手文档哦。https://open.oceanbase.com/quickStart
可以看到

ob的4.0版本已经支持4c8g的配置来安装了,对于很多学生党和想来试水学习的小伙伴还是很友好的哈

image
直接下载all-in-one的安装包,里面包含了 OBD、OceanBase 数据库、 OBProxy、obagent、Grafana 和 Prometheus ,一应俱全啊;

先准备下环境哈~
先去下载个红帽7.x镜像装个虚拟机,把ob的安装包也下载下,然后vm装个虚拟机,这个步骤就略过吧

image

可以看到我虚拟机资源给了4c8g,系统装好后,确保/home目录给54GB以上,使用ulimit -n 65535 命令修改下open file,也可以ulimit -a先检查下哦,也可以修改配置文件修改,自行选择。(ps:为啥我知道要检查这两项那,因为有小伙伴已经试水了哈哈)
解压安装包,执行安装

[root@localhost home]# tar -xzf oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
[root@localhost home]# ls
oceanbase-all-in-one  oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz  zry
[root@localhost home]# cd oceanbase-all-in-one/
[root@localhost oceanbase-all-in-one]# ls
bin  conf  obclient  obd  README.md  rpms  VERSION
[root@localhost oceanbase-all-in-one]# cd bin/
[root@localhost bin]# ls
env.sh  install.sh  uninstall.sh
[root@localhost bin]# ./install.sh
name: grafana
version: 7.5.17
release:1
arch: x86_64
md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
add /home/oceanbase-all-in-one/rpms/grafana-7.5.17-1.el7.x86_64.rpm to local mirror
name: obagent
version: 1.2.0
release:4.el7
arch: x86_64
md5: 0e8f5ee68c337ea28514c9f3f820ea546227fa7e
add /home/oceanbase-all-in-one/rpms/obagent-1.2.0-4.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.0.0
release:5.el7
arch: x86_64
md5: de53232a951184fad75b15884458d85e31d2f6c3
add /home/oceanbase-all-in-one/rpms/obproxy-ce-4.0.0-5.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.0.0.0
release:100000272022110114.el7
arch: x86_64
md5: 42611dc51ca9bb28f36e60e4406ceea4a74914c7
add /home/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.0.0.0
release:100000272022110114.el7
arch: x86_64
md5: 188919f8128394bf9b62e3989220ded05f1d14da
add /home/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
name: prometheus
version: 2.37.1
release:10000102022110211.el7
arch: x86_64
md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
add /home/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
Disable remote ok

#####################################################################
 Install Finished
=====================================================================
Setup Environment:     source ~/.oceanbase-all-in-one/bin/env.sh
Quick Start:           obd demo
More Details:          obd -h
=====================================================================

可以看到提示你执行初始化环境的脚本,通过obd demo的方式安装一个demo库

[root@localhost bin]#source ~/.oceanbase-all-in-one/bin/env.sh
[root@localhost bin]# obd demo
Get local repositories ok
Search plugins ok
Open ssh connection ok
Cluster status check ok
prometheus work dir cleaning ok
obagent work dir cleaning ok
observer work dir cleaning ok
obproxy work dir cleaning ok
grafana work dir cleaning ok
demo destroyed
install prometheus-2.37.1 for local ok
install oceanbase-ce-4.0.0.0 for local ok
install grafana-7.5.17 for local ok
install obagent-1.2.0 for local ok
install obproxy-ce-4.0.0 for local ok
Cluster param config check ok
Open ssh connection ok
Generate prometheus configuration ok
Generate observer configuration ok
Generate grafana configuration ok
Generate obagent configuration ok
Generate obproxy configuration ok
install prometheus-2.37.1 for local ok
install oceanbase-ce-4.0.0.0 for local ok
install grafana-7.5.17 for local ok
install obagent-1.2.0 for local ok
install obproxy-ce-4.0.0 for local ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
| oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obagent      | 1.2.0   | 4.el7                  | 0e8f5ee68c337ea28514c9f3f820ea546227fa7e |
| obproxy-ce   | 4.0.0   | 5.el7                  | de53232a951184fad75b15884458d85e31d2f6c3 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes prometheus work home ok
Initializes observer work home ok
Initializes grafana work home ok
Initializes obagent work home ok
Initializes obproxy work home ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository install ok
Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository lib check !!
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository install ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository lib check ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
Try to get lib-repository
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-100000272022110114.el7-188919f8128394bf9b62e3989220ded05f1d14da repository install ok
Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository lib check ok
demo deployed
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] OBD-1007: (127.0.0.1) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (127.0.0.1) clog and data use the same disk (/)

Check before start obagent ok
Check before start obproxy ok
Check before start prometheus ok
Check before start grafana ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster ok
Start obagent ok
obagent program health check ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster ok
Start promethues ok
prometheus program health check ok
Connect to Prometheus ok
Initialize cluster ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Initialize cluster ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase

+-----------------------------------------------+
|                    obagent                    |
+-----------+-------------+------------+--------+
| ip        | server_port | pprof_port | status |
+-----------+-------------+------------+--------+
| 127.0.0.1 | 8088        | 8089       | active |
+-----------+-------------+------------+--------+
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase
+--------------------------------------------------+
|                    prometheus                    |
+-----------------------+------+----------+--------+
| url                   | user | password | status |
+-----------------------+------+----------+--------+
| http://127.0.0.1:9090 |      |          | active |
+-----------------------+------+----------+--------+
+----------------------------------------------------------------+
|                            grafana                             |
+-----------------------------------+-------+-----------+--------+
| url                               | user  | password  | status |
+-----------------------------------+-------+-----------+--------+
| http://127.0.0.1:3000/d/oceanbase | admin | oceanbase | active |
+-----------------------------------+-------+-----------+--------+
demo running

完美,一两分钟就runing了哦,来测试下连接吧。

[root@localhost bin]# obclient -h127.0.0.1 -uroot -P2881
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221513152
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov  1 2022 14:57:18)

Copyright (c) 2000, 2018, OB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [(none)]> select version();
+------------------------------+
| version()                    |
+------------------------------+
| 5.7.25-OceanBase_CE-v4.0.0.0 |
+------------------------------+
1 row in set (0.001 sec)

检查下他的进程

[root@localhost bin]# ps -ef|grep observer |grep -v "grep"
root      17177      1 30 08:12 ?        00:10:10 /root/oceanbase-ce/bin/observer -r 127.0.0.1:2882:2881 -p 2881 -P 2882 -z zone1 -n obcluster -c 1 -d /root/oceanbase-ce/store -i lo -l INFO -o __min_full_resource_pool_memory=2147483648,enable_syslog_recycle=True,enable_syslog_wf=True,max_syslog_file_count=4,memory_limit=6G,datafile_size=20G,log_disk_size=24G,system_memory=1G,cpu_count=16
[root@localhost bin]# ps -ef|grep obproxy |grep -v "grep"
root      17821      1  0 08:13 pts/0    00:00:01 bash /root/obproxy-ce/obproxyd.sh /root/obproxy-ce 127.0.0.1 2883 daemon
root      57664      1  3 08:45 ?        00:00:00 /root/obproxy-ce/bin/obproxy --listen_port 2883

可以看到observer进程obproxy进程都起来了,测试下proxy连接

[root@localhost bin]# obclient -h127.0.0.1 -uroot@sys#obcluster  -P2883
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 1
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov  1 2022 14:57:18)

Copyright (c) 2000, 2018, OB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [(none)]>

####一天后来补充####
在当晚测试的时候有发现proxy连接不稳定,总是断链

obclient [oceanbase]> select now() from dual;
ERROR 2013 (HY000): Lost connection to MySQL server during query
obclient [oceanbase]> select now() from dual;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: oceanbase

+---------------------+
| now()               |
+---------------------+
| 2022-11-04 14:12:09 |
+---------------------+
1 row in set (9.955 sec)

检查下proxy进程发现发生了重启

[root@oceanbase ~]# ps -ef|grep obproxy
root      17236      1  0 11:19 pts/1    00:00:13 bash /root/obproxy-ce/obproxyd.sh /root/obproxy-ce 127.0.0.1 2883 daemon
root      73928      1  5 14:11 ?        00:00:01 /root/obproxy-ce/bin/obproxy --listen_port 2883
root      74026  22158  0 14:12 pts/2    00:00:00 grep --color=auto obproxy

再看下日志,其实可以看到mem out的报错

[root@oceanbase ~]# cd  /root/obproxy-ce/
[root@oceanbase obproxy-ce]# ls
bin  control-config  etc  lib  log  obproxyd.sh  run  sharding-config
[root@oceanbase obproxy-ce]# cd log/
[root@oceanbase log]# tail -5000f obproxy.log
[2022-11-04 14:15:06.588152] ERROR [PROXY] do_monitor_mem (ob_proxy_main.cpp:949) [74886][Y0-00007F137F571460] [lt=0] [dc=0] obproxy's memroy is out of limit, will be going to commit suicide(mem_limited=209715200, OTHER_MEMORY_SIZE=73400320, is_out_of_mem_limit=true, cur_pos=9) BACKTRACE:0xc681ba 0xc3c445 0xbdf51c 0xbee461 0x186a6ff 0xb6f610 0xe63d26 0x7f138c188dd5 0x7f138bbafead 

看下主机内存使用,顺便看下进程内存使用

[root@oceanbase log]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7964        3830         533          16        3600        3701
Swap:          8063           1        8062
[root@oceanbase log]#  ps -aux | grep obproxy |grep -v "grep"
root      17236  0.1  0.0 113840  2188 pts/1    S    11:19   0:13 bash /root/obproxy-ce/obproxyd.sh /root/obproxy-ce 127.0.0.1 2883 daemon
root      76049 10.1  1.4 616696 115396 ?       Ssl  14:18   0:00 /root/obproxy-ce/bin/obproxy --listen_port 2883
[root@oceanbase log]# ps -aux | grep observer|grep -v "grep"
root      16605 64.7 32.3 3120860 2638412 ?     Ssl  11:17 118:31 /root/oceanbase-ce/bin/observer -r 127.0.0.1:2882:2881 -p 2881 -P 2882 -z zone1 -n obcluster -c 1 -d /root/oceanbase-ce/store -i lo -l INFO -o __min_full_resource_pool_memory=21474

发现进程使用内存并不高,不过虚拟机的可用内存确实很少了
检查下有没有内存溢出,发现也没有oom

[root@oceanbase log]# cat /var/log/messages|grep oom

分两步调整验证下
1.扩大下虚拟机内存从8G->10G

root@oceanbase log]# free -m
              total        used        free      shared  buff/cache   available
Mem:          10012        3865        2416          16        3730        5919
Swap:          8063           1        8062

测试了下仍然存在断链问题
2.调整proxy参数

obclient [oceanbase]> show proxyconfig like 'proxy_mem_limited';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: oceanbase

+-----------------------------+-------+----------------------------------------------------------------------------------------------+-------------+---------------+
| name                        | value | info                                                                                         | need_reboot | visible_level |
+-----------------------------+-------+----------------------------------------------------------------------------------------------+-------------+---------------+
| proxy_mem_limited           | 200M  | proxy memory limited, [100MB, 100G]                                                          | false       | USER          |
+-----------------------------+-------+----------------------------------------------------------------------------------------------+-------------+---------------+
1 rows in set (11.175 sec)

可以看到初始默认参数是200M 调整到 1G

obclient [oceanbase]> alter proxyconfig set  proxy_mem_limited ='1G';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: oceanbase

Query OK, 0 rows affected (10.243 sec)



obclient [oceanbase]> show proxyconfig like '%mem%';
+-----------------------------+-------+----------------------------------------------------------------------------------------------+-------------+---------------+
| name                        | value | info                                                                                         | need_reboot | visible_level |
+-----------------------------+-------+----------------------------------------------------------------------------------------------+-------------+---------------+
| proxy_mem_limited           | 1G    | proxy memory limited, [100MB, 100G]                                                          | false       | USER          |
+---------------------------

看下通过2883proxy连接怎么样

obclient [oceanbase]> select now() from dual;
+---------------------+
| now()               |
+---------------------+
| 2022-11-04 14:38:13 |
+---------------------+
1 row in set (0.001 sec)


obclient [oceanbase]> use test
Database changed
obclient [test]> show tables;
Empty set (0.003 sec)

obclient [test]> create table t1 values(a int );
Query OK, 0 rows affected (0.475 sec)

obclient [test]> commit;
Query OK, 0 rows affected (0.007 sec)

已经没有问题了,自己玩足够了,也不会断链了,如果入大批量数据的话proxy参数还是需要调整到合适的大小

########
很顺利哈,没有问题,那单节点的我比较好奇他的架构是什么样的

obclient [(none)]> use oceanbase;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
obclient [oceanbase]> select * from  __all_unit_config;
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
| gmt_create                 | gmt_modified               | unit_config_id | name            | max_cpu | min_cpu | memory_size | log_disk_size | max_iops | min_iops | iops_weight |
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
| 2022-11-02 23:13:33.948344 | 2022-11-02 23:13:33.948344 |              1 | sys_unit_config |       1 |       1 |  2147483648 |    2147483648 |    10000 |    10000 |           1 |
+----------------------------+----------------------------+----------------+-----------------+---------+---------+-------------+---------------+----------+----------+-------------+
1 row in set (0.000 sec)
obclient [oceanbase]> select * from __all_resource_pool;
+----------------------------+----------------------------+------------------+----------+------------+----------------+-----------+-----------+--------------+--------------------+
| gmt_create                 | gmt_modified               | resource_pool_id | name     | unit_count | unit_config_id | zone_list | tenant_id | replica_type | is_tenant_sys_pool |
+----------------------------+----------------------------+------------------+----------+------------+----------------+-----------+-----------+--------------+--------------------+
| 2022-11-02 23:13:34.008422 | 2022-11-02 23:13:34.013544 |                1 | sys_pool |          1 |              1 | zone1     |         1 |            0 |                  0 |
+----------------------------+----------------------------+------------------+----------+------------+----------------+-----------+-----------+--------------+--------------------+
1 row in set (0.001 sec)
obclient [oceanbase]> select * from __all_server;
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
| gmt_create                 | gmt_modified               | svr_ip    | svr_port | id | zone  | inner_port | with_rootserver | status | block_migrate_in_time | build_version                                                                             | stop_time | start_service_time | first_sessid | with_partition |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
| 2022-11-02 23:13:30.279917 | 2022-11-02 23:13:41.292753 | 127.0.0.1 |     2882 |  1 | zone1 |       2881 |               1 | ACTIVE |                     0 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |         0 |   1667402019361193 |            0 |              1 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
1 row in set (0.001 sec)
obclient [oceanbase]> select * from __all_server;
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
| gmt_create                 | gmt_modified               | svr_ip    | svr_port | id | zone  | inner_port | with_rootserver | status | block_migrate_in_time | build_version                                                                             | stop_time | start_service_time | first_sessid | with_partition |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
| 2022-11-02 23:13:30.279917 | 2022-11-02 23:13:41.292753 | 127.0.0.1 |     2882 |  1 | zone1 |       2881 |               1 | ACTIVE |                     0 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |         0 |   1667402019361193 |            0 |              1 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+-------------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+
1 row in set (0.001 sec)

是个1节点单zone的集群架构,其实从上面observer进程参数,就可以看到demo的系统租户的资源是1c2g的,库里的资源也验证了这点。
其实我最关心的是ob的一些特色操作是不是都在,因为自己电脑资源差,也没条件也没有需要去做性能测试,但是功能齐全对于学习ob就方便很多。
我是看到4.0发布了很多新特性,做了很多改动。但我还是忍不住先来试试产品。

obclient [oceanbase]> select * from __all_zone where name='merge_status';
Empty set (0.001 sec)

obclient [oceanbase]> select * from __all_zone;
+----------------------------+----------------------------+-------+------------------------+------------------+------------+
| gmt_create                 | gmt_modified               | zone  | name                   | value            | info       |
+----------------------------+----------------------------+-------+------------------------+------------------+------------+
| 2022-11-02 23:13:34.094383 | 2022-11-02 23:13:34.094383 |       | cluster                |                0 | obcluster  |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:42.105218 |       | config_version         | 1667402022103146 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:42.105218 |       | lease_info_version     | 1667402022105040 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 |       | privilege_version      |                0 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 |       | storage_format_version |                4 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 |       | time_zone_info_version |                0 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | idc                    |                0 |            |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | recovery_status        |                0 | NORMAL     |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | region                 |                0 | sys_region |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | status                 |                2 | ACTIVE     |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | storage_type           |                0 | LOCAL      |
| 2022-11-02 23:13:34.094528 | 2022-11-02 23:13:34.094528 | zone1 | zone_type              |                0 | ReadWrite  |
+----------------------------+----------------------------+-------+------------------------+------------------+------------+

然后我发现ob取缔了以前的合并以及查看合并状态的方式
合并的状态可以通过视图 DBA_OB_ZONE_MAJOR_COMPACTION 中的 status 列来查看。
合并状态主要有以下几种:
IDLE:表示未进行合并。
COMPACTING:表示正在进行合并。
VERIFYING:表示正在校验 Checksum 中。

obclient [oceanbase]> select * from DBA_OB_ZONE_MAJOR_COMPACTION;
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
| ZONE  | BROADCAST_SCN       | LAST_SCN            | LAST_FINISH_TIME           | START_TIME                 | STATUS |
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
| zone1 | 1667405244724311231 | 1667405244724311231 | 2022-11-03 00:07:55.169505 | 2022-11-03 00:07:25.040312 | IDLE   |
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
1 row in set (0.005 sec)

obclient [oceanbase]> ALTER SYSTEM MAJOR FREEZE TENANT =sys;
Query OK, 0 rows affected (0.014 sec)

obclient [oceanbase]> select * from DBA_OB_ZONE_MAJOR_COMPACTION;
+-------+---------------------+---------------------+----------------------------+----------------------------+------------+
| ZONE  | BROADCAST_SCN       | LAST_SCN            | LAST_FINISH_TIME           | START_TIME                 | STATUS     |
+-------+---------------------+---------------------+----------------------------+----------------------------+------------+
| zone1 | 1667405397910225962 | 1667405244724311231 | 2022-11-03 00:07:55.169505 | 2022-11-03 00:09:57.939466 | COMPACTING |
+-------+---------------------+---------------------+----------------------------+----------------------------+------------+
1 row in set (0.001 sec)
obclient [oceanbase]> select * from DBA_OB_ZONE_MAJOR_COMPACTION;
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
| ZONE  | BROADCAST_SCN       | LAST_SCN            | LAST_FINISH_TIME           | START_TIME                 | STATUS |
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
| zone1 | 1667405397910225962 | 1667405397910225962 | 2022-11-03 00:10:17.997669 | 2022-11-03 00:09:57.939466 | IDLE   |
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+
1 row in set (0.001 sec)

说实话有点不习惯,不过看到这个合并的改动,因为没办法直接查到版本号了,忍不住想测试下闪回,今天生产刚帮业务通过版本号闪回查询了一次误操作丢失的数据

果不其然,闪回的方式也改了

obclient [test]> SELECT UNIX_TIMESTAMP(NOW());
+-----------------------+
| UNIX_TIMESTAMP(NOW()) |
+-----------------------+
|            1667407833 |
+-----------------------+
1 row in set (0.000 sec)

obclient [test]> select * from ob4;
+------+
| a    |
+------+
|    7 |
+------+
1 row in set (0.001 sec)

obclient [test]>  update ob4 set a=9;
Query OK, 1 row affected (0.001 sec)
 Rows matched: 1  Changed: 1  Warnings: 0

obclient [test]> commit;
Query OK, 0 rows affected (0.001 sec)

obclient [test]> select * from ob4;
+------+
| a    |
+------+
|    9 |
+------+
1 row in set (0.000 sec)


obclient [test]> select * from test.ob4  as of snapshot '1667407833000000000';
+------+
| a    |
+------+
|    7 |
+------+
1 row in set (0.001 sec)

因为oracle模式我习惯用hint的方式去闪回查询,所以因为4.0的官网中这部分没有详细写怎么查snapshot,花费了点时间,可以看出比之前版本的方式更灵活了。
其实测试到这,我已经发现了很多与以前版本的不同,我担心盲目的操作会浪费很多时间,所以直接看官方更新的关于4.0的介绍吧,这么多优化变更点的,得大家一起玩转啊。(事后小声bb:果不其然4.0连资源定义之类的语法都优化变更了)
https://www.oceanbase.com/docs/community-observer-cn-10000000000900534
其实这次4.0版本的更新太多太多,从功能到架构,从性能到兼容性,小伙伴们可以在上面文档中看哦
感受:
我分别从两个身份说下对于4.0的感受;作为ob企业版的运维从业者,经常受长事务,大事务,悬挂事务的困扰,因为业务体量大,每次上线ob都会有清理分区操作,去别地支援处理过因为ntp时钟差异太大一个节点起不来的情况,等等很多,这一个个难题在4.0中看来都有解决,也能感受到ob这个团队对于社区以及客户的反馈做到了很好的回应,虽然还有待验证,但是我已经看到了曙光~~

那作为开源社区的划水一级运动员,最开心的莫过于,我自己电脑终于可以直接装ob了啊~随时随地都可以玩了,已买桂花同载酒,亦是少年游。
结尾:
ocenbase从听到这个数据库的名字,我就看到了星辰大海,我一直喜欢说一句话“行之所向,莫问远方”。但是从3.x-4.0这一年的时间ob团队迭代了这么版本,解决了这么多问题,让我们真的看到了远方,期待ob的生态圈子掀起燎原之势,欢迎更多的小伙伴们一起来游起来啊~

11 个赞

老铁 666666~

2 个赞

:+1: 好快

2 个赞

:hugs: :hugs: :hugs: :hugs:一起搞起来

1 个赞

哈哈有小伙伴更快

感谢支持,多提建议!

蠢蠢欲动ing

求带66666

一起学习~~

mark

1 个赞

文化人说话就是不一样 :+1:

1 个赞

作者神速!

1 个赞

向大佬学习