【OceanBase】基于CentOS系统安装OceanBase数据库

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 【OceanBase】基于CentOS系统安装OceanBase数据库

二、OceanBase介绍

OceanBase是由蚂蚁集团完全自主研发的金融级分布式关系数据库,始创于2010年。OceanBase具有数据强一致、高可用、高性能、在线扩展、高度兼容SQL标准和主流关系数据库、低成本等特点。

OceanBase 社区版是一款开源分布式 HTAP(Hybrid Transactional/Analytical Processing)数据库管理系统,具有原生分布式架构,支持金融级高可用、透明水平扩展、分布式事务、多租户和语法兼容等企业级特性。OceanBase 内核通过大规模商用场景的考验,已服务众多行业客户,现面向未来持续构建内核技术竞争力。


三、OceanBase安装操作

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

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


安装前期准备

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

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

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


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
[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 ~]#

或者

离线安装 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

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


3、部署 OceanBase 数据库

运行以下命令部署集群

obd cluster deploy <deploy_name> -c <deploy_config_file> -A

[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 ~]# 

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 ~]#

5、连接OceanBase数据库

安装OceanBase数据库客户端 OBClient

# yum install -y obclient
[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 ~]#

使用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

切换使用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)]>

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 |
+-----------+---------+------+-------+--------+

四、安装过程中的报错信息

磁盘空间不足,至少所需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

网卡名称错误❌,本机安装使用的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 ~]#

提示所需的系统内存不足,需要提升内存大小。(推荐内存大小在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 ~]#
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
3天前
|
关系型数据库 MySQL 数据库
实时计算 Flink版产品使用合集之支持将数据写入 OceanBase 数据库吗
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
23 5
|
5天前
|
关系型数据库 Apache 流计算
手把手教你实现 OceanBase 数据到阿里云数据库 SelectDB 内核版 Apache Doris 的便捷迁移|实用指南
本文介绍了如何将数据从 OceanBase 迁移到阿里云数据库 SelectDB 内核版 Apache Doris。提供 3 种数据同步方法 1. 使用 DataX,下载 DataX 并编写配置文件,通过 OceanBaseReader 和 DorisWriter 进行数据迁移。 2. 利用 Apache Doris 的 Catalog功 能,将 OceanBase 表映射到 Doris 并插入数据。 3. 通过Flink CDC,设置 OceanBase 环境,配置 Flink 连接器,实现实时数据同步。
手把手教你实现 OceanBase 数据到阿里云数据库 SelectDB 内核版 Apache Doris 的便捷迁移|实用指南
|
5天前
|
SQL 关系型数据库 数据库
OceanBase数据库常见问题之录入租户管理员密码时,提示密码检验失败如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
5天前
|
存储 SQL 关系型数据库
OceanBase数据库常见问题之部署时提示需要ocp但是我已经安过了如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
5天前
|
存储 关系型数据库 数据处理
OceanBase数据库常见问题之start ob出错如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
5天前
|
SQL 关系型数据库 数据库
OceanBase数据库常见问题之密码输入错误次数多被锁了如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
5天前
|
存储 运维 物联网
【专栏】OceanBase 是一款先进的分布式数据库系统,以其分布式架构、高扩展性、高可用性和强一致性特点,应对大规模数据处理挑战
【4月更文挑战第29天】OceanBase 是一款先进的分布式数据库系统,以其分布式架构、高扩展性、高可用性和强一致性特点,应对大规模数据处理挑战。它支持混合负载,适用于金融、电商和物联网等领域,提供高性能、低成本的解决方案。尽管面临技术复杂性、数据迁移和性能优化等问题,通过合理策略可克服挑战。随着技术发展,OceanBase 在数字化时代将持续发挥关键作用。
|
5天前
|
关系型数据库 MySQL Linux
Centos7安装mariadb数据库
该文介绍了如何在CentOS7上安装MariaDB数据库。MariaDB是MySQL的开源分支,旨在保持与MySQL的兼容性。安装过程包括配置yum源,执行安装命令,启动数据库服务,并设置开机启动。首次启动时,数据库未设置密码,用户可直接回车。
72 0
|
5天前
|
前端开发 关系型数据库 MySQL
OceanBase数据库常见问题之bootstrap时报错如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
5天前
|
监控 关系型数据库 数据库
OceanBase数据库常见问题之增加内存依旧报内存不足如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。

热门文章

最新文章