---
title: "快速体验 OceanBase | OceanBase 文档中心"
description: 快速体验 OceanBase OceanBase 数据库支持部署在 x86_64 以及 ARM_64 架构的物理服务器和主流的虚拟机。 OceanBase 数据库支持单副本部署，并且单副本 OceanBase 集群还可以扩容（增加节点），所以也称为集群。本节主要介绍在普通的物理服务器上通过使用 RPM 包安装单副本 …
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 4.0.0 企业版

# 快速体验 OceanBase

更新时间：2026-03-14 08:32:11

OceanBase 数据库支持部署在 x86_64 以及 ARM_64 架构的物理服务器和主流的虚拟机。 OceanBase 数据库支持单副本部署，并且单副本 OceanBase 集群还可以扩容（增加节点），所以也称为集群。本节主要介绍在普通的物理服务器上通过使用 RPM 包安装单副本 OceanBase 集群。

有关 OceanBase 集群部署的详细信息，请参见 [部署简介](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881188)。

## 部署环境准备

1. 服务器架构及 Linux 操作系统版本要求。

   支持在下表所示的 Linux 操作系统中安装 OceanBase 数据库。

   | Linux操作系统 | 版本 | 服务器架构 |
   | --- | --- | --- |
   | AliOS | 7.2 及以上 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | 龙蜥 AnolisOS | 8.6 及以上 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | KylinOS | V10 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | 统信 UOS | V20 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | 中科方德 NFSChina | 4.0 及以上 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | 浪潮 Inspur kos | 5.8 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
   | CentOS / Red Hat Enterprise Linux | 7.2 及以上   > **说明**   > 暂不支持 CentOS 8.X。 | x86_64（包括海光），ARM_64（鲲鹏、飞腾） |
 2. 服务器配置。

   服务器配置至少是 CPU 4 Core，内存 16 GB。
 3. 安装包准备。

   准备 OceanBase 数据库独立版（Antman）RPM 包、OceanBase 4.0 RPM 包和 OBClient RPM 包。

   | 文件名 | 版本 | 说明 |
   | --- | --- | --- |
   | t-oceanbase-*.rpm | 最新版本 | 为 OBServer 提供标准化操作系统配置的能力，请联系技术支持获取最新 Antman 数据库安装包。 |
   | oceanbase-*.rpm | 4.0.0.0 | OceanBase 软件 RPM 文件，部署 OceanBase 集群时用。 |
   | obclient-*.rpm | 1.2.6 | 命令行客户端 obclient 的 RPM 文件，连接 ORACLE 实例必需有。 |

   > **说明**
   >
   >  
   >
   > 请联系技术支持获取对应安装包。
 4. 磁盘规划。

   默认情况下，使用 `/data/1` 作为数据目录，`/data/log1` 作为日志目录，`/home` 作为 OceanBase 数据库的安装目录。

   创建 `/data/1` 和 `/data/log1` 目录，并把目录的拥有者（Owner）改为 admin。

   ```bash
   [root@xxx /]# mkdir -p /data/1 /data/log1
   [root@xxx /]# cd data
   [root@xxx data]# ll
   total 8
   drwxr-xr-x 2 root root 4096 Nov 18 14:24 1
   drwxr-xr-x 2 root root 4096 Nov 18 14:24 log1
   [root@xxx data]# cd ..
   [root@xxx /]# chown -R admin:admin data
   [root@xxx /]# cd data
   [root@xxx data]# ll
   total 8
   drwxr-xr-x 2 admin admin 4096 Nov 18 14:24 1
   drwxr-xr-x 2 admin admin 4096 Nov 18 14:24 log1

   ```

## 部署 OceanBase 集群

1. 将 OceanBase 数据库独立版（Antman）RPM 包、OceanBase 数据库 4.0 RPM 包和 OBClient RPM 包复制到要安装 OceanBase 数据库 4.0 的服务器。
 2. 安装 Antman。

   使用 root 用户登录该机器，执行以下命令，安装 Antman。

   ```shell
   [root@hostname /]# rpm -ivh t-oceanbase-antman-x.x.x-xxxxxxxxxxxx.alios7.x86_64.rpm

   ```

   安装 Antman 的详细信息，请参见 [安装 oat-cli](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881621)。
 3. 添加 admin 用户。

   observer 进程运行在 `admin` 用户下，相关目录的所有者必须是 `admin` 用户。

   ```shell
   [root@hostname /]# cd /root/t-oceanbase-antman/clonescripts
   [root@hostname clonescripts]# ./clone.sh -u

   ```

   > **说明**
   >
   >  
   >
   > 如果已有 `admin` 组和 `admin` 用户，但 `uid/gid` 不是 500，建议删掉后利用上述脚本重新创建。
 4. 修改操作系统内核配置。

   执行以下命令，对每台 OBServer 服务器进行设置。

   ```shell
   [root@hostname /]# cd /root/t-oceanbase-antman/clonescripts
   [root@hostname clonescripts]# ./clone.sh -c -r ob

   ```
 5. 安装依赖包。

   在 OBServer 服务器执行以下命令，安装依赖包。

   ```shell
   [root@hostname /]# cd /root/t-oceanbase-antman/clonescripts
   [root@hostname clonescripts]# ./clone.sh -m -r ob

   ```
 6. 安装 OceanBase 数据库 RPM 包。

   示例如下：

   ```shell
   [root@hostname /]# rpm -ivh oceanbase-4.0.0.0-100000152022092610.el7.x86_64.rpm
   Preparing...                          ################################# [100%]
   Updating / installing...
   1:oceanbase-4.0.0.0-100000152022092################################# [100%]

   ```
 7. 安装 OceanBase 数据库客户端 OBClient。

   OBClient 是 OceanBase 数据库命令行客户端，可以访问 OceanBase 数据库的 MySQL 租户和 Oracle 租户。

   示例如下：

   ```shell
   [root@hostname /]# rpm -ivh obclient-1.2.6-20210510164331.el7.alios7.x86_64.rpm
   Preparing...                          ################################# [100%]
   Updating / installing...
   1:obclient-1.2.6-20210510164331.el7################################# [100%]

   ```

   核查 OBClient 是否安装成功。

   ```shell
   [root@hostname /]# which obclient
   /usr/bin/obclient

   ```
 8. 初始化 OceanBase 目录。

   OceanBase 数据库的数据目录通常建议在独立的磁盘上，然后通过软链接方式链接到软件 Home 目录下面。其中 `$cluster_name` 为集群名。

   先切换到 admin 用户。

   ```shell
   [root@hostname /]# su - admin

   ```

   初始化 OceanBase 目录。

   ```shell
   -bash-4.2$ mkdir -p /data/1/$cluster_name/{etc3,sort_dir,sstable,slog}
   -bash-4.2$ mkdir -p /data/log1/$cluster_name/{clog,etc2,ilog,oob_clog}
   -bash-4.2$ mkdir -p /home/admin/oceanbase/store/$cluster_name
   -bash-4.2$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; done
   -bash-4.2$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; done

   ```

   示例如下，集群名为 `obdemo`：

   ```shell
   -bash-4.2$ mkdir -p /data/1/obdemo/{etc3,sort_dir,sstable,slog}
   -bash-4.2$ mkdir -p /data/log1/obdemo/{clog,etc2,ilog,oob_clog}
   -bash-4.2$ mkdir -p /home/admin/oceanbase/store/obdemo
   -bash-4.2$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; done
   -bash-4.2$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; done

   ```
 9. 启动 observer 进程。

   示例如下：

   > **说明**
   >
   >  
   >
   > 示例 IP 做了脱敏处理，这不是安装需求。在部署时应根据自己机器真实 IP 填写。

   ```

   启动 observer 进程。

   ```shell
   -bash-4.2$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -i eth0 -P 2882 -p 2881 -z zone1 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.1:2882:2881' -c 10001 -n obdemo -o "system_memory=16G,datafile_size=100G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"
   -bash-4.2$ sleep 5
   -bash-4.2$ ps -ef|grep observer

   ```
 10. 集群 bootstrap 操作。

    > **说明**
    >
    >  
    >    - 示例 IP 做了脱敏处理，这不是安装需求。在部署时应根据自己机器真实 IP 填写。
    >    - 通过 obclient 命令连接已启动的 observer 进程，密码为空。

    ```sql
    [root@hostname /]# obclient -h127.0.0.1 -uroot@sys -P2881 -p
    Enter password:

    obclient> SET SESSION ob_query_timeout=1000000000;
    Query OK, 0 rows affected

    obclient> ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '10.10.10.1:2882';
    Query OK, 0 rows affected

    ```
 11. 验证集群初始化成功。

    进行 bootstrap 后，执行 `SHOW DATABASES;` 命令，能看到数据库列表里有 oceanbase 即可。

    ```sql
    obclient> SHOW DATABASES;
    +--------------------+
    | Database           |
    +--------------------+
    | oceanbase          |
    | information_schema |
    | mysql              |
    | SYS                |
    | LBACSYS            |
    | ORAAUDITOR         |
    | test               |
    +--------------------+
    7 rows in set

    ```

## 创建普通租户

OceanBase 集群部署完成后，数据库中默认创建 sys 租户。此后可以根据业务需要使用 sys 租户新建普通租户。

创建普通租户的详细信息，请参见 [创建租户](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881617)。

## 连接 OceanBase 数据库

连接 OceanBase 数据库的方式，这里命令行推荐使用 OceanBase 数据库客户端（OBClient） 即 OceanBase 数据库专用的命令行客户端工具，白屏推荐 OceanBase 开发者中心（OceanBase Developer Center，ODC）。

- 使用 OBClient 连接 OceanBase 数据库，请参见 [通过 OBClient 连接 OceanBase 租户](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881348)。
 - 使用 ODC 连接数据库，请参见 [通过 OBClient 连接 OceanBase 租户](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881349)。

连接 OceanBase 数据库更多详情，请参见 [连接方式概述](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000881346)。

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
