Docker安裝部署分布式數據庫?OceanBase的詳細過程
前言
快速的體驗 OceanBase 的 自動化部署過程,以及了解 OceanBase 集群安裝成功后的目錄特點和使用方法
?? 1.什么是OceanBase
OceanBase是由螞蟻集團完全自主研發(fā)的國產原生分布式數據庫 ,始創(chuàng)于2010年。已連續(xù)9年平穩(wěn)支撐雙11, 創(chuàng)新推出“三地五中心”城市級容災新標準 ,是一個在TPC-C和TPC-H測試上都刷新了世界紀錄的國產原生分布式數據庫。 產品采用自研的一體化架構,兼顧分布式架構的擴展性與集中式架構的性能優(yōu)勢,用一套引擎同時支持TP和AP的混合負載, 具有數據強一致、高可用、高性能、在線擴展、高度兼容SQL標準和主流關系數據庫、低成本等特點。
?? 2.硬件要求
1.有筆記本或服務器,內存至少12G 。
2.操作系統不限,能安裝 Docker 環(huán)境即可。
Docker 官方鏡像:https://hub.docker.com/r/obpilot/oceanbase-ce
?? 3.docker部署OceanBase
? 3.1 下載ob docker鏡像
?????? 下載鏡像:
docker pull obpilot/oceanbase-ce:latest
? 3.2 創(chuàng)建容器
?????? 新容器創(chuàng)建
docker run -itd -m 10G -p 2881:2881 -p 2883:2883
–name oceanbase-ce obpilot/oceanbase-ce:latest
?????? 進入容器
[root@jeames ~]# docker exec -it oceanbase-ce bash
進入容器后,可以看看 readme.md 文檔
? 3.3 obd工具查看集群及啟動
-- 查看集群列表 [admin@3ef732cfb95a ~]$ obd cluster list 配置文件:/home/admin/.obd/cluster/obdemo/config.yaml
-- 啟動集群 [admin@3ef732cfb95a ~]$ obd cluster start obdemo 如果遇到以下兩個報錯 [ERROR] (127.0.0.1) open files number must not be less than 20000 (Current value: 1024) [ERROR] (127.0.0.1) not enough memory. (Free: 6.7G, Need: 8.0G) 一個是用戶最大打開文件數不夠,一個是可用內存不足8G,解決后成功啟動。
[admin@3ef732cfb95a ~]$ obd cluster list +------------------------------------------------------------+ | Cluster List | +--------+---------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +--------+---------------------------------+-----------------+ | obdemo | /home/admin/.obd/cluster/obdemo | running | +--------+---------------------------------+-----------------+ [admin@3ef732cfb95a ~]$ netstat -tulnp | grep 88 tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 95/observer tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 95/observer tcp 0 0 0.0.0.0:2883 0.0.0.0:* LISTEN 714/obproxy tcp 0 0 0.0.0.0:2884 0.0.0.0:* LISTEN 714/obproxy
? 3.4 登錄ob數據庫并創(chuàng)建租戶
admin 用戶的密碼是 : adminPWD123
[admin@3ef732cfb95a ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05) 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 [oceanbase]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | SYS | | LBACSYS | | ORAAUDITOR | | test | +--------------------+ 7 rows in set (0.014 sec)
?????? 創(chuàng)建資源單元、資源池、租戶
MySQL [oceanbase]> CREATE resource unit S4C1G max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G'; MySQL [oceanbase]> CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1; MySQL [oceanbase]> create tenant obmysql resource_pool_list=('my_pool'), primary_zone='RANDOM',comment 'mysql tenant/instance', charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';
? 3.5 登錄obmysql tenant并創(chuàng)建數據庫及表等
[admin@3ef732cfb95a ~]$ obclient -h 127.1 -uroot@obmysql#obce-single -P2883 -p -c -A test Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05) 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 [test]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | test | +--------------------+ 4 rows in set (0.005 sec) MySQL [test]> create database mesdb charset utf8mb4; Query OK, 1 row affected (0.118 sec) MySQL [test]> use mesdb Database changed MySQL [mesdb]> MySQL [mesdb]> MySQL [mesdb]> MySQL [mesdb]> source /tmp/mysql_employees.sql
到此這篇關于Docker安裝部署分布式數據庫 OceanBase的文章就介紹到這了,更多相關Docker安裝OceanBase內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Dockerfile中yum install無法使用的問題及解決
在使用Dockerfile自定義CentOS 7容器過程中,可能會遇到容器內無法使用yum命令的問題,首先,確認主機是否能聯網,其次,檢查在Dockerfile打包新容器時,容器是否能聯網,若發(fā)現容器無法聯網,一種解決方法是編輯/etc/docker/daemon.json文件2024-11-11Docker buildx構建多平臺鏡像并推送到私有倉庫的方法
這篇文章主要介紹了Docker buildx構建多平臺鏡像并推送到私有倉庫,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-01-01從零搭建docker+jenkins+node.js自動化部署環(huán)境的方法
這篇文章主要介紹了從零搭建docker+jenkins+node.js自動化部署環(huán)境的方法,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-01-01