Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 在 K8S 上部署 OceanBase 的最佳实践
title: 在 K8S 上部署 OceanBase 实践
weight: 2
---
> 本文作者:美的集团软件工程院 陈子鎏(OceanBase 社区论坛账号:@qchenzi)
Expand Down Expand Up @@ -187,13 +187,13 @@ spec:
```
部署完成后,如下图所示:

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/001.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/001.png)

**通过 OBProxy 访问 OB 集群**:

此时,可以通过 OBProxy 的 Service 提供 OB 数据库的访问入口,如下(obmysql 是我提前创建好的租户,testdb 是提前在 obmysql 下创建的用户):

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/002.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/002.png)

当然,在实际的生产中,我们采用的是域名访问的方式,而不是通过 IP 地址访问,因此需要进行域名重写,可看下一小节。

Expand Down Expand Up @@ -260,7 +260,7 @@ spec:
6. **如图所示**:
- 直接通过域名即可访问,而不用关心 obproxy 的 service ip,进一步加强了集群的高可用能力

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/003.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/003.png)

### 2.6 监控与运维

Expand Down Expand Up @@ -305,21 +305,21 @@ svc-prometheus NodePort 12.80.144.38 <none> 9090:30090/TCP 7
2. 在 `Add data source` 页面,选择 `Prometheus` 作为数据源类型。
3. 在 `Prometheus` 页面,填写 `Name` 为 `ob-prometheus`,`URL` 为 `http://12.80.144.38:9090`(即上面的promethues对应的svc ip),然后单击 `Save & Test` 按钮。

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/004.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/004.png)


##### 2.6.2.2 配置 Grafana Dashboard

1. 新建一个名为 OceanBase 的文件夹

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/005.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/005.png)

2. 进入该文件夹,接着导入文件链接:[grafana.yaml](https://github.com/oceanbase/ob-operator/blob/2.3.1/example/webapp/grafana.yaml) 中的grafana-dashboards-ob部分的json配置

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/006.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/006.png)
3. 监控展示如图

![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_best_practices_for_deploying_oceanbase_on_k8s/007.png)
![img](/img/user_manual/operation_and_maintenance/zh-CN/user_practice_co-construction/02_deploying_on_K8s/007.png)


## 3. 部署中遇到的问题及解决方案
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ weight: 3
---
> 本文作者:张瑞远(OceanBase 社区论坛账号:@五月)

> 在数据库管理中,误操作是一个常见但令人头疼的问题。无论是意外删除了重要数据、修改了关键配置,还是执行了错误的 SQL 语句,这些误操作都可能导致业务中断或数据丢失。幸运的是,OceanBase 提供了一系列机制和工具来帮助我们从误操作中恢复。本文将介绍几种有效的恢复方法,为那些可能犯错的管理员们提供一份 “后悔药”。
>
在数据库管理中,误操作是一个常见但令人头疼的问题。无论是意外删除了重要数据、修改了关键配置,还是执行了错误的 SQL 语句,这些误操作都可能导致业务中断或数据丢失。

幸运的是,OceanBase 提供了一系列机制和工具来帮助我们从误操作中恢复。本文将介绍几种有效的恢复方法,为那些可能犯错的管理员们提供一份 “后悔药”。


## 一、备份与还原
### 1.1 定期备份的重要性
Expand Down Expand Up @@ -124,11 +126,9 @@ ROLLBACK TO SAVEPOINT pointname;
该方法可以紧急拉起单副本,但是要尽快备份数据,或者修复集群!



**<font color="red">单副本拉起这个方法不是官方的标准操作,有很多风险(例如多数派挂了,有可能在剩余的副本上看到的已经不是最新的数据了)。这个方法是标准意义上的 “奇技淫巧”,大家了解即可。</font>**



## 七、预防措施
最后,除了事后补救外,还需要加强事前预防。这包括但不限于:

Expand Down
Loading
Loading