others linux服务器运维 django3 监控 k8s golang 数据库 大数据 前端 devops 理论基础 java oracle 运维日志

oceanbase 社区版 demo安装

访问量:157 创建时间:2025-11-13

关闭透明大页

[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled 
[always] madvise never
[root@localhost ~]# echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled 
always madvise [never]

#####在这行中加入 transparent_hugepage=never
[root@localhost ~]# vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@localhost ~]# reboot 

配置ntp

[root@localhost ~]#  vim /etc/ntp.conf
###添加下面这一行,根据你的服务器添加
server  ntp5.aliyun.com
[root@localhost ~]# systemctl restart ntpd
##查看时间同步状态
[root@localhost ~]# ntpstat
unsynchronised
   polling server every 64 s

配置ulimit

[root@localhost ~]# vim /etc/security/limits.conf 
#在文件结尾添加以下内容
* soft nofile 655350
* hard nofile 655350
* soft stack unlimited
* hard stack unlimited
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited

配置ulimit后需要关闭ssh连接,重新登录服务器然后通过ulimit -a 查看配置是否生效

[root@localhost ~]# ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31116
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 655350
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 655360
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

关闭防火墙,和selinux。 操作过程省略

下载oceanbase

下载地址 https://www.oceanbase.com/softwarecenter

解压

[root@oceanbase1 data]# tar xf oceanbase-all-in-one-4.3.5_bp4_20250910.el7.x86_64.tar.gz 
[root@oceanbase1 data]# ll
total 1716272
drwxr-xr-x 6 root root         88 Sep 10 17:43 oceanbase-all-in-one
-rw-r--r-- 1 root root 1757462247 Nov 12 14:00 oceanbase-all-in-one-4.3.5_bp4_20250910.el7.x86_64.tar.gz

安装

[root@oceanbase1 data]# cd oceanbase-all-in-one/
[root@oceanbase1 oceanbase-all-in-one]# ./bin/install.sh 
install obd as root
No previous obd installed, try install..., wait a moment
...省略部分输出...
add auto set env logic to profile: /root/.bash_profile

#########################################################################################
 Install Finished 

=========================================================================================
Setup Environment:              source ~/.oceanbase-all-in-one/bin/env.sh 
Quick Start:                    obd demo 
Use Web Service to install:     obd web 
Use Web Service to upgrade:     obd web upgrade 
More Details:                   obd -h 
=========================================================================================

demo模式安装

demo是最小规格。 odb pref 是最大规格部署

[root@oceanbase1 oceanbase-all-in-one]# obd demo
Package oceanbase-ce-4.3.5.4-104000042025090916.el7 is available.
Package obproxy-ce-4.3.5.0-3.el7 is available.
Package grafana-7.5.17-1 is available.
Package obagent-4.2.2-100000042024011120.el7 is available.
Package prometheus-2.37.1-10000102022110211.el7 is available.
install oceanbase-ce-4.3.5.4 for local ok
install obproxy-ce-4.3.5.0 for local ok
install grafana-7.5.17 for local ok
install obagent-4.2.2 for local ok
install prometheus-2.37.1 for local ok
Cluster param config check ok
Open ssh connection ok
Generate obproxy configuration ok
Generate grafana configuration ok
Generate obagent configuration ok
Generate prometheus configuration ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.3.5.4 | 104000042025090916.el7 | a30a15dd7a80f6acd0f113993bb70b2e56d40f80 |
| obproxy-ce   | 4.3.5.0 | 3.el7                  | f17b277b681adb1c86bfc3cfda369ad88896da9d |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obagent      | 4.2.2   | 100000042024011120.el7 | 19739a07a12eab736aff86ecf357b1ae660b554e |
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Load param plugin ok
Open ssh connection ok
Initializes obagent work home ok
Initializes observer work home ok
Initializes obproxy work home ok
Initializes prometheus work home ok
Initializes grafana work home ok
Parameter check ok
Remote oceanbase-ce-4.3.5.4-104000042025090916.el7-a30a15dd7a80f6acd0f113993bb70b2e56d40f80 repository install ok
Remote oceanbase-ce-4.3.5.4-104000042025090916.el7-a30a15dd7a80f6acd0f113993bb70b2e56d40f80 repository lib check ok
Remote obproxy-ce-4.3.5.0-3.el7-f17b277b681adb1c86bfc3cfda369ad88896da9d repository install ok
Remote obproxy-ce-4.3.5.0-3.el7-f17b277b681adb1c86bfc3cfda369ad88896da9d repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository install ok
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
demo deployed
Get local repositories ok
Load cluster param plugin ok
Open ssh connection ok
[WARN] OBD-1011: (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 core file size is unlimited (Current value: 0)
[WARN] OBD-1017: (127.0.0.1) The value of the "vm.max_map_count" must be within [327600, 1310720] (Current value: 65530, Recommended value: 655360)
[WARN] OBD-1017: (127.0.0.1) The value of the "fs.file-max" must be greater than 6573688 (Current value: 1597403, Recommended value: 6573688)
[WARN] OBD-1012: (127.0.0.1) clog and data use the same disk (/)
Check before start obagent ok
Check before start prometheus ok
Check before start grafana ok
cluster scenario: express_oltp
Start observer ok
observer program health check ok
Connect to observer 127.0.0.1:2881 ok
oceanbase bootstrap ok
obshell start ok
obshell program health check ok
obshell bootstrap ok
start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Start obagent ok
obagent program health check ok
Start promethues ok
prometheus program health check ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Grafana modify password ok
Connect to observer 127.0.0.1:2881 ok
Wait for observer init ok
+---------------------------------------------+
|                 oceanbase-ce                |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.3.5.4 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot@sys -p'ja8Zmm7huzCXpYxMpVTo' -Doceanbase -A

cluster unique id: 0c56d0ce-20cc-5e73-b173-a95c64396a71-19a7afc691c-04050304

Connect to obproxy ok
+---------------------------------------------------------------+
|                           obproxy-ce                          |
+-----------+------+-----------------+-----------------+--------+
| ip        | port | prometheus_port | rpc_listen_port | status |
+-----------+------+-----------------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | 2885            | active |
+-----------+------+-----------------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -p'ja8Zmm7huzCXpYxMpVTo' -Doceanbase -A 

Connect to Obagent ok
+-------------------------------------------------------------------+
|                              obagent                              |
+----------------+--------------------+--------------------+--------+
| ip             | mgragent_http_port | monagent_http_port | status |
+----------------+--------------------+--------------------+--------+
| 192.168.72.107 | 8089               | 8088               | active |
+----------------+--------------------+--------------------+--------+
Connect to Prometheus ok
+-------------------------------------------------------+
|                       prometheus                      |
+----------------------------+------+----------+--------+
| url                        | user | password | status |
+----------------------------+------+----------+--------+
| http://192.168.72.107:9090 |      |          | active |
+----------------------------+------+----------+--------+
Connect to grafana ok
+------------------------------------------------------------------------+
|                                grafana                                 |
+----------------------------------------+-------+--------------+--------+
| url                                    | user  | password     | status |
+----------------------------------------+-------+--------------+--------+
| http://192.168.72.107:3000/d/oceanbase | admin | '8vJdI6eFJZ' | active |
+----------------------------------------+-------+--------------+--------+
obshell program health check ok
display ob-dashboard ok
+---------------------------------------------------------------------+
|                             ob-dashboard                            |
+----------------------------+------+------------------------+--------+
| url                        | user | password               | status |
+----------------------------+------+------------------------+--------+
| http://192.168.72.107:2886 | root | 'ja8Zmm7huzCXpYxMpVTo' | active |
+----------------------------+------+------------------------+--------+

demo running
This is a basic setup with minimal resources, good for testing and learning. For full OceanBase performance, please destroy this cluster and redeploy by using `obd pref` command.
Trace ID: f5245256-c035-11f0-bc8b-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace f5245256-c035-11f0-bc8b-000c29eac1e9

obd命令

命令帮助

obd -h

查看集群

[root@oceanbase1 ~]# obd cluster list
+--------------------------------------------------+
|                   Cluster List                   |
+------+-------------------------+-----------------+
| Name | Configuration Path      | Status (Cached) |
+------+-------------------------+-----------------+
| demo | /root/.obd/cluster/demo | running         |
+------+-------------------------+-----------------+
Trace ID: 070338a2-c03b-11f0-be38-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace 070338a2-c03b-11f0-be38-000c29eac1e9

配置文件存放在

/root/.obd/cluster/demo

简单登陆测试

[root@oceanbase1 ~]# obclient -h127.0.0.1 -P2881 -uroot -p'ja8Zmm7huzCXpYxMpVTo' -Doceanbase -A 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221531170
Server version: OceanBase_CE 4.3.5.4 (r104000042025090916-5cf5b925a25bf888aebaa288e251b85b1924e98a) (Built Sep  9 2025 17:07:42)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

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

obclient(root@(none))[oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ocs                |
| ORAAUDITOR         |
| SYS                |
| sys_external_tbs   |
| test               |
+--------------------+
9 rows in set (0.003 sec)

obclient(root@(none))[oceanbase]> create database  test11;

obclient(root@(none))[oceanbase]> use test11;
Database changed
obclient(root@(none))[test11]> drop table if exists stu;
create table stu(
Query OK, 0 rows affected, 1 warning (0.029 sec)

obclient(root@(none))[test11]> create table stu(
    ->      id bigint,
    ->      name varchar(50),
    ->      age bigint
    -> );
Query OK, 0 rows affected (0.136 sec)

查看集群安装信息

[root@oceanbase1 ~]# obd cluster display demo
Get local repositories and plugins ok
Open ssh connection ok
Connect to observer 127.0.0.1:2881 ok
Wait for observer init ok
+---------------------------------------------+
|                 oceanbase-ce                |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.3.5.4 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot@sys -p'ja8Zmm7huzCXpYxMpVTo' -Doceanbase -A

cluster unique id: 0c56d0ce-20cc-5e73-b173-a95c64396a71-19a7afc691c-04050304

Connect to obproxy ok
+---------------------------------------------------------------+
|                           obproxy-ce                          |
+-----------+------+-----------------+-----------------+--------+
| ip        | port | prometheus_port | rpc_listen_port | status |
+-----------+------+-----------------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | 2885            | active |
+-----------+------+-----------------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -p'ja8Zmm7huzCXpYxMpVTo' -Doceanbase -A 

Connect to Obagent ok
+-------------------------------------------------------------------+
|                              obagent                              |
+----------------+--------------------+--------------------+--------+
| ip             | mgragent_http_port | monagent_http_port | status |
+----------------+--------------------+--------------------+--------+
| 192.168.72.107 | 8089               | 8088               | active |
+----------------+--------------------+--------------------+--------+
Connect to Prometheus ok
+-------------------------------------------------------+
|                       prometheus                      |
+----------------------------+------+----------+--------+
| url                        | user | password | status |
+----------------------------+------+----------+--------+
| http://192.168.72.107:9090 |      |          | active |
+----------------------------+------+----------+--------+
Connect to grafana ok
+------------------------------------------------------------------------+
|                                grafana                                 |
+----------------------------------------+-------+--------------+--------+
| url                                    | user  | password     | status |
+----------------------------------------+-------+--------------+--------+
| http://192.168.72.107:3000/d/oceanbase | admin | '8vJdI6eFJZ' | active |
+----------------------------------------+-------+--------------+--------+
obshell program health check ok
display ob-dashboard ok
+---------------------------------------------------------------------+
|                             ob-dashboard                            |
+----------------------------+------+------------------------+--------+
| url                        | user | password               | status |
+----------------------------+------+------------------------+--------+
| http://192.168.72.107:2886 | root | 'ja8Zmm7huzCXpYxMpVTo' | active |
+----------------------------+------+------------------------+--------+

Trace ID: ab8dfa36-c03d-11f0-b66d-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace ab8dfa36-c03d-11f0-b66d-000c29eac1e9

关停服务

[root@oceanbase1 ~]# obd cluster stop demo
Get local repositories ok
Get local repositories and plugins ok
Open ssh connection ok
Stop observer ok
Stop obshell ok
Stop obproxy-ce ok
Stop obagent ok
Stop prometheus ok
Stop grafana ok
demo stopped
Trace ID: 0def9012-c03f-11f0-b0f2-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace 0def9012-c03f-11f0-b0f2-000c29eac1e9

查看集群状态

[root@oceanbase1 ~]# obd cluster list
+--------------------------------------------------+
|                   Cluster List                   |
+------+-------------------------+-----------------+
| Name | Configuration Path      | Status (Cached) |
+------+-------------------------+-----------------+
| demo | /root/.obd/cluster/demo | stopped         |
+------+-------------------------+-----------------+
Trace ID: 2ed39882-c03f-11f0-99f1-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace 2ed39882-c03f-11f0-99f1-000c29eac1e9
##########

[root@oceanbase1 ~]# vim  /root/.obd/cluster/demo/config.yaml 
oceanbase-ce:
  servers:
  - 127.0.0.1
  global:
    home_path: /root/oceanbase-ce
    data_dir: /obdata/store

[root@oceanbase1 ~]# mv /root/oceanbase-ce/store /obdata/
###启动数据库组件
[root@oceanbase1 ~]# obd cluster start demo
#####删除配置重新部署
[root@oceanbase1 ~]# obd cluster destroy demo
Are you sure to destroy the "demo" cluster ? [y/n]: y
Get local repositories ok
Open ssh connection ok
Get deployment connections ok
Get standbys info ok
Get local repositories and plugins ok
Stop observer ok
Stop obshell ok
Stop obproxy-ce ok
Stop obagent ok
Stop prometheus ok
Stop grafana ok
demo stopped
Cluster status check ok
oceanbase-ce work dir cleaning ok
obproxy-ce work dir cleaning ok
obagent work dir cleaning ok
prometheus work dir cleaning ok
grafana work dir cleaning ok
demo destroyed
Trace ID: 63828486-c048-11f0-9fb4-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace 63828486-c048-11f0-9fb4-000c29eac1e9

重新部署##########obd cluster deploy obtest -c mini-single-example.yaml
[root@oceanbase1 ~]# obd cluster deploy  demo
Are you sure you want to deploy the database as the root user? [y/n] [Default: n]: y
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.3.5.4 | 104000042025090916.el7 | a30a15dd7a80f6acd0f113993bb70b2e56d40f80 |
| obproxy-ce   | 4.3.5.0 | 3.el7                  | f17b277b681adb1c86bfc3cfda369ad88896da9d |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obagent      | 4.2.2   | 100000042024011120.el7 | 19739a07a12eab736aff86ecf357b1ae660b554e |
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Load param plugin ok
Open ssh connection ok
Initializes obagent work home ok
Initializes observer work home ok
Initializes obproxy work home ok
Initializes prometheus work home ok
Initializes grafana work home ok
Parameter check ok
Remote oceanbase-ce-4.3.5.4-104000042025090916.el7-a30a15dd7a80f6acd0f113993bb70b2e56d40f80 repository install ok
Remote oceanbase-ce-4.3.5.4-104000042025090916.el7-a30a15dd7a80f6acd0f113993bb70b2e56d40f80 repository lib check ok
Remote obproxy-ce-4.3.5.0-3.el7-f17b277b681adb1c86bfc3cfda369ad88896da9d repository install ok
Remote obproxy-ce-4.3.5.0-3.el7-f17b277b681adb1c86bfc3cfda369ad88896da9d repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository install ok
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
demo deployed
Please execute ` obd cluster start demo ` to start
Trace ID: a61b0e4e-c048-11f0-b448-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace a61b0e4e-c048-11f0-b448-000c29eac1e9
######################查看集群状态
[root@oceanbase1 ~]# obd cluster list
+--------------------------------------------------+
|                   Cluster List                   |
+------+-------------------------+-----------------+
| Name | Configuration Path      | Status (Cached) |
+------+-------------------------+-----------------+
| demo | /root/.obd/cluster/demo | deployed        |
+------+-------------------------+-----------------+
Trace ID: da3ff75c-c048-11f0-98d8-000c29eac1e9
If you want to view detailed obd logs, please run: obd display-trace da3ff75c-c048-11f0-98d8-000c29eac1e9

查看部署故障信息

obd display-trace <trace_id>

oceanbase 磁盘io高导致机器卡掉

导致 observer 所在节点 IO 压力过大的原因有很多,除了流量上涨外,通常是迁移复制、合并等因素叠加的结果。处理的思路通常是将一些高 IO 的负载任务降级,本文针对各种情况进行详细分析。

应急处理流程 针对节点磁盘 IO 过高的情况,处理的思路通常是将一些高 IO 的负载任务降级,具体分如下几种情况。

暂停进行中的合并。

磁盘 IO 过高的节点若是正在进行合并,可以将其暂停,以缓解 IO 压力。暂停合并,命令如下所示:

ALTER SYSTEM SUSPEND MERGE [ZONE [=] 'zone'];
ALTER SYSTEM SUSPEND MERGE;
ALTER SYSTEM SUSPEND MERGE;
ALTER SYSTEM SUSPEND MERGE TENANT = ALL;
ALTER SYSTEM SUSPEND MERGE TENANT  ALL;
#等 IO 压力缓解后,您可以根据需要恢复合并,语法如下所示:

ALTER SYSTEM RESUME MERGE [ZONE [=] 'zone'];
ALTER SYSTEM RESUME MERGE;
暂停执行中的备份任务。

您可以通过 OCP 查看当前节点是否正在进行备份,如果是,可以暂停备份,以缓解 IO 压力。

暂停执行中的数据传输或导入/导出任务。

您可以直接通过在 OCP 中的 TOPSQL、会话管理功能排查正在批量写入的 SQL,如果不能快速判断跑批任务来自哪个系统,也可以直接通过 OMS 查看当前节点是否正在进行数据传输任务,如果是的话,可以根据需要将其暂停,缓解 IO 压力后再继续执行。

更多信息可以阅览 管理迁移任务。

您还可以通过 ODC 查看当前节点是否正在进行导数,在 任务中心 面板的 导入 页签查看任务列表。进入目标数据库连接后,单击上方导航栏中的 任务 标签弹出任务中心面板,在面板中单击 导入 页签展示任务列表,进入导入任务页签后,可以根据需要进行 终止 和 重试 操作。更多信息可以阅览 导入任务。此外,其他第三方的大数据平台、DataX 组件也可能存在定时执行的任务,可以按需手动停掉。

调低转储线程数

转储时并行度过高会导致磁盘的 IO 随之增高,minor_merge_concurrency 是控制并行转储线程数,您可以通过调低该参数值来降低磁盘的 IO 使用率。该参数默认值为 0 ,表示自适应,64C一般为10,可以根据情况调小。修改该参数无需重启直接生效。语法如下所示:

ALTER SYSTEM SET minor_merge_concurrency= 5;
修改成功后,可以通过 SHOW PARAMETERS 语句查看是否修改成功。

SHOW PARAMETERS LIKE 'minor_merge_concurrency';
您还可以在 OCP 界面通过修改转储策略调低转储线程数,具体参见 修改转储配置。

调低迁移复制的并发数。

当问题发生期间 OB 集群中如果恰好有 unit 迁移,或者副本均衡类的任务。此时可以通过限制迁移的并发数来达到 IO 限流的目的。

ALTER SYSTEM SET migrate_concurrency=5;  --默认值为 10
ALTER SYSTEM SET server_data_copy_in_concurrency=2; --默认值为 2,如果高于该值,可以调回 2
ALTER SYSTEM SET server_data_copy_out_concurrency=2; --默认值为 2,如果高于该值,可以调回 2
调低后台任务的网络带宽。

您可以使用如下命令来调低后台任务的网络带宽:

ALTER SYSTEM SET sys_bkgd_net_percentage=30;  --默认值 60

对高负载的 SQL 执行限流、添加索引。

当磁盘 IO 过高,定位到某条 SQL 时,可以通过绑定 SQL 的执行计划加入 hint max_concurrent 来限制 SQL 并发,实现对 SQL 的限流。更多信息请参见 《SQL 参考(MySQL 模式)》 中的 SQL语句 和 《 SQL 参考(Oracle 模式)》 中的 SQL语句 。

因为索引缺失导致的全表扫描,造成 IO升高,可以根据具体需要对相关表加索引。

取消进行中的索引创建。

如果当前集群中正在执行大表的索引创建,可以酌情取消,待集群恢复后再进行创建。

dome单机扩容节点

要加进来的机器是192.168.72.116

[root@localhost oceanbase-all-in-one]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ij1kzSXlUhIlTbUWhI9Jh3FNkXMQjrUqnC1TUrSE7ro root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|        +=*OOo*= |
|         **+.B+..|
|        oo+=* oo |
|       o =+*..   |
|      o S.* o    |
|     = .  .+     |
|    . +  .       |
|       ..        |
|        E.       |
+----[SHA256]-----+
[root@localhost oceanbase-all-in-one]# ssh-copy-id 192.168.72.116
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.72.116 (192.168.72.116)' can't be established.
ECDSA key fingerprint is SHA256:I3QFrL+ou1zH5OISbl7yVRWN0aM8VYKUcaLEw8LhWks.
ECDSA key fingerprint is MD5:71:85:e3:f2:a8:5e:75:d2:f9:a5:e3:17:b9:5e:77:88.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.72.116's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '192.168.72.116'"
and check to make sure that only the key(s) you wanted were added.

查看集群原配置

[root@localhost ~]# vim ~/.obd/cluster/demo/config.yaml 
[root@localhost ~]# obd cluster edit-config demo
Search param plugin and load ok
Search param plugin and load ok
Parameter check ok
Deploy "demo" config unchange
Trace ID: e62218fe-d5a4-11f0-9e0e-000c29b12149
If you want to view detailed obd logs, please run: obd display-trace e62218fe-d5a4-11f0-9e0e-000c29b12149
[root@localhost ~]# 
[root@localhost ~]# vim scale_out.yaml
oceanbase-ce:
  servers:
    - name: server2
      ip: 192.168.72.116
  server2:
    mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
    rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
    home_path: /root/observer
    zone: zone2
~                    

扩容

obd cluster scale_out demo  -c scale_out.yaml
登陆评论: 使用GITHUB登陆