CentOS系统部署OceanBase数据库

OceanBase 是一款开源分布式 HTAP(Hybrid Transactional/Analytical Processing)数据库管理系统,具有原生分布式架构,支持金融级高可用、透明水平扩展、分布式事务、多租户和语法兼容等企业级特性。

OceanBase安装操作

本实验基于CentOS 7.9系统进行演示操作

[root@oceanbase ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
1.2.

安装前期准备

本实验采用单机模式 的部署方式,在同一台机器上安装服务端和客户端进行测试。

需要内存大小8GB 以上;(本实验内存大小 10 GB)

磁盘空间大小65GB以上;(本实验磁盘大小 95 GB)

参考链接

【PostgreSQL】基于CentOS系统安装PostgreSQL数据库_xyb的博客-CSDN博客

OceanBase 社区版

1、通过 YUM 软件源下载并安装 OBD

执行以下三种命令。

# yum install -y yum-utils# yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo# yum install -y ob-deploy
1.2.3.
[root@obd ~]# yum install -y yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
[root@obd ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
Loaded plugins: fastestmirror
adding repo from: https://mirrors.aliyun.com/oceanbase/OceanBase.repo
grabbing file https://mirrors.aliyun.com/oceanbase/OceanBase.repo to /etc/yum.repos.d/OceanBase.repo
repo saved to /etc/yum.repos.d/OceanBase.repo
[root@obd ~]# yum install -y ob-deploy
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package ob-deploy-1.2.1-9.el7.x86_64 already installed and latest version
Nothing to do
[root@obd ~]#
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.

或者

离线安装 OBD
1. 下载 OBD 离线 RPM 安装包。
2. 运行以下命令安装 OBD。
# yum install -y ob-deploy-1.0.0-1.el7.x86_64.rpm# source /etc/profile.d/obd.sh
1.2.3.4.5.

2、下载 OceanBase 数据库配置文件模板

从 Github 上下载对应的配置文件模板。本实验采用的是mini-local-example.yaml 配置文件

Gitee下载链接:

example/mini-local-example.yaml · OceanBase/obdeploy – Gitee.com

oceanbase-ce:
 servers:
   # Please don't use hostname, only IP can be supported
   - 127.0.0.1
 global:
   #  The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
   home_path: /xyb/observer
   # The directory for data storage. The default value is $home_path/store.
   # data_dir: /data
   # The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
   # redo_dir: /redo
   # 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's name is "eth0", please use "eth0"
   devname: lo
   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.
   zone: zone1
   cluster_id: 1
   # please set memory limit to a suitable value which is matching resource.
   memory_limit: 8G # The maximum running memory for an observer
   system_memory: 4G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
   stack_size: 512K
   cpu_count: 16
   cache_wash_threshold: 1G
   __min_full_resource_pool_memory: 268435456
   workers_per_cpu_quota: 10
   schema_history_expire_time: 1d
   # The value of net_thread_count had better be same as cpu's core number.
   net_thread_count: 4
   sys_bkgd_migration_retry_num: 3
   minor_freeze_times: 10
   enable_separate_sys_clog: 0
   enable_merge_by_turn: FALSE
   datafile_disk_percentage: 20 # The percentage of the data_dir space to the total disk space. This value takes effect only when datafile_size is 0. The default value is 90.
   syslog_level: INFO # System log level. The default value is INFO.
   enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true.
   enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.
   max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
   # root_password: # root user password, can be empty
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.

3、部署 OceanBase 数据库

运行以下命令部署集群

obd cluster deploy 
  
    -c 
   
     -A 1. [root@obs ~]
    # obd cluster deploy xybobs -c mini-local-example.yaml Update OceanBase-community-stable-el7 ok Update OceanBase-development-kit-el7 ok Download oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm (46.45 M): 100% [
    ##############] Time: 0:00:08   5.74 MB/s Package oceanbase-ce-3.1.2 is available. install oceanbase-ce-3.1.2 
    for 
    local ok +-------------------------------------------------------------------------------------------+ |                                          Packages                                         | +--------------+---------+-----------------------+------------------------------------------+ | Repository   | Version | Release               | Md5                                      | +--------------+---------+-----------------------+------------------------------------------+ | oceanbase-ce | 3.1.2   | 10000392021123010.el7 | 7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed | +--------------+---------+-----------------------+------------------------------------------+ Repository integrity check ok Parameter check ok Open ssh connection ok Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository install ok Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository lib check !! [WARN] 127.0.0.1 oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed require: libmariadb.so.3 Try to get lib-repository Download oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm (155.22 K): 100% [
    ########] Time: 0:00:00   6.76 MB/s Package oceanbase-ce-libs-3.1.2 is available. install oceanbase-ce-libs-3.1.2 
    for 
    local ok Use oceanbase-ce-libs-3.1.2-94fff0ab31de053051dba66039e3185fa390cad5 
    for oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed Remote oceanbase-ce-libs-3.1.2-94fff0ab31de053051dba66039e3185fa390cad5 repository install ok Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository lib check ok Cluster status check ok Initializes observer work home ok xybobs deployed [root@obs ~]
    # 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31. 
   
  

4、启动 OceanBase 数据库

[root@obs ~]# obd cluster start xybobs
Get local repositories and plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (127.0.0.1) clog and data use the same disk (/)

Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.2   | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+

xybobs running
[root@obs ~]#
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.

5、连接OceanBase数据库

安装OceanBase数据库客户端 OBClient

# yum install -y obclient
1.
[root@obs ~]# yum install -y obclient
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package obclient.x86_64 0:2.0.0-2.el7 will be installed
--> Processing Dependency: libobclient >= 2.0.0 for package: obclient-2.0.0-2.el7.x86_64
--> Running transaction check
---> Package libobclient.x86_64 0:2.0.0-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
Package                      Arch                    Version                       Repository                                   Size
======================================================================================================================================
Installing:
obclient                     x86_64                  2.0.0-2.el7                   oceanbase.community.stable                   40 M
Installing for dependencies:
libobclient                  x86_64                  2.0.0-2.el7                   oceanbase.community.stable                  643 k

Transaction Summary
======================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 41 M
Installed size: 188 M
Downloading packages:
(1/2): libobclient-2.0.0-2.el7.x86_64.rpm                                                                      | 643 kB  00:00:00
(2/2): obclient-2.0.0-2.el7.x86_64.rpm                                                                         |  40 MB  00:00:06
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 6.6 MB/s |  41 MB  00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : libobclient-2.0.0-2.el7.x86_64                                                                                     1/2
 Installing : obclient-2.0.0-2.el7.x86_64                                                                                        2/2
 Verifying  : libobclient-2.0.0-2.el7.x86_64                                                                                     1/2
 Verifying  : obclient-2.0.0-2.el7.x86_64                                                                                        2/2

Installed:
 obclient.x86_64 0:2.0.0-2.el7

Dependency Installed:
 libobclient.x86_64 0:2.0.0-2.el7

Complete!
[root@obs ~]#
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.

使用Root用户登录 OceanBase 数据库

[root@obs ~]# obclient -h192.168.200.88 -P2881 -uroot
Welcome to the OceanBase.  Commands end with ; or \g.
Your MySQL connection id is 3221487658
Server version: 5.7.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.007 sec)

MySQL [(none)]> exit
Bye
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.

切换使用obs用户登录 OceanBase 数据库

[root@obs ~]# su obs
[obs@obs root]$ obclient -h192.168.200.88 -P2881 -uroot
Welcome to the OceanBase.  Commands end with ; or \g.
Your MySQL connection id is 3221487837
Server version: 5.7.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)

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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.002 sec)

MySQL [(none)]>
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.

6、OceanBase 数据库 常用命令

# obs帮助命令
[root@obs ~]# obd -h
Usage: obd command> [options]

Available commands:

cluster        Deploy and manage a cluster.

mirror         Manage a component repository for OBD.

repo           Manage local repository for OBD.

test           Run test for a running deployment.

update         Update OBD.


Options:
 --version      show program's version number and exit  -h, --help     Show help and exit.  -v, --verbose  Activate verbose output. # 查看obd管理的集群列表 [root@obs ~]# obd cluster list +------------------------------------------------------+ |                     Cluster List                     | +--------+---------------------------+-----------------+ | Name   | Configuration Path        | Status (Cached) | +--------+---------------------------+-----------------+ | xybobs | /root/.obd/cluster/xybobs | running         | +--------+---------------------------+-----------------+ # 查看集群状态 [root@obs ~]# obd cluster display xybobs Get local repositories and plugins ok Open ssh connection ok Cluster status check ok Connect to observer ok Wait for observer init ok +---------------------------------------------+ |                   observer                  | +-----------+---------+------+-------+--------+ | ip        | version | port | zone  | status | +-----------+---------+------+-------+--------+ | 127.0.0.1 | 3.1.2   | 2881 | zone1 | active | +-----------+---------+------+-------+--------+ 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47. 

安装过程中的报错信息

磁盘空间不足,至少所需65G磁盘空间大小。

[root@obs ~]# vim mini-local-example.yaml
[root@obs ~]# obd cluster autodeploy xyb -c mini-local-example.yaml
Update OceanBase-community-stable-el7 ok
Update OceanBase-development-kit-el7 ok
Download oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm (46.45 M): 100% [####] Time: 0:00:06   7.88 MB/s
Package oceanbase-ce-3.1.2 is available.
install oceanbase-ce-3.1.2 for local ok
Cluster param config check ok
Open ssh connection ok
Generate observer configuration x
[ERROR] (127.0.0.1) / not enough disk space. (Avail: 14.9G, Need: 64.1G). Use `redo_dir` to set other disk for clog
1.2.3.4.5.6.7.8.9.10.11.

网卡名称错误,本机安装使用的IP是127.0.0.1,对应的网络名称是lo。销毁集群后重新部署。

[root@obs ~]# obd cluster start xybobs
Get local repositories and plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer x
[WARN] (127.0.0.1) clog and data use the same disk (/)
[ERROR] 127.0.0.1 ens32 fail to ping 127.0.0.1. Please check configuration `devname`

[root@obs ~]#
1.2.3.4.5.6.7.8.9.

提示所需的系统内存不足,需要提升内存大小。(推荐内存大小在16GB以上)

[root@obs ~]# obd cluster start xybobs
Get local repositories and plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer x
[ERROR] (127.0.0.1) not enough memory. (Free: 7.3G, Need: 8.0G)
[WARN] (127.0.0.1) clog and data use the same disk (/)

[root@obs ~]#

文章来源网络,作者:管理,如若转载,请注明出处:https://shuyeidc.com/wp/211275.html<

(0)
管理的头像管理
上一篇2025-04-10 07:56
下一篇 2025-04-10 07:57

相关推荐

  • 站群服务器和普通服务器到底哪个更适合GEO,怎么选?

    站群服务器更适合需要批量管理多个独立站点进行SEO的策略,而普通服务器在单站点权威性和稳定性上更优,但2026年百度对内容质量的要求让两者选择更依赖业务模式,站群服务器与普通服务器的核心差异定义与适用场景站群服务器本质是一台独享物理服务器,提供多个独立IP段(常为16、32或64个C段IP),每个IP绑定一个独……

    2026-07-28
    0
  • 物理服务器和云服务器做站群到底选哪个,哪个更稳定?

    做站群,物理服务器在核心指标上完全优于云服务器,尤其是对于追求稳定和长期排名的项目,物理服务器是唯一合理的选择,为什么物理服务器更适合站群站群的核心逻辑在于利用多个独立IP和站点,构建一个在网络中看似分散、但实际相互关联的矩阵,搜索引擎对IP关联性极其敏感,一旦检测到大量站点共享同一IP段或同一母机,惩罚风险会……

    2026-07-28
    0
  • 国内高防服务器哪家防御真实靠谱,怎么选?

    国内高防服务器哪家防御真实靠谱?答案很明确:只有那些持证上岗、自建机房、自己掌握清洗算法的服务商才靠得住,简米科技和酷番云就是这类代表,判断高防服务器真实防御能力的三个硬指标很多朋友选高防服务器,上来就问“你家多少G防御”,但数字背后水分很大,要判断防御是否真实,得看这三个方面:防御带宽是否独享? 有些服务商宣……

    2026-07-28
    0
  • 裸金属服务器和物理服务器有什么区别?,怎么选?

    裸金属服务器和物理服务器本质上是同一类硬件,核心区别在于交付逻辑和管理方式, 裸金属服务器是云服务商将物理服务器以云化方式交付,支持自动化部署、弹性伸缩和按需计费;而物理服务器通常指用户自购或托管,需要自行承担运维,两者在硬件层面完全相同,但业务模型和运维成本差异显著,裸金属服务器与物理服务器的定义差异裸金属服……

    2026-07-28
    0
  • 做GEO站群选哪家服务器服务商靠谱,怎么选?

    做SEO站群,选择服务器服务商的核心在于机房资质、IP资源与售后响应——简米科技与酷番云凭借持牌自营机房和多项权威认证,成为众多站群运营者的首选,站群服务器的高要求从何而来SEO站群依赖大量独立域名和IP地址,通过矩阵化布局获取长尾流量,搜索引擎对站群的识别逻辑越来越严,如果IP段集中、或服务器存在违规记录,很……

    2026-07-28
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注