add docs website config (#251)
* add docs website config * move files in doc/ to docs/
This commit is contained in:
20
docs/README.md
Normal file
20
docs/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# OceanBase Documentation
|
||||
Welcome to the OceanBase documentation!
|
||||
|
||||
This directory stores all the source files of OceanBase documentation website.
|
||||
|
||||
## Starting a server locally
|
||||
|
||||
OceanBase documentation website is built with [MkDocs](https://www.mkdocs.org/). To install all dependencies, run:
|
||||
|
||||
$ pip install -r ./requirements.txt
|
||||
|
||||
Generate the site, and start a server locally:
|
||||
|
||||
$ mkdocs serve
|
||||
|
||||
Open up http://127.0.0.1:8000/ in your browser, and you'll see the default home page.
|
||||
|
||||
## Contributing
|
||||
|
||||
See [How to Contribute](../CONTRIBUTING.md).
|
||||
64
docs/cn/ob-admin/clog-format-introduction.md
Normal file
64
docs/cn/ob-admin/clog-format-introduction.md
Normal file
@ -0,0 +1,64 @@
|
||||
# clog 日志格式说明
|
||||
|
||||
通常 clog 文件中包含多种类型的日志,其中 OB_LOG_SUBMIT 为主要的日志类型,表示对应的 clog 日志为其他模块(非 clog 模块)提交的日志,包含事务模块向 clog 提交的事务日志。本节介绍事务日志的打印格式。
|
||||
|
||||
事务日志的打印格式主要包含三部分:摘要(abstract)、头部(header)和主体(content)。日志形式如下所示:
|
||||
|
||||
```bash
|
||||
$$$abstract |header ||| |||content
|
||||
```
|
||||
|
||||
## 摘要
|
||||
|
||||
摘要描述了日志记录在日志文件中的相关信息,内容形式如下所示:
|
||||
|
||||
```bash
|
||||
file_id:*** offset:*** len:*** OB_LOG_SUBMIT
|
||||
```
|
||||
|
||||
下表列出了字段名的详细信息。
|
||||
|
||||
| 字段名 | 说明 |
|
||||
| --- | --- |
|
||||
| file_id | clog 日志文件名 |
|
||||
| offset | 日志记录在日志文件中的偏移量 |
|
||||
| len | 日志记录的长度 |
|
||||
| OB_LOG_SUBMIT | clog 日志类型为 OB_LOG_SUBMIT |
|
||||
|
||||
## 头部
|
||||
|
||||
头部描述了日志记录自身的相关信息,内容形式如下所示:
|
||||
|
||||
```bash
|
||||
ObLogEntryHeader:{magic:***, version:***, type:***, partition_key:***, log_id:***, data_len:***, generation_timestamp:***, epoch_id:***, proposal_id:***, submit_timestamp:***, is_batch_committed:***, is_trans_log:***, data_checksum:***, active_memstore_version:***, header_checksum:***}
|
||||
```
|
||||
|
||||
下表列出了部分字段名的详细信息。
|
||||
|
||||
| 字段名 | 说明 |
|
||||
| --- | --- |
|
||||
| partition_key | 日志记录对应的数据分区的分区标识符 |
|
||||
| log_id | 日志记录的标识符,可看作日志序列号 |
|
||||
| generation_timestamp_ | 日志记录产生的时间点(Unix 时间戳) |
|
||||
| epoch_id | 选举相关变量,选举周期标识符(Unix 时间戳) |
|
||||
| proposal_id | Paxos 协议相关变量 |
|
||||
| is_trans_log | 日志记录是否是事务记录 |
|
||||
|
||||
## 主体
|
||||
|
||||
主体描述了该日志记录包含的数据。如果该日志记录是事务日志记录,内容形式如下所示:
|
||||
|
||||
```bash
|
||||
Trans: log_type:***, trans_inc:*** {[trans_log]}||| [mutator]
|
||||
```
|
||||
|
||||
下表列出了部分字段名的详细信息。
|
||||
|
||||
| 字段名 | 说明 |
|
||||
| --- | --- |
|
||||
| `log_type` | 事务日志的类型 |
|
||||
| `trans_id` | 事务日志对应的事务标识符 |
|
||||
| `[trans_log]` | 事务日志的相关信息 |
|
||||
| `[mutator]` | 如果事务日志类型为 redo,则该日志包含事务修改内容 |
|
||||
|
||||
由于 OceanBase 数据库限制一条日志记录的大小,因此当一个事务的修改数据量较大时,可能产生多条 redo 类型的事务日志记录。
|
||||
178
docs/cn/ob-admin/clog-tool.md
Normal file
178
docs/cn/ob-admin/clog-tool.md
Normal file
@ -0,0 +1,178 @@
|
||||
# clog_tool
|
||||
|
||||
OceanBase 数据库的 clog 日志类似于传统数据库的 Redo 日志。clog 日志负责在事务提交时持久化事务数据。事务数据是事务对数据库的修改记录。clog_tool 用于解析并打印 clog 文件。目前,clog_tool 集成在 ob_admin 工具中,您可以通过执行 `ob_admin` 命令调用 clog_tool。
|
||||
|
||||
<!-- 为了保证高可用和一致性,OceanBase 数据库采用了 Paxos 协议对影响数据库状态的操作进行持久化。持久化产生的一致性日志文件即为 clog 日志。 -->
|
||||
|
||||
## clog_tool 命令
|
||||
|
||||
下表列出了 clog_tool 的常用命令。
|
||||
|
||||
| 命令名 | 说明 |
|
||||
| --- | --- |
|
||||
| `dump_all` | 解析并打印指定的 clog 文件。 |
|
||||
| `dump_hex` | 解析并打印指定的 clog 文件,并将不可打印的字符转换为十六进制字符打印。 |
|
||||
| `dump_format` | 解析指定的 clog 文件,并将这个日志文件按照类 SQL 形式打印。 |
|
||||
| `dump_filter` | 解析指定的 clog 文件,并打印这个日志文件中满足过滤条件的记录。 |
|
||||
| `stat_clog` | 解析指定的 clog 文件,并打印这个日志文件的统计信息。|
|
||||
|
||||
### `dump_all` 命令
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_all <clog_file_name>
|
||||
```
|
||||
|
||||
使用 `dump_all` 命令解析并打印指定的 clog 文件。解析多个文件时,文件名需要使用空格隔开。
|
||||
|
||||
其中 `clog_file_name` 为指定 clog 文件名。`clog_file_name` 可以包含文件路径。例如:
|
||||
|
||||
解析并打印单个 clog 文件。此处待解析的 clog 文件名为 `101`,且这个文件位于当前目录,则运行以下命令解析并打印该文件。
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_all 101
|
||||
```
|
||||
|
||||
解析并打印多个 clog 文件。此处待解析的 clog 文件名为 `101` 和 `103`,且这两个文件均位于当前目录,则运行以下命令解析并打印这两个文件。
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_all 101 103
|
||||
```
|
||||
|
||||
解析并打印多个文件名递增的 clog 文件。此处待解析的 clog 文件名为 `101`、`102`、`103` 和 `104`,且这些文件均位于当前目录,则运行以下命令解析并打印这些文件。
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_all {101..104}
|
||||
```
|
||||
|
||||
### `dump_hex` 命令
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_hex <clog_file_name>
|
||||
```
|
||||
|
||||
如果 clog 日志中包含不可打印的字符,那么 ob_admin 将无法通过 `dump_all` 命令打印这部分内容。使用 `dump_hex` 命令将不可打印的字符转为十六进制字符并打印。
|
||||
|
||||
`<clog_file_name>` 详情,参考 `dump_all` 命令。
|
||||
|
||||
### `dump_format` 命令
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_format <clog_file_name>
|
||||
```
|
||||
|
||||
通过 `dump_all` 命令打印的日志不便于阅读。为了增强可读性,使用 `dump_format` 命令解析指定的 clog 文件,并将这个日志文件按照类 SQL 形式打印。
|
||||
|
||||
`<clog_file_name>` 详情,参考 `dump_all` 命令。
|
||||
|
||||
### `dump_filter`
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_filter '<filter_name>' <clog_file_name>
|
||||
```
|
||||
|
||||
使用 `dump_filter` 命令过滤不需要的 clog 日志记录。
|
||||
|
||||
`<clog_file_name>` 详情,参考 `dump_all` 命令。
|
||||
|
||||
目前,`filter_name` 的取值如下:
|
||||
|
||||
| 过滤条件名称 | 说明 |
|
||||
| --- | --- |
|
||||
| `table_id` | 数据表标识符 |
|
||||
| `partition_id` | 数据分区标识符 |
|
||||
|
||||
`filter_name` 可以单独使用,也可以组合使用。过滤多个条件时,条件名称需要用英文分号(;)隔开。例如:
|
||||
|
||||
`table_id` 为 123, clog 文件名为 `101` 且位于当前目录,则运行以下命令解析并打印该文件。
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_filter 'table_id=123' 101
|
||||
```
|
||||
|
||||
`table_id` 为 `123`,`partition_id` 为 `2`,需要解析的 clog 文件名为 `101` 且位于当前目录,则运行以下命令解析并打印该文件。
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool dump_filter 'table_id=123;partition_id=2' 101
|
||||
```
|
||||
|
||||
### `stat_clog` 命令
|
||||
|
||||
```bash
|
||||
ob_admin clog_tool stat_clog <clog_file_name>
|
||||
```
|
||||
|
||||
使用 `stat_clog` 命令获取指定 clog 文件的统计信息,包括日志文件大小、日志记录个数、事务个数等信息。
|
||||
|
||||
<!-- ## 事务的相关信息
|
||||
|
||||
### 事务日志的类型
|
||||
|
||||
根据事务日志产生的阶段,可以将事务日志分为事务执行时日志和事务提交时日志。
|
||||
|
||||
#### 事务执行时日志
|
||||
|
||||
在事务执行阶段,对事务的修改进行持久化时产生日志记录即为事务执行时日志。事务执行时日志记录的类型如下所示:
|
||||
|
||||
| 日志类型 | 内部类型值 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| OB_LOG_MUTATOR | 0x200 | 事务的 mutator 日志,包含事务的修改内容 |
|
||||
| OB_LOG_TRANS_STATE | 0x400 | 事务的状态日志 |
|
||||
| OB_LOG_MUTATOR_WITH_STATE | 0x600 | 事务的状态日志,携带 mutator 日志 |
|
||||
| OB_LOG_MUTATOR_ABORT | 0x800 | 事务的 abort 日志,用于标记该事务已回滚 |
|
||||
|
||||
#### 事务提交时日志
|
||||
|
||||
在事务提交阶段,对事务的修改进行持久化时产生的日志即为事务提交时日志。根据不同的事务类型,事务提交时日志可以分为分布式事务的提交时日志和本地单分区事务的提交时日志。
|
||||
|
||||
分布式事务的提交时日志的类型如下所示:
|
||||
|
||||
| 日志类型 | 内部类型值 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| OB_LOG_TRANS_REDO | 0x1 | 分布式事务的 redo 日志,包含事务的修改内容(redo 日志) |
|
||||
| OB_LOG_TRANS_PREPARE | 0x2 | 分布式事务的 prepare 日志 |
|
||||
| OB_LOG_TRANS_REDO_WITH_PREPARE | 0x3 | 分布式事务的 prepare 日志,包含事务的修改内容(redo 日志) |
|
||||
| OB_LOG_TRANS_COMMIT | 0x4 | 分布式事务的 commit 日志,标记该事务已提交 |
|
||||
| OB_LOG_TRANS_ABORT | 0x8 | 分布式事务的 abort 日志,标记该事务已回滚 |
|
||||
| OB_LOG_TRANS_CLEAR | 0x10 | 分布式事务的 clear 日志,用于释放事务上下文信息 |
|
||||
|
||||
本地单分区事务的提交时日志的类型如下所示:
|
||||
|
||||
| 日志类型 | 内部类型值 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| OB_LOG_SP_TRANS_REDO | 0x20 | 单分区事务的 redo 日志,包含事务的修改内容(redo 日志) |
|
||||
| OB_LOG_SP_TRANS_COMMIT | 0x40 | 单分区事务的 commit 日志,标记该事务已提交,包含事务的修改内容(redo 日志) |
|
||||
| OB_LOG_SP_TRANS_ABORT | 0x80 | 单分区事务的 abort 日志,标记该事务已回滚 |
|
||||
|
||||
### 事务标识符(Transaction ID)
|
||||
|
||||
事务标识符用于区分 OBServer 内部的不同事务。因此,事务标识符需要具有**唯一性**,即不同事务具有不同的事务标识符。
|
||||
|
||||
为了实现事务标识符的唯一性,事务标识符的结构如下所示:
|
||||
|
||||
```bash
|
||||
class ObTransID
|
||||
{
|
||||
uint64_t hv_;
|
||||
common::ObAddr server_;
|
||||
int64_t inc_;
|
||||
int64_t timestamp_;
|
||||
}
|
||||
```
|
||||
|
||||
各字段说明如下所示:
|
||||
|
||||
| 字段名 | 说明 |
|
||||
| --- | --- |
|
||||
| server_ | 维护该事务标识符的 OBServer 的物理地址(包括 IP 地址和端口号) |
|
||||
| inc_ | OBServer 维护的单调递增值,在 OBServer 重启后重新计数 |
|
||||
| timestamp_ | 创建该事务标志符时的本地物理时钟值(Unix 时间戳) |
|
||||
| hv_ | 根据以上三个字段计算得到的 Hash 值 |
|
||||
|
||||
由于 OceanBase 数据库采用了 64 位 Hash 值,两个不同事务标识符的 Hash 值产生冲突的概率极低。因此,在大多数情况下,可以使用 Hash 值来区分不同事务。
|
||||
|
||||
### 事务类型
|
||||
|
||||
根据事务的操作类型以及访问数据的分布,可以将事务分为本地单分区事务与分布式事务。
|
||||
|
||||
- 本地单分区事务:事务信息的维护与该事务的访问数据位于同一个节点,且该事务仅访问同一个数据分区内的数据。
|
||||
- 分布式事务:事务信息的维护与该事务的访问数据位于不同节点,或者事务访问多个数据分区。 -->
|
||||
193
docs/cn/quick-start-cn.md
Normal file
193
docs/cn/quick-start-cn.md
Normal file
@ -0,0 +1,193 @@
|
||||
# 快速入门指南
|
||||
|
||||
本指南以单机安装 OceanBase 数据库为例指导您如何快速使用 OceanBase 数据库。
|
||||
|
||||
## 前提条件
|
||||
|
||||
在安装 OceanBase 数据库之前,确保您的机器可以连接公网。并且您的软硬件环境满足以下要求:
|
||||
|
||||
| 项目 | 描述 |
|
||||
| ---- | --- |
|
||||
| 系统 | Red Hat Enterprise Linux Server 7.2 版本(内核 Linux 3.10.0 版本及以上) <br /> CentOS Linux 7.2 版本(内核 Linux 3.10.0 版本及以上) |
|
||||
| 内存 | 至少 16G <br /> 推荐 64G 及以上|
|
||||
| 磁盘类型 | 推荐使用 SSD|
|
||||
| 磁盘存储空间 | 至少 100G|
|
||||
| 文件系统 | EXT4 戓 XFS|
|
||||
| 网卡 | 千兆互联及以上|
|
||||
|
||||
>**注意:** 以下内容以 x86 架构的 CentOS Linux 7.2 镜像作为环境,其他环境可能略有不同。
|
||||
|
||||
## 步骤 1:下载安装 OBD
|
||||
|
||||
获取 OceanBase 数据库最快的方式是使用数据库部署工具 OceanBase Deployer(简称 OBD),因此推荐您使用此方式体验 OceanBase 数据库。按照以下步骤下载并安装 OBD:
|
||||
|
||||
### 方案1:通过 YUM 软件源安装 OBD
|
||||
|
||||
如您的机器可以访问公网,并能够添加三方 YUM 软件源,您可以运行以下命令,使用 OceanBase 的官方软件源安装 OBD:
|
||||
|
||||
```bash
|
||||
sudo yum install -y yum-utils
|
||||
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
|
||||
sudo yum install -y ob-deploy
|
||||
```
|
||||
|
||||
### 方案2: 离线安装
|
||||
|
||||
1. 下载 OBD 离线 RPM 安装包。
|
||||
|
||||
2. 运行以下命令安装 OBD。
|
||||
|
||||
```bash
|
||||
yum install -y ob-deploy-1.0.0-1.el7.x86_64.rpm
|
||||
source /etc/profile.d/obd.sh
|
||||
```
|
||||
|
||||
## (可选)步骤 2:下载 OceanBase 数据库
|
||||
|
||||
如果您的机器可以连接公网,则直接跳过此步骤。因为在您执行了 `obd cluster deploy` 命令时,OBD 将检查您的目标机器是否已存在 OceanBase 数据库软件包。如未找到,OBD 将自动从 YUM 源获取。
|
||||
|
||||
如果您的机器机器不能连接公网,按照以下步骤下载 OceanBase 数据库的离线软件包:
|
||||
|
||||
1. 运行以下命令,下载 OceanBase 数据库的离线软件包:
|
||||
|
||||
```bash
|
||||
# 创建一个目录用于下载
|
||||
mkdir rpm
|
||||
cat > rpm_list <<EOF
|
||||
oceanbase-ce-3.1.0-1.el7.x86_64.rpm
|
||||
oceanbase-ce-libs-3.1.0-1.el7.x86_64.rpm
|
||||
obproxy-3.1.0-1.el7.x86_64.rpm
|
||||
EOF
|
||||
|
||||
wget -B https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/ -i rpm_list -P rpm
|
||||
```
|
||||
|
||||
**注意:** 示例中的安装包可能不是最新版本,建议您下载最新的安装包。详细信息,参考 [OceanBase 数据库发行版本](https://github.com/oceanbase/oceanbase/releases)。
|
||||
|
||||
2. 运行以下命令,将软件包拷贝到您的中控机器:
|
||||
|
||||
```bash
|
||||
scp -r rpm <user>@<your-machine-ip>
|
||||
```
|
||||
|
||||
3. 在中控机器运行以下命令,将 OceanBase 数据库的离线软件包加入本地镜像:
|
||||
|
||||
```bash
|
||||
cd ~/rpm
|
||||
obd mirror clone *.rpm
|
||||
```
|
||||
|
||||
## 步骤 3:部署 OceanBase 数据库
|
||||
|
||||
本节介绍如何使用 OBD 部署 OceanBase 数据库。按照以下步骤部署 OceanBase 数据库:
|
||||
|
||||
1. 从 Gitee/GitHub 上下载对应的配置文件模板。
|
||||
|
||||
- 如果您采用本地安装,即中控机器和目标机器是同一台机器,请下载 [本地安装配置文件](https://gitee.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml)。
|
||||
- 如果您采用单机安装,即中控机器和目标机器不是同一台机器,且目标机器只有一台,请下载 [单机安装配置文件](https://gitee.com/oceanbase/obdeploy/blob/master/example/mini-single-example.yaml)。
|
||||
- 如果您采用分布式安装,即中控机器和目标机器不是同一台机器,且目标机器有多台,请下载 [分布式安装配置文件](https://gitee.com/oceanbase/obdeploy/blob/master/example/mini-distributed-example.yaml)。
|
||||
> **注意:** 此处以本地安装为例,介绍如何修改配置文件。您必须按照您的安装方式选择对应的配置文件模板。
|
||||
|
||||
2. 如您的中控机器和目标机器不是同一台,您还需要在配置文件顶部添加远程 SSH 访问的相关配置。
|
||||
|
||||
```yaml
|
||||
user:
|
||||
username: <您的账号名>
|
||||
password: <您的登录密码>
|
||||
key_file: <您的私钥路径>
|
||||
```
|
||||
|
||||
其中,`username` 为登录到目标机器的用户名,确保您的用户名有 `home_path` 权限。
|
||||
> **注意:** 通常情况下,您只能使用登录密码或者私钥登录中的一种方式登录目标机器,如果同时填写,`password` 将被认为是您私钥的密码。
|
||||
|
||||
3. (可选)修改配置文件中的 IP 地址。
|
||||
|
||||
```yaml
|
||||
oceanbase-ce:
|
||||
servers:
|
||||
- name: z1
|
||||
# Please don't use hostname, only IP can be supported
|
||||
ip: 11.166.80.01
|
||||
```
|
||||
|
||||
4. 修改配置文件中的 `devname` 变量和 `home_path`。
|
||||
|
||||
```yaml
|
||||
oceanbase-ce:
|
||||
global:
|
||||
home_path: <your_observer_work_path>
|
||||
# Please set devname as the network adaptor's name whose ip is in the setting of severs.
|
||||
# if set severs as "127.0.0.1", please set devname as "lo"
|
||||
# if current ip is 192.168.1.10, and the ip's network adaptor'sname is "eth0", please use "eth0"
|
||||
devname: bond0
|
||||
```
|
||||
|
||||
## 步骤 4:连接 OceanBase 数据库
|
||||
|
||||
按照以下步骤部署并启动 OceanBase 数据库实例:
|
||||
|
||||
1. 运行以下命令部署集群:
|
||||
|
||||
```bash
|
||||
obd cluster deploy <deploy_name> -c <deploy_config_path>
|
||||
```
|
||||
|
||||
其中,`deploy_name` 为集群名称。一个集群只能有一个名称,且集群名称不能重复。
|
||||
|
||||
2. 运行以下命令启动集群:
|
||||
|
||||
```bash
|
||||
obd cluster start <deploy_name>
|
||||
```
|
||||
|
||||
3. 运行以下命令查看集群状态:
|
||||
|
||||
```bash
|
||||
obd cluster display <deploy_name>
|
||||
```
|
||||
|
||||
## 步骤 5:连接 OceanBase 数据库
|
||||
|
||||
按照以下步骤连接 OceanBase 数据库:
|
||||
|
||||
1. 安装 OceanBase 数据库客户端 OBClient:
|
||||
|
||||
如您的机器已添加 OceanBase 官方 YUM 源作为软件源,使用以下命令直接安装:
|
||||
|
||||
```bash
|
||||
sudo yum install -y obclient
|
||||
```
|
||||
|
||||
否则您需要在机器上准备好离线安装包,并执行以下命令安装:
|
||||
|
||||
```bash
|
||||
sudo yum install -y obclient-2.0.0-1.el7.x86_64.rpm
|
||||
```
|
||||
|
||||
**注意:** 示例中的安装包可能不是最新版本,建议您下载最新的安装包。详细信息,参考 [OceanBase 官网下载中心](https://github.com/oceanbase/oceanbase/releases)。
|
||||
|
||||
2. 运行以下命令,使用 OBClient 客户端连接 OceanBase 数据库:
|
||||
|
||||
```bash
|
||||
obclient -h<your_ip> -P<observer_mysql_port> -uroot
|
||||
```
|
||||
|
||||
其中,`<your_ip>` 为您 OceanBase 实例所在的机器 IP 地址。`observer` 默认使用端口 `2883` 连接 OBClient。如果您对端口做了更改,此处使用您实际的端口号。
|
||||
|
||||
返回以下信息:
|
||||
|
||||
```bash
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MySQL connection id is 3221546072
|
||||
Server version: 5.7.25 OceanBase 3.1.0 (r1-) (Built Apr 7 2021 08:14:49)
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MySQL [(none)]>
|
||||
```
|
||||
|
||||
## (可选)步骤 6:创建租户
|
||||
|
||||
创建租户详细信息,参考 [创建用户租户](https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/create-a-user-tenant)。
|
||||
193
docs/en/quick-start-en.md
Normal file
193
docs/en/quick-start-en.md
Normal file
@ -0,0 +1,193 @@
|
||||
# Quick Start
|
||||
|
||||
This guide navigates you through the installation of OceanBase Database by taking standalone OceanBase Database as an example.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Your server has access to the Internet, and the software and hardware meet the following requirements:
|
||||
|
||||
| Item | Description |
|
||||
| ---- | --- |
|
||||
| System | Red Hat Enterprise Linux Server 7.2 Release with the Linux kernel version being 3.10.0 or later<br /> CentOS Linux 7.2 Release with the Linux kernel version being 3.10.0 or later |
|
||||
| Memory | At least 16 GB<br /> 64 GB or larger is recommended |
|
||||
| Disk type | SSDs are recommended |
|
||||
| Disk space | At least 100 GB |
|
||||
| File system | EXT4 or XFS |
|
||||
| NIC | 1 Gbit/s or above |
|
||||
|
||||
> **NOTE:** The following description is based on a CentOS Linux 7.2 image in the x86 architecture. The installation procedure may be slightly different in other environments.
|
||||
|
||||
## Step 1: Download and install OBD
|
||||
|
||||
We recommend that you use OceanBase Deployer (OBD). It is the fastest tool for the deployment of OceanBase Database. Take the following steps to download and install OBD:
|
||||
|
||||
### Option 1: Install OBD by using Yum repositories
|
||||
|
||||
If your server has access to the Internet and supports third-party software from YUM repositories, you can run the following command to install OBD:
|
||||
|
||||
```bash
|
||||
sudo yum install -y yum-utils
|
||||
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
|
||||
sudo yum install -y ob-deploy
|
||||
```
|
||||
|
||||
### Option 2: Install ODB offline
|
||||
|
||||
1. Download the RPM package of OBD.
|
||||
|
||||
2. Run the following command to install OBD.
|
||||
|
||||
```bash
|
||||
yum install -y ob-deploy-1.0.0-1.el7.x86_64.rpm
|
||||
source /etc/profile.d/obd.sh
|
||||
```
|
||||
|
||||
## (Optional) Step 2: Download the OceanBase Database installation package
|
||||
|
||||
You may skip this step if your server has access to the Internet, because when you run the `obd cluster deploy` command, OBD checks whether the OceanBase Database installation package exists on your target server. If the package is not found, OBD automatically downloads it from YUM repositories.
|
||||
|
||||
If your server does not have Internet access, take the following steps to install the software offline:
|
||||
|
||||
1. Run the following command to download the OceanBase Database installation package:
|
||||
|
||||
```bash
|
||||
# Create a directory to store the package.
|
||||
mkdir rpm
|
||||
cat > rpm_list <<EOF
|
||||
oceanbase-ce-3.1.0-1.el7.x86_64.rpm
|
||||
oceanbase-ce-libs-3.1.0-1.el7.x86_64.rpm
|
||||
obproxy-3.1.0-1.el7.x86_64.rpm
|
||||
EOF
|
||||
|
||||
wget -B https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/ -i rpm_list -P rpm
|
||||
```
|
||||
|
||||
**NOTE:** The installation packages in the preceding example may not be the latest version. We recommend that you download the latest installation packages. For more information, see [OceanBase Database Releases](https://github.com/oceanbase/oceanbase/releases).
|
||||
|
||||
2. Run the following command to copy the package to your central control server:
|
||||
|
||||
```bash
|
||||
scp -r rpm <user>@<your-machine-ip>
|
||||
```
|
||||
|
||||
3. Run the following command on the central control server to load the package to the local image:
|
||||
|
||||
```bash
|
||||
cd ~/rpm
|
||||
obd mirror clone *.rpm
|
||||
```
|
||||
|
||||
## Step 3: Deploy OceanBase Database
|
||||
|
||||
This section describes how to use OBD to deploy OceanBase Database. Take the following steps:
|
||||
|
||||
1. Download the corresponding configuration template from GitHub. These are some sample configurations:
|
||||
|
||||
- If you want to install OceanBase Database on your central control server, download the [local installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml).
|
||||
- If you want to install OceanBase Database on a standalone server other than the central control server, download the [standalone installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-single-example.yaml).
|
||||
- If you want to install OceanBase Database on multiple servers other than the central control server, download the [distributed installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-distributed-example.yaml)
|
||||
> **NOTE:** The following example describes how to modify the configuration file in local installation mode. You must select the configuration template that corresponds to your installation mode.
|
||||
|
||||
2. If you want to install OceanBase Database on a server other than the central control server, you need to add relevant configurations for SSH remote access at the beginning of the configuration file.
|
||||
|
||||
```yaml
|
||||
user:
|
||||
username: <Your account name.>
|
||||
password: <Your logon password.>
|
||||
key_file: <The path of your private key.>
|
||||
```
|
||||
|
||||
`username` specifies the username used to log on to the target server. Make sure that your username has access to `home_path`.
|
||||
> **NOTE:** Generally, you can use only the password or the private key to log on. If you specify both of them, `password` is considered as the password of your private key.
|
||||
|
||||
3. (Optional) Modify the IP address in the configuration file.
|
||||
|
||||
```yaml
|
||||
oceanbase-ce:
|
||||
servers:
|
||||
- name: z1
|
||||
# Please don't use hostname, only IP can be supported
|
||||
ip: 11.166.80.01
|
||||
```
|
||||
|
||||
4. Modify the `devname` and `home_path` variables in the configuration file.
|
||||
|
||||
```yaml
|
||||
oceanbase-ce:
|
||||
global:
|
||||
home_path: <your_observer_work_path>
|
||||
# Please set devname as the network adaptor's name whose ip is in the setting of severs.
|
||||
# if set severs as "127.0.0.1", please set devname as "lo"
|
||||
# if current ip is 192.168.1.10, and the ip's network adaptor'sname is "eth0", please use "eth0"
|
||||
devname: bond0
|
||||
```
|
||||
|
||||
## Step 4: Connect to OceanBase Database
|
||||
|
||||
Take the following steps to deploy and start the OceanBase Database instance:
|
||||
|
||||
1. Run the following command to deploy the cluster:
|
||||
|
||||
```bash
|
||||
obd cluster deploy <deploy_name> -c <deploy_config_path>
|
||||
```
|
||||
|
||||
`deploy_name` specifies the name of the cluster. You can specify only one unique name for a cluster.
|
||||
|
||||
2. Run the following command to start the cluster:
|
||||
|
||||
```bash
|
||||
obd cluster start <deploy_name>
|
||||
```
|
||||
|
||||
3. Run the following command to check the cluster status:
|
||||
|
||||
```bash
|
||||
obd cluster display <deploy_name>
|
||||
```
|
||||
|
||||
## Step 5: Connect to OceanBase Database
|
||||
|
||||
Take the following steps:
|
||||
|
||||
1. Install the OceanBase Database client (OBClient):
|
||||
|
||||
If you have added YUM repositories as the software source on your server, run the following command to install the OBClient:
|
||||
|
||||
```bash
|
||||
sudo yum install -y obclient
|
||||
```
|
||||
|
||||
Otherwise, you need to download the installation package to the server and run the following command to install it offline:
|
||||
|
||||
```bash
|
||||
sudo yum install -y obclient-2.0.0-1.el7.x86_64.rpm
|
||||
```
|
||||
|
||||
**NOTE:** The installation packages in the preceding example may not be the latest version. We recommend that you download the latest installation packages. For more information, see [OceanBase Download Center](https://github.com/oceanbase/oceanbase/releases).
|
||||
|
||||
2. Run the following command to connect to OceanBase Database from the OBClient:
|
||||
|
||||
```bash
|
||||
obclient -h<your_ip> -P<observer_mysql_port> -uroot
|
||||
```
|
||||
|
||||
`<your_ip>` specifies the IP address of the server where your OceanBase Database instance is located. By default, the `observer` connects to the OBClient through port `2883`. Use the actual port number if you have changed it.
|
||||
|
||||
The following returned information indicates successful connection:
|
||||
|
||||
```bash
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MySQL connection id is 3221546072
|
||||
Server version: 5.7.25 OceanBase 3.1.0 (r1-) (Built Apr 7 2021 08:14:49)
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MySQL [(none)]>
|
||||
```
|
||||
|
||||
## (Optional) Step 6: Create a tenant
|
||||
|
||||
For more information, see [Create a user tenant](https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/create-a-user-tenant)
|
||||
3
docs/index.md
Normal file
3
docs/index.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 欢迎使用 OceanBase 文档
|
||||
|
||||
OceanBase is an enterprise distributed relational database with high availability, high performance, horizontal scalability, and compatibility with SQL standards.
|
||||
10
docs/mkdocs.yml
Normal file
10
docs/mkdocs.yml
Normal file
@ -0,0 +1,10 @@
|
||||
site_name: OceanBase 手册
|
||||
repo_url: 'https://github.com/oceanbase/oceanbase'
|
||||
repo_name: 'OceanBase'
|
||||
edit_uri: 'edit/master/docs/'
|
||||
docs_dir: './'
|
||||
site_dir: '../site'
|
||||
theme:
|
||||
name: 'material'
|
||||
nav:
|
||||
- Home: 'index.md'
|
||||
10
docs/requirements.txt
Normal file
10
docs/requirements.txt
Normal file
@ -0,0 +1,10 @@
|
||||
mkdocs==1.1.2
|
||||
mkdocs-material
|
||||
mkdocs-macros-plugin
|
||||
mike
|
||||
mdx_truly_sane_lists
|
||||
mkdocs_latest_release_plugin
|
||||
mkdocs-git-revision-date-localized-plugin
|
||||
weasyprint
|
||||
mkdocs-with-pdf
|
||||
qrcode
|
||||
Reference in New Issue
Block a user