PullRequest: 1020 V4.0.0 fix issues

This commit is contained in:
obdev 2024-01-30 10:19:38 +00:00 committed by ob-robot
parent d1701c71f0
commit ab59dd390c
7 changed files with 222 additions and 261 deletions

View File

@ -18,7 +18,7 @@ You can deploy ob-operator by running the following commands:
```shell
helm repo add ob-operator https://oceanbase.github.io/ob-operator/
helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --create-namespace --version=1.1.0
helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --create-namespace --version=1.2.0
```
### Deploy ob-operator with configuration files
@ -27,10 +27,10 @@ You can deploy ob-operator with configuration files by running the following com
```shell
# deploy CRD
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/crd.yaml
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/crd.yaml
# deploy ob-operator
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/operator.yaml
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/operator.yaml
```
#### Customize ob-operator
@ -39,8 +39,8 @@ If you need to customize ob-operator, download the configuration file by running
```shell
# download the config file
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/crd.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/operator.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/crd.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/operator.yaml
```
After you modify the configuration file, deploy ob-operator by running the following commands:
@ -85,7 +85,7 @@ For more information, see [local-path-provisioner](https://github.com/rancher/lo
The OceanBase cluster is defined in a YAML configuration file. You can customize the configuration file provided by ob-operator to suit your needs. Use the following command to download the `obcluster.yaml` configuration file for OceanBase Database:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obcluster.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obcluster.yaml
```
The sample content of the configuration file is shown below.
@ -183,8 +183,8 @@ kubectl apply -f obcluster.yaml
ODP is defined by using yaml configuration files. You can customize these files by referring to the configuration files of ob-operator. To download the ODP configuration files, run the following command:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obproxy/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obproxy/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obproxy/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obproxy/service.yaml
```
The sample content of the `deployment.yaml` file is shown below.
@ -308,11 +308,11 @@ obclient -h<node_ip> -P30083 -uroot@sys -p oceanbase -A -c
Download the Prometheus configuration files by running the following command and customize them by referring to the Prometheus configuration files provided by ob-operator:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/cluster-role.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/cluster-role-binding.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/cluster-role.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/cluster-role-binding.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/service.yaml
```
Prometheus selects the address for collecting data based on the name and port of the service in Kubernetes. You can configure filtering for data collection using regular expressions, as shown in the configuration in the `configmap.yaml` file:
@ -389,10 +389,10 @@ Click on **Graph** to enter PromQL expressions and perform queries.
Download the Grafana configuration files by running the following command and customize them by referring to the Prometheus configuration files provided by ob-operator:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/pvc.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/pvc.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/service.yaml
```
The `configmap.yaml` file contains key configuration information about Grafana, including the address of the Prometheus data source. If Prometheus was customized during deployment, you need to configure the actual service address.

View File

@ -11,11 +11,11 @@
* OBD
OceanBase DeployerOceanBase 集群安装部署工具,简称为 OBD。详细信息请参考 [OBD 文档](https://www.oceanbase.com/docs/obd-cn)。
OceanBase DeployerOceanBase 安装部署工具,简称为 OBD。详细信息请参考 [OBD 文档](https://www.oceanbase.com/docs/obd-cn)。
* ODP
OceanBase Database ProxyOceanBase 高性能反向代理服务器,简称为 ODP又称为 OBProxy。详细信息请参考 [ODP 文档](https://www.oceanbase.com/docs/odp-cn)。
OceanBase Database ProxyOceanBase 数据库代理,是 OceanBase 数据库专用的代理服务器,简称为 ODP又称为 OBProxy。详细信息请参考 [ODP 文档](https://www.oceanbase.com/docs/odp-cn)。
* OBAgent
@ -37,7 +37,7 @@
| --- | --- |
|系统|<ul><li>Alibaba Cloud Linux 2/3 版本(内核 Linux 3.10.0 版本及以上)</li><li>Anolis OS 8.X 版本(内核 Linux 3.10.0 版本及以上)</li><li>Red Hat Enterprise Linux Server 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上)</li><li>CentOS Linux 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上)</li><li>Debian 9.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)</li><li>Ubuntu 20.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)</li><li>SUSE / OpenSUSE 15.X 版本及以上版本(内核 Linux 3.10.0 版本及以上) </li><li>KylinOS V10 版本</li><li>统信 UOS 1020a/1021a/1021e/1001c 版本</li><li>中科方德 NFSChina 4.0 版本及以上</li><li>浪潮 Inspur kos 5.8 版本</li></ul>|
|CPU|测试环境最低要求 2 核,推荐 4 核及以上。|
|内存|测试环境最低要求 8 G推荐 16G 及以上。|
|内存|最低要求 8 GB推荐设置在 16 GB 至 1024 GB 范围内。|
|磁盘类型| 使用 SSD 存储。|
|磁盘存储空间| 最低要求 54 GB。|
|文件系统|EXT4 戓 XFS当数据超过 16T 时,使用 XFS。|
@ -88,7 +88,7 @@ bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/downl
[admin@test001 ~]$ obd demo
```
`obd demo` 命令默认在当前家目录下以最小规格部署并启动 OceanBase 数据库及相关组件(包括 ODP、OBAgent、Grafana 和 Prometheus固定部署名为 `demo`。如需更多定制化的部署形式,参见 [快速部署命令](https://www.oceanbase.com/docs/community-obd-cn-10000000001690698)。
`obd demo` 命令默认在当前用户家目录下以最小规格部署并启动 OceanBase 数据库及相关组件(包括 ODP、OBAgent、Grafana 和 Prometheus固定部署名为 `demo`。如需更多定制化的部署形式,参见 [快速部署命令](https://www.oceanbase.com/docs/community-obd-cn-10000000001690698)。
您也可以使用 OBD 命令管理该 OceanBase 数据库,详细命令介绍请参考 [集群命令组](https://www.oceanbase.com/docs/community-obd-cn-10000000001690699)。

View File

@ -23,7 +23,7 @@ OceanBase 数据库在以下配置进行了系统性测试验证,推荐您使
|----------|-----------------------------------------------------------------------------------------------------------------------|
| 系统 |<ul> <li> Alibaba Cloud Linux 2/3 版本(内核 Linux 3.10.0 版本及以上)</li><li>Anolis OS 8.X 版本(内核 Linux 3.10.0 版本及以上)</li><li>SUSE / OpenSUSE 15.X 版本及以上版本(内核 Linux 3.10.0 版本及以上) </li><li>Red Hat Enterprise Linux Server 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上) </li><li>CentOS Linux 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上) </li><li>Debian 9.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)</li><li>Ubuntu 20.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)</li><li>KylinOS V10 版本</li><li>统信 UOS 1020a/1021a/1021e/1001c 版本</li><li>中科方德 NFSChina 4.0 版本及以上</li><li>浪潮 Inspur kos 5.8 版本</li></ul> |
| 物理 CPU |<ul><li> 测试环境最低要求 2 核。 </li> <li>生产环境最低要求 4 核,推荐 32 核及以上。</li><li>性能测试场景推荐 24 核及以上。</li> </ul> |
| 内存 | <ul><li> 测试环境最低要求 8 G。 </li><li> 生产环境最低要求 16 G,长期使用要求不低于 32 G推荐 256 G 及以上。 </li><li>性能测试场景推荐 128 G 及以上</li></ul><blockquote>**注意**</br>当部署多个集群时, 推荐使用 OCP 进行统一运维管理,当部署集群比较少时,建议使用 OBD 进行安装部署。</blockquote> |
| 内存 | <ul><li> 测试环境最低要求 8 GB</li><li> 生产环境最低要求 16 GB长期使用要求不低于 32 GB推荐设置在 256 GB 至 1024 GB 范围内。 </li><li>性能测试场景推荐设置在 128 GB 至 1024 GB 范围内</li></ul><main id="notice" type='notice'><h4>注意</h4><p>当部署多个集群时,推荐使用 OCP 进行统一运维管理,当部署集群比较少时,建议使用 OBD 进行安装部署。</p></main> |
| 磁盘类型 | 使用 SSD 存储 |
| 磁盘存储空间 | 最低要求 54 GB |
| 文件系统 | EXT4 戓 XFS当数据超过 16T 时,使用 XFS |

View File

@ -267,7 +267,14 @@ OceanBase 集群中的服务器时间必须保持一致,否则会导致 OceanB
<main id="notice" type='explain'>
<h4>说明</h4>
<ul>
<li>
<p>本文基于 x86 架构的 CentOS Linux 7.9 镜像环境提供操作指导,其余环境可能略有不同,请以实际环境为准。</p>
</li>
<li>
<p>若部署 OCP 的节点和 OceanBase 集群不在一个节点时,也需为 OCP 的节点与 OceanBase 集群节点做时钟源同步,防止使用过程中因时钟偏差引发 OCP 操作异常。</p>
</li>
</ul>
</main>
### 前提条件
@ -588,6 +595,8 @@ net.ipv4.tcp_slow_start_after_idle=0
vm.swappiness = 0
vm.min_free_kbytes = 2097152
fs.file-max = 6573688
# 修改进程可以拥有的虚拟内存区域数量
vm.max_map_count = 655360
@ -610,6 +619,22 @@ kernel.core_pattern = /data/core-%e-%p-%t
sysctl -p
```
### ARM 环境部署建议
* bios/uefi 及内核启动参数开启 NUMA 支持。
* 关闭 NUMA Balancing避免平衡过程中性能发生抖动命令如下。
```shell
sysctl kernel.numa_balancing=0
```
* 禁用内存回收和重新分配功能,命令如下。
```shell
sysctl vm.zone_reclaim_mode=0
```
## 关闭防火墙和 SELinux
如果您是个人用户,您可以跳过此步骤。如果您是企业用户,建议您关闭防火墙和 SELinux。
@ -654,21 +679,6 @@ setenforce 0
sestatus
```
### ARM 环境部署建议
* bios 及内核参数开启 numa 支持
* 执行以下命令关闭 numa balancing避免 balance 过程中性能可能发生抖动
```bash
sysctl kernel.numa_balancing=0
```
* 执行以下命令将 zone_reclaim_mode 设置为0
```bash
sysctl vm.zone_reclaim_mode=0
```
## 创建用户
如果您是个人用户,您可以直接使用 root 账号并跳过此步骤。如果您是企业用户,建议您在机器上创建普通用户,以确保安全。您可以根据实际需要,创建您的常用账户。

View File

@ -19,15 +19,15 @@
* OBD
OceanBase DeployerOceanBase 集群安装部署工具,简称为 OBD。详细信息请参考 [OBD 文档](https://www.oceanbase.com/docs/obd-cn)。
OceanBase DeployerOceanBase 安装部署工具,简称为 OBD。详细信息请参考 [OBD 文档](https://www.oceanbase.com/docs/obd-cn)。
* ODP
OceanBase Database ProxyOceanBase 高性能反向代理服务器,简称为 ODP又称为 OBProxy。详细信息请参考 [ODP 文档](https://www.oceanbase.com/docs/odp-cn)。
OceanBase Database ProxyOceanBase 数据库代理,是 OceanBase 数据库专用的代理服务器,简称为 ODP又称为 OBProxy。详细信息请参考 [ODP 文档](https://www.oceanbase.com/docs/odp-cn)。
* OCP
OceanBase Cloud PlatformOceanBase 运维管理工具,简称为 OCP。详细信息请参考 [OCP 文档](https://www.oceanbase.com/docs/ocp-cn)。
OceanBase Cloud PlatformOceanBase 云平台,简称为 OCP。详细信息请参考 [OCP 文档](https://www.oceanbase.com/docs/ocp-cn)。
* OCP Express
@ -166,7 +166,7 @@
若您机器中的 OBD 是通过直接下载的方式安装,则可在 `/usr/obd/example` 目录下查看 OBD 提供的配置文件示例。
若您机器中的 OBD 是通过解压 all-in-one 安装包的方式安装,则可在 `~/.oceanbase-all-in-one/conf` 目录下查看 OBD 提供的配置文件示例。请根据您的资源条件选择相应的配置文件。
若您机器中的 OBD 是通过解压 all-in-one 安装包的方式安装,则可在 `~/.oceanbase-all-in-one/obd/usr/obd/example` 目录下查看 OBD 提供的配置文件示例。请根据您的资源条件选择相应的配置文件。
<main id="notice" type='explain'>
<h4>说明</h4>
@ -263,6 +263,8 @@
log_disk_size: 7680M
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
# observer cluster name, consistent with obproxy's cluster_name
appname: obdemo
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /home/admin/observer
# The directory for data storage. The default value is $home_path/store.
@ -310,6 +312,7 @@
| home_path | 必选 | 无 | OceanBase 数据库默认安装路径,建议在普通用户 admin 下。 |
| data_dir | 可选 | $home_path/store | 设置存储 SSTable 等数据的目录,建议配置为独立的磁盘。 |
| redo_dir | 可选 | 默认与 `data_dir` 相同 | clog、ilog 和 slog 的目录,默认与 data_dir 值相同,建议配置为独立的磁盘。 |
| appname | 可选 | obcluster | 设置 OceanBase 集群名。 |
| root_password | 可选 | OBD V2.1.0 之前版本默认为空</br>OBD V2.1.0 及之后版本默认为随机字符串 | OceanBase 集群的超级管理员root@sys的密码建议设置复杂的密码。使用 OBD V2.1.0 及之后版本时,未设置的情况下会自动生成随机字符串。 |
| proxyro_password | 可选 | OBD V2.1.0 之前版本默认为空</br>OBD V2.1.0 及之后版本默认为随机字符串 | ODP 连接 OceanBase 集群使用的账户名proxyro@sys的密码。使用 OBD V2.1.0 及之后版本时,未设置的情况下会自动生成随机字符串。 |
@ -448,17 +451,39 @@
### 步骤四:连接 OceanBase 集群
运行以下命令,使用 OBClient 客户端连接 OceanBase 集群
此处以使用 OBClient 客户端连接 OceanBase 集群为例
```shell
obclient -h<IP> -P<PORT> -uroot@sys -p -c -A
obclient -h<IP> -P<PORT> -u<user_name>@<tenant_name>#<cluster_name> -p -c -A
# example
obclient -h10.10.10.4 -P2883 -uroot@sys -p -c -A
obclient -h10.10.10.4 -P2883 -uroot@sys#obdemo -p -c -A
```
其中,`IP` 为连接 OceanBase 数据库的 IP 地址;`PORT` 为连接 OceanBase 数据库的的端口,直连时为 mysql_port 配置项的值,通过 ODP 连接时为 listen_port 配置项的值。
参数说明:
使用 OBClient 客户端连接 OceanBase 集群的详细操作可参考 [通过 OBClient 连接 OceanBase 数据库](../../300.developer-guide/100.client-connects-to-oceanbase-database/300.connect-oceanbase-tenants-through-obclient.md)。
* -h提供 OceanBase 数据库连接 IP直连时为 OBServer 节点地址,通过 ODP 连接时为 ODP 地址。
* -u提供租户的连接账户格式有`用户名@租户名#集群名`、`集群名:租户名:用户名`、`集群名-租户名-用户名` 或者 `集群名.租户名.用户名`。MySQL 租户的管理员用户名默认是 `root`
<main id="notice" type='notice'>
<h4>注意</h4>
<p>连接时所用的集群名为配置文件中 <code>appname</code> 配置名称,而非部署时的 <code>deploy name</code></p>
</main>
* -P提供 OceanBase 数据库连接端口,直连时为 `mysql_port` 配置项的值,通过 ODP 连接时为 `listen_port` 配置项的值。
* -p提供 OceanBase 数据库连接密码。
* -c表示在 OBClient 运行环境中不要忽略注释。
<main id="notice" type='explain'>
<h4>说明</h4>
<p>Hint 是特殊的注释,不受 -c 影响。</p>
</main>
* -A表示在 OBClient 连接数据库时不自动获取统计信息。
更多连接 OceanBase 集群的详细操作可参见 [连接 OceanBase 数据库](../../300.developer-guide/100.client-connects-to-oceanbase-database/100.overview-of-connection-method.md)。
### 步骤五:创建用户租户
@ -476,7 +501,7 @@ obclient -h10.10.10.4 -P2883 -uroot@sys -p -c -A
该命令默认根据集群剩余全部可用资源创建租户,您可通过配置各个参数控制租户占用资源的多少,命令详细使用方法请参考 OBD 手册 [集群命令组](https://www.oceanbase.com/docs/community-obd-cn-10000000001690699) 中 `obd cluster tenant create` 命令。
* 方法二:通过命令行创建用户租户,详细操作可参考 [创建用户租户](../../500.administrator-guide/600.basic-database-management/400.manage-tenants-1/100.1.create-a-user-tenant.md)
* 方法二:通过命令行创建用户租户,详细操作可参考 [创建用户租户](../../500.administrator-guide/600.basic-database-management/400.manage-tenants-1/100.1.create-a-user-tenant.md)
## 相关操作

View File

@ -20,7 +20,7 @@
```shell
helm repo add ob-operator https://oceanbase.github.io/ob-operator/
helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --create-namespace --version=1.1.0
helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --create-namespace --version=1.2.0
```
### 使用配置文件部署
@ -29,10 +29,10 @@ helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --
```shell
# deploy CRD
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/crd.yaml
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/crd.yaml
# deploy ob-operator
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/operator.yaml
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/operator.yaml
```
#### ob-operator 自定义
@ -41,8 +41,8 @@ kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/master/
```shell
# download the config file
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/crd.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/operator.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/crd.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/operator.yaml
```
根据自身需求修改配置文件后,执行如下命令进行自定义部署。
@ -87,7 +87,7 @@ kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisione
OceanBase 数据库集群通过 yaml 配置文件进行定义,您可参考 ob-operator 提供的配置文件进行自定义的修改,通过如下命令下载 OceanBase 数据库的配置文件 `obcluster.yaml`
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obcluster.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obcluster.yaml
```
配置文件内容示例如下。
@ -187,8 +187,8 @@ kubectl apply -f obcluster.yaml
ODP 通过 yaml 配置文件进行定义,您可参考 ob-operator 提供的配置文件进行自定义的修改,通过如下命令下载 ODP 的配置文件:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obproxy/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/obproxy/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obproxy/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/obproxy/service.yaml
```
deployment.yaml 文件内容如下:
@ -312,11 +312,11 @@ obclient -h<node_ip> -P30083 -uroot@sys -p oceanbase -A -c
您可参考 ob-operator 提供的 Prometheus 配置文件进行自定义的修改,通过如下命令下载 Prometheus 的配置文件:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/cluster-role.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/cluster-role-binding.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/prometheus/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/cluster-role.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/cluster-role-binding.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/prometheus/service.yaml
```
Prometheus 根据 Kubernetes 中服务的名称和端口来选择收集数据的地址,可以按照正则表达式进行过滤,如下所示在 configmap.yaml 中进行配置。
@ -393,10 +393,10 @@ kubectl apply -f service.yaml
您可参考 ob-operator 提供的 Grafana 配置文件进行自定义的修改,通过如下命令下载 Grafana 的配置文件:
```shell
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/pvc.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/master/deploy/grafana/service.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/configmap.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/pvc.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/deployment.yaml
wget https://raw.githubusercontent.com/oceanbase/ob-operator/1.2.0_release/deploy/grafana/service.yaml
```
Grafana 通过 configmap.yaml 文件设置关键配置信息,包括 Prometheus 数据源的地址。如果 Prometheus 进行了自定义部署,需要配置实际的 service 地址。

View File

@ -1,252 +1,178 @@
# 黑名单机制
#docslug#/oceanbase-database/oceanbase-database/V4.0.0/blacklist-mechanism-1
OBProxy 使用黑名单机制自适应处理 OBServer 错峰合并、升级、leader 切换、宕机、启动和停止等过程中的 OBServer 访问控制。
OBProxy 有宕机黑名单和活着不可用黑名单两种类型,可通过设置参数对黑名单进行管理。
ODP 使用黑名单机制自适应处理 OBServer 节点的错峰合并、升级、leader 切换、宕机、启动和停止等过程中的 OBServer 节点访问控制。
## 背景信息
ODP 有状态黑名单、探测黑名单和活不可用黑名单三种类型,可通过设置参数对黑名单进行管理。
通过黑名单可主要实现如下场景的访问控制:
* 错峰合并时正在合并的 Zone 没有流量。
* 集群升级时不能访问正在升级的 OBServer 或 Zone。
* 集群升级时不能访问正在升级的 OBServer 节点或 Zone。
* OBServer 宕机后,不再访问该 OBServer。
* OBServer 节点宕机后,不再访问该 OBServer 节点
* Partition 迁移后,不再访问迁移前的 OBServer。
* Partition 迁移后,不再访问迁移前的 OBServer 节点
* 访问的 OBServer 不存在租户资源时重试。
* 访问的 OBServer 节点不存在租户资源时重试。
* OBServer 活不可用内存超限、超时、OBServer 初始化和退出)时重试。
* OBServer 节点不可用内存超限、超时、OBServer 节点初始化和退出)时重试。
## 宕机黑名单
## 状态黑名单
一旦检测到某台 OBServer 宕机或者因手工执行 `stop server` 命令使得该 OBServer 节点暂停对外提供服务时,则把这台 OBServer 加入宕机黑名单。这使得该应用不再访问该 OBServer直到再次检测发现节点状态恢复正常时才会从黑名单中放出
状态黑名单依赖于 OBServer 节点的状态变更。因为历史原因,和状态黑名单相关的状态不包含 `DETECT_ALIVE``DETECT_DEAD` 两种状态,剩下的状态变更都可以通过访问 OBServer 节点的视图获得
OBServer 节点状态是以下两种状态之一时,该 Server 被加入宕机黑名单:
通过周期任务获得 OBServer 节点最新状态后ODP 会进行根据 OBServer 节点状态的不同分别进行如下操作。
* 所在 OBServer 的 `start_service_time` 项值为 0
* `ACTIVE`:将 OBServer 节点从状态黑名单中移除,洗白 OBServer 节点
* 所在 OBServer 的 `status` 项值为 inactive
* `INACTIVE`/`REPLAY`:将 OBServer 节点加入状态黑名单
## 活着不可用黑名单
* `DELETED`/`DELETING` 状态:更新内存中 OBServer 节点的机器列表,不会向该节点转发 SQL。
活着不可用黑名单与宕机黑名单的区别在于OBServer 的状态是暂时的或不确定的,所以每隔一段时间会进行重试,如果重试发现该 OBServer 恢复正常了,则将该 OBServer 放出黑名单
* `UPGRADE` 状态:不加入状态黑名单,但也不会向该节点转发 SQL效果和黑名单类似
当 OBServer 节点状态处于以下状态之一时,该 OBServer 被加入活着不可用黑名单:
## 探测黑名单
* 所在 Zone 正在做合并/升级
状态黑名单是从 OceanBase 的总控服务节点Root Service处获得信息这种信息有时不能反映 ODP 和 OBServer 节点之间的情况。如下图所示, ODP 从 RS 处获得 OBServer1 节点状态为 ACTIVE但 ODP 和 OBServer1 节点之间网络不通
* 所在的 Server 正在做合并/升级。
![示例](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odp/V4.0.0/zh-CN/7.high-availability/3.ob-high-availability-01.png)
* OBServer 活着时的任何错误都会通过错误包形式返回,如果 OBServer 返回系统错误比如资源限制、连接数限制、系统内存超限、数据包校验出错、正在初始化、正在退出、OBServer response 超时、client connect 超时或者 OBProxy 等待超时等,该 OBServer 的活着不可用的计数加 1。如果 OBServer 在 N 秒内有 M 次活着不可用的失败计数,则将该 OBServer 加入活着不可用黑名单
因此ODP 在现有的状态黑名单基础上又实现了探测黑名单,通过给 OBServer 节点发送探测 SQL 来确定 OBServer 节点状态。ODP 会给 OceanBase 数据库的 sys 租户发送探测 SQL `select 'detect server alive' from dual`,并设置 5s 的超时时间,当超时时间内无结果返回时,会增加一次探测失败次数,当连续失败次数超过 3 次后认为探测失败,设置 OBServer 节点状态为 `DETECT_DEAD`。如果有结果返回,会将探测失败次数清零,设置 OBServer 节点状态为 `DETECT_ALIVE`。发生探测状态变更后,触发 ODP 行为如下
* 错峰合并开始时Root Service 会先更新内部表设置 Zone 的合并状态,然后将需要合并的 Zone 上的主都切换到其它的 Zone。OBProxy 周期性更新 Zone 状态表获取 Zone 状态Zone 状态更新后,该 Zone 里的 OBServer 都会设置为活着不可用。在错峰合并过程中,正在合并的 Zone 的 OBServer 都处于活着不可用黑名单
* `DETECT_ALIVE` 状态:将 OBServer 节点从探测黑名单中洗白
## 黑名单优先级
* `DETECT_DEAD` 状态:将 OBServer 节点加入到探测黑名单,并将所有和该 OBServer 节点的连接关闭。
宕机黑名单 \> 活着不可用黑名单( Zone 合并/升级 \> OBServer 合并/升级 )。
<main id="notice" type='explain'>
<h4>说明</h4>
<p>如果将 OBServer 节点加入到探测黑名单后,不断开和该 OBServer 节点的连接,那么连接会被一直占用,无法发送新的 SQL在性能数据上会看到这段时间的这台 OBServer 节点的 TPS 为 0。断开后对于后续请求ODP 会根据黑名单进行路由,不会转发给这台 OBServer 节点TPS 就可以恢复。</p>
</main>
## 强制访问黑名单中的 OBServer
## 活不可用黑名单
所有可选择的 OBServer 都处于黑名单中时,会强制重试黑名单中的 OBServer。
活不可用黑名单机制的核心是根据业务 SQL 的执行结果去定义 OBServer 节点的状态,触发拉黑和洗白操作。相较于状态黑名单和探测黑名单,活不可用黑名单的拉黑和洗白谨慎了很多,主要是为了防止一次 SQL 执行结果产生误判。具体操作如下。
* 失败:根据时间点记录下一次失败事件。
* ODP 向 OBServer 节点发送 SQL 后,超过 ob_query_timeout 时间后仍然无响应。
* OBServer 节点返回错误码 OB_SERVER_IS_INIT、OB_SERVER_IS_STOPPING、OB_PACKET_CHECKSUM_ERROR、OB_ALLOCATE_MEMORY_FAILED。
* ODP 和 OBServer 节点建连失败/报文解析失败,数据传输失败。
* 拉黑默认情况下OBServer 节点在 120s 内有五次活不可用的失败记录则拉黑这台 OBServer 节点,由配置项 congestion_fail_window错误统计周期和 congestion_failure_threshold出错次数控制。
* 尝试:默认情况下,加入活不可用黑名单超过 20s 后,尝试再次向该 OBServer 节点发送 SQL。重试时间间隔由 `congestion_retry_interval` 配置项控制。
* 洗白:如果尝试的 SQL 执行成功则进行洗白。默认 OBServer 节点在 20s 内不允许被洗白,该值由配置项 `min_keep_congestion_interval` 控制。
上述三种黑名单之间并没有优先级,只要 OBServer 节点在任何一个黑名单中,这台机器就无法接收请求。换而言之,只有当 OBServer 节点不在任何黑名单中才会接收到请求。
所有可选择的 OBServer 节点都处于黑名单中时,会强制重试黑名单中的 OBServer 节点。
## 黑名单的配置参数
1. 在客户端中使用 root 用户登录集群的 `sys` 租户。
1. 在客户端中使用 root 用户,通过 ODP 代理登录集群的 `sys` 租户。
2. 执行以下命令以查看 OBProxy 的配置参数。
```shell
obclient> obclient -h10.10.10.1 -uroot@sys#obdemo -P2883 -p -c
```
此处是以 ODP 机器 IP 为 `10.10.10.1`,集群名称为 `obdemo` 为例,通过 OBClient 连接集群。连接 OceanBase 租户的详细操作可参见 [连接方式概述](../../../../300.developer-guide/100.client-connects-to-oceanbase-database/100.overview-of-connection-method.md)。
2. 执行以下命令查看 ODP 的配置参数。
```sql
obclient> SHOW PROXYCONFIG;
```
3. 运行 `ALTER proxyconfig SET key=value` 命令更新 OBProxy 的指定配置参数,配置项更新后会立即生效。
3. 运行 `ALTER proxyconfig SET key=value` 命令更新 ODP 的指定配置参数,配置项更新后会立即生效。
与黑名单相关的配置参数描述如下表所示。
| **配置项** | **描述** |
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| enable_congestion | 是否启用黑名单机制。默认开启,在黑名单机制运行出问题时,可以暂时关闭这个选项让 OBProxy 能够正常工作。 |
| congestion_failure_threshold | 设置当 OBServer 在 N 秒内出错几次则将该 Server 加入黑名单。该参数值小于 0 时,则所有在黑名单中的 Server 都会被放出黑名单。 |
| congestion_fail_window | 设置错误统计周期的时间(秒)。默认值 120 秒,如果在这个错误统计周期中错误次数超过了 `congestion_failure_threshold` 的值,则将该 OBServer 加入黑名单。该参数值也可以动态调整,一旦修改了该参数,当前错误统计计数会被清零,将重新按新的 fail window 从头开始统计错误次数。 |
| congestion_retry_interval | 设置被加入活着不可用黑名单的 Server 的重试周期,默认值 20 秒。 |
| min_keep_congestion_interval | 设置被加入黑名单的 Server多长时间后才允许被放出黑名单。 |
| min_congested_connect_timeout | 设置客户端连接超时的值,当连接超时时则将 Server 加入活着不可用黑名单默认值为10 s。 |
| enable_congestion | 是否启用黑名单机制。默认开启,在黑名单机制运行出问题时,可以暂时关闭这个选项让 ODP 能够正常工作。 |
| congestion_failure_threshold | 控制是否将 OBServer 节点列入黑名单,与 `congestion_fail_window` 搭配使用,在 `congestion_fail_window` 时间内OBServer 节点出错次数超过该值时ODP 会将该 OBServer 节点加入黑名单。该参数值小于 0 时,则所有在黑名单中的 Server 都会被放出黑名单。 |
| congestion_fail_window | 设置错误统计周期的时间(秒),默认值 120 秒。如果在错误统计周期中错误次数超过 `congestion_failure_threshold` 的值,则将该 Server 节点加入黑名单。该参数值也可以动态调整,一旦修改了该参数,当前错误统计计数会被清零,将重新按新配置的值开始统计错误次数。 |
| congestion_retry_interval | 设置被加入活不可用黑名单的 OBServer 节点重试周期,默认值 20 秒。 |
| min_keep_congestion_interval | 设置被加入黑名单的 OBServer 节点,多长时间后才允许被放出黑名单。 |
| min_congested_connect_timeout | 设置客户端连接超时的值,当连接超时时则将 OBServer 节点加入活不可用黑名单,默认值为 100ms。 |
## 查看黑名单
可通过 `show proxycongestion [all] [clustername]` 语句查看所有 cluster 的黑名单信息
1. 在客户端中使用 root 用户,通过 ODP 代理登录集群的 `sys` 租户
* 不指定可选项时,可显示所有 cluster 的黑名单信息。
```shell
obclient> obclient -h10.10.10.1 -uroot@sys#obdemo -P2883 -p -c
```
* 仅指定 `all` 时,可显示所有 cluster 的 OBServer 信息(包括黑名单中和非黑名单中的 OBServer 信息)。
此处是以 ODP 机器 IP 为 `10.10.10.1`,集群名称为 `obdemo` 为例,通过 OBClient 连接集群。连接 OceanBase 租户的详细操作可参见 [连接方式概述](../../../../300.developer-guide/100.client-connects-to-oceanbase-database/100.overview-of-connection-method.md)
* 仅指定 `clustername` 时,可显示指定 cluster 的黑名单信息。
* 同时指定 `all``clustername` 时,可显示指定 cluster 的 OBServer 信息。
2. 执行以下命令,查看黑名单信息。
示例如下:
语句如下:
```sql
obclient> show proxyinfo binary\G
*************************** 1. row ***************************
name: binary info
info: ObProxy-OceanBase 1.1.2-459.el6
version:RELEASE_6U
MD5:
REVISION:459-local-5ba2e3d33ea201fb675eb704627162a584485cdd
BUILD_TIME:Sep 29 2016 11:50:15
BUILD_FLAGS:-D__STDC_LIMIT_MACROS -D_OB_VERSION=1000 -D__STDC_CONSTANT_MACROS -D_NO_EXCEPTION -g -Wall -Werror -Wextra -Wunused-parameter -Wformat -Wconversion -Wno-invalid-offsetof -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -mtune=generic -Wno-psabi -Wno-sign-compare -DGCC_52 -DUSE_POSIX_FALLOCATE -DSUPPORT_SSE4_2 -DHAVE_SCHED_GETCPU -DHAVE_REALTIME_COARSE -DOB_HAVE_EVENTFD -DHAVE_FALLOCATE -DHAVE_MINIDUMP
1 row in set
```sql
SHOW PROXYCONGESTION [all] [clustername];
```
obclient> show proxycongestion;
*************************** 1. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xxx.xx.x8:13201
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
*************************** 2. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.xx.x7:13203
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
2 rows in set (0.00 sec)
相关参数说明如下:
obclient> show proxycongestion all\G
*************************** 1. row ***************************
cluster_name: MetaDataBase
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.xx.x8:13201
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
*************************** 2. row ***************************
cluster_name: MetaDataBase
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.xx.x7:13203
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
*************************** 3. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.x.x8:13201
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
*************************** 4. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.x.x7:13203
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
4 rows in set
* 不指定可选项时,可查询所有集群的黑名单信息。
obclient> show proxycongestion all "ob1.jianhua.sjh"\G
*************************** 1. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.xx.x8:13201
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
*************************** 2. row ***************************
cluster_name: ob1.jianhua.sjh
zone_name: zone1
zone_state: ACTIVE
server_ip: xx.xx.xx.x7:13203
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 1
2 rows in set
* 仅指定 `all` 时,可显示所有集群的 OBServer 节点信息(包括黑名单中和非黑名单中的 OBServer 节点信息)。
* 仅指定 `clustername` 时,可显示指定集群的黑名单信息。
* 同时指定 `all``clustername` 时,可显示指定集群的 OBServer 节点信息。
### 示例
此处以查看单节点集群 `obcluster` 黑名单信息为例。
```shell
obclient> show proxycongestion 'obcluster'\G
```
>**说明**
>
> * 当 `dead_congested``alive_congested` 中的任意一个状态为 `1` 时,表示该 OBServer 节点已加入黑名单。
>
> * OBProxy 1.1.2 版本之前, clustername 不需要单引号或者双引号引起来1.1.2 版本及之后,必须要用单引号或者双引号引起来。
输出如下:
```shell
*************************** 1. row ***************************
cluster_name: obcluster
zone_name: zone1
region_name: sys_region
zone_state: ACTIVE
server_ip: xxx.xxx.xxx.xxx:2881
cr_version: 5
server_state: ACTIVE
alive_congested: 0
last_alive_congested: 0
dead_congested: 0
last_dead_congested: 0
stat_alive_failures: 0
stat_conn_failures: 0
conn_last_fail_time: 0
conn_failure_events: 0
alive_last_fail_time: 0
alive_failure_events: 0
ref_count: 2
detect_congested: 0
last_detect_congested: 0
```
<main id="notice" type='explain'>
<h4>说明</h4>
<ul>
<li>
<p><code>dead_congested</code><code>alive_congested</code> 中的任意一个状态为 <code>1</code> 时,表示该 OBServer 节点已加入黑名单。</p>
</li>
<li>
<p>ODP V1.1.2 版本之前, <code>clustername</code> 不需要单引号或者双引号引起来V1.1.2 版本及之后,必须要用单引号或者双引号引起来。</p>
</li>
</ul>
</main>