首页 > 其他分享 >OceanBase集群扩容

OceanBase集群扩容

时间:2023-05-09 10:25:09浏览次数:50  
标签:扩容 FULL 04 05 OceanBase 18 08 集群 2023

连接sys租户

使用root用户连接sys租户的oceanbase数据库

[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@sys -pOceanbase2881 -A

添加zone

查看zone信息,当前OceanBase集群有2个zone

mysql> select * from oceanbase.dba_ob_zones;
+-------+----------------------------+----------------------------+--------+-----+----------------+-----------+
| ZONE  | CREATE_TIME                | MODIFY_TIME                | STATUS | IDC | REGION         | TYPE      |
+-------+----------------------------+----------------------------+--------+-----+----------------+-----------+
| zone1 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE |     | default_region | ReadWrite |
| zone2 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE |     | default_region | ReadWrite |
+-------+----------------------------+----------------------------+--------+-----+----------------+-----------+

添加zone3

mysql> alter system add zone zone3;
Query OK, 0 rows affected (0.25 sec)

查看zone信息,看到新增的zone3状态为INACTIVE

mysql> select * from oceanbase.dba_ob_zones;
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+
| ZONE  | CREATE_TIME                | MODIFY_TIME                | STATUS   | IDC | REGION         | TYPE      |
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+
| zone1 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE   |     | default_region | ReadWrite |
| zone2 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE   |     | default_region | ReadWrite |
| zone3 | 2023-05-08 18:03:47.864105 | 2023-05-08 18:03:47.864105 | INACTIVE |     | default_region | ReadWrite |
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+

启动zone3

mysql> alter system start zone zone3;
Query OK, 0 rows affected (0.16 sec)

查看zone信息,看到新增的zone3状态由INACTIVE转为ACTIVE

mysql> select * from oceanbase.dba_ob_zones;
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+
| ZONE  | CREATE_TIME                | MODIFY_TIME                | STATUS   | IDC | REGION         | TYPE      |
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+
| zone1 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE   |     | default_region | ReadWrite |
| zone2 | 2023-04-24 18:33:07.113435 | 2023-04-24 18:33:07.113435 | ACTIVE   |     | default_region | ReadWrite |
| zone3 | 2023-05-08 18:03:47.864105 | 2023-05-08 18:03:47.864105 | ACTIVE   |     | default_region | ReadWrite |
+-------+----------------------------+----------------------------+----------+-----+----------------+-----------+

添加节点

查看节点信息,当前OceanBase集群共有2个节点

mysql> select * from oceanbase.dba_ob_servers;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL      | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 15:15:29.356373 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL      | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 15:15:29.300873 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

添加节点192.168.1.73(添加节点前部署observer服务)

mysql> alter system add server '192.168.1.73:2882' zone 'zone3';
Query OK, 0 rows affected (0.42 sec)

查看节点信息,当前OceanBase集群此时有3个节点

mysql> select * from oceanbase.dba_ob_servers;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL      | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 15:15:29.356373 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL      | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 15:15:29.300873 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  4 | zone3 |     2881 | NO              | ACTIVE | 2023-05-08 18:08:33.287859 | NULL      | NULL                  | 2023-05-08 18:08:26.713833 | 2023-05-08 18:08:35.230382 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

集群扩容

查看资源池信息

mysql> select * from oceanbase.DBA_OB_RESOURCE_POOLS;
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+
| RESOURCE_POOL_ID | NAME     | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST   | REPLICA_TYPE |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+
|                1 | sys_pool |         1 | 2023-04-24 18:33:06.599543 | 2023-05-08 14:33:25.095753 |          1 |              1 | zone1;zone2 | FULL         |
|             1007 | my_pool  |      1004 | 2023-04-25 15:43:45.381999 | 2023-05-08 14:33:32.524411 |          1 |           1003 | zone1;zone2 | FULL         |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+

sys、my_tenant资源池ZONE_LIST新增zone3

mysql> alter resource pool sys_pool ZONE_LIST=('zone1','zone2','zone3');
Query OK, 0 rows affected (0.83 sec)

mysql> alter resource pool my_pool ZONE_LIST=('zone1','zone2','zone3');
Query OK, 0 rows affected (8.37 sec)

查看资源池信息

mysql> select * from oceanbase.DBA_OB_RESOURCE_POOLS;
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+
| RESOURCE_POOL_ID | NAME     | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST         | REPLICA_TYPE |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+
|                1 | sys_pool |         1 | 2023-04-24 18:33:06.599543 | 2023-05-08 18:13:57.287837 |          1 |              1 | zone1;zone2;zone3 | FULL         |
|             1007 | my_pool  |      1004 | 2023-04-25 15:43:45.381999 | 2023-05-08 18:14:21.769913 |          1 |           1003 | zone1;zone2;zone3 | FULL         |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+

租户增加副本

查看租户信息

mysql> select * from oceanbase.DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY                     | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+
|         1 | sys         | SYS         | 2023-04-24 18:33:06.821930 | 2023-05-08 14:25:57.800492 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2 | NULL              | MYSQL              | NORMAL | NO            | NO     |
|      1003 | META$1004   | META        | 2023-04-25 16:54:07.990306 | 2023-05-08 14:26:30.706161 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2 | NULL              | MYSQL              | NORMAL | NO            | NO     |
|      1004 | my_tenant   | USER        | 2023-04-25 16:54:07.991849 | 2023-05-08 14:26:30.706161 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2 | NULL              | MYSQL              | NORMAL | NO            | NO     |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+

sys、my_tenant租户LOCALITY新增zone3

mysql> alter tenant sys LOCALITY='FULL{1}@zone1,FULL{1}@zone2,FULL{1}@zone3';
Query OK, 0 rows affected (2.31 sec)

mysql> alter tenant my_tenant LOCALITY='FULL{1}@zone1,FULL{1}@zone2,FULL{1}@zone3';
Query OK, 0 rows affected (1.52 sec)

查看租户信息

mysql> select * from oceanbase.DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------------------------------------+------------------------------+--------------------+--------+---------------+--------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY                                    | PREVIOUS_LOCALITY            | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------------------------------------+------------------------------+--------------------+--------+---------------+--------+
|         1 | sys         | SYS         | 2023-04-24 18:33:06.821930 | 2023-05-08 18:17:13.418669 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | FULL{1}@zone1, FULL{1}@zone2 | MYSQL              | NORMAL | NO            | NO     |
|      1003 | META$1004   | META        | 2023-04-25 16:54:07.990306 | 2023-05-08 18:17:22.787336 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | FULL{1}@zone1, FULL{1}@zone2 | MYSQL              | NORMAL | NO            | NO     |
|      1004 | my_tenant   | USER        | 2023-04-25 16:54:07.991849 | 2023-05-08 18:17:22.787336 | RANDOM       | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | FULL{1}@zone1, FULL{1}@zone2 | MYSQL              | NORMAL | NO            | NO     |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------------------------------------+------------------------------+--------------------+--------+---------------+--------+

 

添加zone参考:https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001687938
添加节点参考:https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001697238

标签:扩容,FULL,04,05,OceanBase,18,08,集群,2023
From: https://www.cnblogs.com/haha029/p/17384082.html

相关文章

  • Nacos 使用 CentOS7 进行集群部署
    有了上篇博客的Nacos单机部署经验,对于集群搭建就容易多了。要想搭建Nacos集群,至少需要3个节点。为了统一访问地址,因此需要使用nginx进行转发。本篇博客仍然采用Nacos当前最新的版本2.2.2进行集群搭建。Nacos官网上也有集群搭建的说明,不过有点简略。Nacos的集群搭......
  • skywalking 集群部署
    1、安装包:apache-skywalking-apm-es7-8.7.0.tar.gz下载地址:https://archive.apache.org/dist/skywalking/8.7.0/apache-skywalking-apm-es7-8.7.0.tar.gz2、安装包解压tar -xf  apache-skywalking-apm-es7-8.7.0.tar.gzyuminstalljava-1.8.0-openjdk-devel-y  ......
  • 搭建 Kubernetes 集群
    简介Kubernetes是一个开源系统,用于容器化应用的自动部署、扩缩和管理。它将构成应用的容器按逻辑单位进行分组以便于管理和发现。搭建环境:CentOSv7.6.1810docker-ce-versionv23.0.5kubernetes-versionv1.23.6本次使用2台服务器进行搭建,运行下面命令写入/etc/hosts文件(......
  • Hbase跨集群迁移以及常用命令
    场景:由于Hbase版本升级以及集群切换,现需要将Hbase从A集群(源)迁移至B集群(目的)迁移过程:将源A集群的Hbase需要迁移的表(注意namespace)通过snapshot方式打成快照,然后再通过ExportSnapshot方式迁移至目的B集群,此时目的集群的HDFS目录下的hbase目录会生成.hbase_snapshot和archive目录......
  • 群晖服务器216j增加硬盘,如何添加硬盘扩容你的群晖 NAS?
     大家买NAS的同时会不会把硬盘数量和容量都配足呢?”对于数据的存储容量总是计划赶不上变化;而对存储设备的精挑细选也总是千算万算算不准大促降价;就算十拿九稳觉得硬盘容量肯定够用个十来年,可是手机拍照越来越清晰;视频文件越来越大;加上自己喜欢的爱豆出产量也越来越高,眼瞅......
  • 群晖NAS容量告急,如何更换更大的硬盘,扩容硬盘空间( SHR 阵列)
    NAS用得久了,难免会遇上硬盘空间不足,或是硬盘故障的情况,这时候就需要更换硬盘了。本期的视频教程就来讲讲,在SHR 阵列下,如何为NAS更换同等或更大容量硬盘?具体可以分为三种情况,你们可以根据自己的需求跟着步骤走。下面依旧是省流的文字版,大家可以了解个大概,具体内容还是更推荐看......
  • k8s集群组件
    k8s集群有以下组件:Master:Kubernetes集群的控制中心,包括:APIServer:在Kubernetes集群中,APIserver扮演一个接口,使用户和管理员可以通过kubectl或其他工具与集群进行交互,而不必直接与底层组件打交道。同时,所有其他Kubernetes组件,包括kubelet、kube-proxy、controllerman......
  • 有关本地集群的linux操作tips
    免密登录认证-1.使用rsa加密技术,生成公钥和私钥。一路回车即可[root@username01~]#cd~[root@username01~]#ssh-keygen-trsa -2.进入~/.ssh目录下,使用ssh-copy-id命令[root@username01~]#cd~/.ssh [[email protected]]#ssh-copy-idroot@username01-3.......
  • openGauss 5.0 主从集群 日常运维
    在之前的博客我们看了openGauss主从集群的搭建,如下:openGauss5.0一主两从复制环境搭建手册https://www.cndba.cn/dave/article/116528本篇我们看下主从集群的维护。 1查看集群状态查看集群所有节点:[[email protected]~]$gs_om-tstatus--detail[CMServerSta......
  • 部署repmgr PG14集群<无autofailover>
    系统环境OS:CentOS7192.168.56.11node1192.168.56.12node2部署操作流程1.系统环境初始化echoredhat|passwdroot--stdinecho-e"192.168.56.11node1">>/etc/hostsecho-e"192.168.56.12node2">>/etc/hostsse......