基於CentOS系統安裝OceanBase資料庫

来源:https://www.cnblogs.com/helong-123/archive/2022/04/08/16115644.html
-Advertisement-
Play Games

鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站 一、OceanBase介紹 OceanBase是由螞蟻集團完全自主研發的金融級分散式關係資料庫,始創於2010年。OceanBase具有數據強一致、高可用、高性能、線上擴展、高度相容SQL標準和主流關係資料庫、低成本等特點。 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 ~]#

本文轉自:https://blog.csdn.net/qq_45392321/article/details/123171408


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • (Java 演算法的 ACM 模式) 前言 經常在 LeetCode 上用核心代碼模式刷題的小伙伴突然用 ACM 模式可能會適應不過來,把時間花在輸入輸出上很浪費時間,因此本篇筆記對 Java 演算法的 ACM 模式做了個小總結; 除此之外,需要註意一些小細節: 1. 數字讀取到字元串讀取間需要用 in ...
  • 上篇文章對併發的理論基礎進行了回顧,主要是為什麼使用多線程、多線程會引發什麼問題及引發的原因,和怎麼使用Java中的多線程去解決這些問題。 正所謂,知其然知其所以然,這是學習一個知識遵循的原則。 推薦讀者先行查看併發編程的理論知識,以便可以絲滑入戲。 併發編程系列之一併發理論基礎 本篇文章重點在於J ...
  • 原創:微信公眾號 【阿Q說代碼】,歡迎分享,轉載請保留出處。 近期疫情形勢嚴峻,情形不容樂觀,周末也不敢出去浪了,躲在家裡“葛優躺”。閑來無事,又翻了遍Spring的源碼。不翻不知道,一翻嚇一跳,之前翻過的源碼已經吃進了肚子里,再見亦是陌生人。 個人建議:為了以後能快速的撿起某個知識點,最好的方法還 ...
  • 大家都看過電影《無間道》吧。在電影《無間道》中,劉建明(劉德華飾)作為黑幫的卧底在一次行動中發現了警察的卧底陳永仁(梁朝偉飾)與黃警督(黃秋生飾)通過摩斯電碼進行通訊,經過緊急的群發區域簡訊 “有內鬼,終止交易” 避免了黑幫頭目被抓。 通過動圖能看到黃警督和陳永仁僅通過手指的敲擊就能完成通訊,是不是 ...
  • 小二是新來的實習生,作為技術 leader,我還是很負責任的,有什麼鍋都想甩給他,啊,不,一不小心怎麼把心裡話全說出來了呢?重來! 小二是新來的實習生,作為技術 leader,我還是很負責任的,有什麼好事都想著他,這不,我就安排了一個整合SpringSecurity+JWT實現登錄認證的小任務交,沒 ...
  • 大家好,好久沒有輸出博文了,一是因為比較忙,另外一個原因是最近主要的精力是在給 AgileConfig 添加一個新的功能:服務註冊與發現。 先說說為什麼會添加這個功能。我自己的項目是用 Consul 來做為服務註冊發現組件的。自從我上線了 AgileConfig 做為配置中心後,我就很少去 Cons ...
  • 鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站 CentOS8 AnolisOS8 yum安裝失敗 今天有人反饋伺服器卡,登錄上伺服器,想看下CPU以及記憶體使用情況,覺得top看不太清晰,想使用htop,發現沒有,就想安裝一個htop,輸入命令,yum安裝 yum install htop 沒 ...
  • 互聯網發展至今,實時視頻和語音通話越來越被大眾所依賴。 今天,我們將會繼續介紹如何基於ZEGO SDK實現音視頻通話功能,前兩篇文章分別介紹了Android,Flutter平臺的實現方式,感興趣的小伙伴可點擊瞭解: [Android](https://zegoguanwang.datasink.s... ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...