在centos三臺機器上部署oceanbase叢集步驟
oceanbase環境介紹:
192.168.1.4
192.168.1.3
192.168.1.5
配置三臺機器免密:
# 生成金鑰對
# ssh-keygen -t rsa
# 複製免登公鑰到其它目標機器,修改user和ip
# ssh-copy-id root@{ip}
輸入密碼
最終確保三臺機器之間ssh不需要輸入密碼
登入其中一臺機器192.168.1.4
# mkdir -p /data/oceanbase
# cd /data/oceanbase
#### 資料庫配置檔案模板
# cat local-example.yaml
oceanbase-ce:
servers:
# Please don't use hostname, only IP can be supported
- 192.168.1.4
- 192.168.1.3
- 192.168.1.5
global:
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /data/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: p8p1
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: 8
cache_wash_threshold: 1G
__min_full_resource_pool_memory: 268435456
workers_per_cpu_quota: 8
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
部署 OceanBase 資料庫
# obd cluster deploy ob_test -c local-example.yaml -A
oceanbase-ce-3.1.4 already installed.
+-------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+-----------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+-----------------------+------------------------------------------+
| oceanbase-ce | 3.1.4 | 10000092022071511.el7 | c5cd94f4f190317b6a883c58a26460a506205ce6 |
+--------------+---------+-----------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes observer work home ok
Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repository install ok
Send /root/.obd/repository/oceanbase-ce/3.1.4/c5cd94f4f190317b6a883c58a26460a506205ce6/etc to /root/.obd/repository/oceanbase-ce/3.1.4/c5cd94f4f190317b6a883c58a26460a506205ce6/etc ok
Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check !!
Try to get lib-repository
oceanbase-ce-libs-3.1.4 already installed.
Remote oceanbase-ce-libs-3.1.4-10000092022071511.el7-6d5437b0cad486b55963f89b8ef3769af7995350 repository install ok
Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check ok
ob_test deployed
啟動 OceanBase 資料庫:
# obd cluster start ob_test
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (192.168.1.4) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] (192.168.1.4) clog and data use the same disk (/data)
[WARN] (192.168.1.3) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] (192.168.1.3) clog and data use the same disk (/data)
[WARN] (192.168.1.5) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] (192.168.1.5) clog and data use the same disk (/)
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap \
Cluster bootstrap |
Cluster bootstrap ok
Create tenant test ok
Wait for observer init ok
+-------------------------------------------------+
| observer |
+---------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+---------------+---------+------+-------+--------+
| 192.168.1.3 | 3.1.4 | 2881 | zone1 | active |
| 192.168.1.4 | 3.1.4 | 2881 | zone1 | active |
| 192.168.1.5 | 3.1.4 | 2881 | zone1 | active |
+---------------+---------+------+-------+--------+
ob_test running
三臺機器上分別安裝OceanBase資料庫客戶端 OBClient
# yum install -y obclient
連線OceanBase資料庫(其中任何一臺皆可)
# obclient -h192.168.1.3 -P2881 -uroot
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221749761
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
+--------------------+
7 rows in set (0.092 sec)
obclient [(none)]> use test
Database changed
obclient [test]> show tables;
Empty set (0.005 sec)
obclient [test]> create table test(id int primary key,name varchar(10));
Query OK, 0 rows affected (0.502 sec)
obclient [test]> insert into test values(1,"zhangsan");
Query OK, 1 row affected (0.133 sec)
obclient [test]> insert into test values(2,"lisi");
Query OK, 1 row affected (0.023 sec)
obclient [test]> insert into test values(3,"wangwu");
Query OK, 1 row affected (0.023 sec)
obclient [test]> insert into test values(4,"chenfeng");
Query OK, 1 row affected (0.030 sec)
obclient [test]> insert into test values(5,"liujing");
Query OK, 1 row affected (0.021 sec)
obclient [test]> insert into test values(6,"huangshan");
Query OK, 1 row affected (0.102 sec)
obclient [test]> select * from test;
+----+-----------+
| id | name |
+----+-----------+
| 1 | zhangsan |
| 2 | lisi |
| 3 | wangwu |
| 4 | chenfeng |
| 5 | liujing |
| 6 | huangshan |
+----+-----------+
6 rows in set (0.028 sec)
obclient [test]>
連線其他機器上的oceanbase:
# obclient -h192.168.1.5 -P2881 -uroot
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3222012104
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [(none)]> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
obclient [test]> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test |
+----------------+
1 row in set (0.002 sec)
檢視剛剛建立的表:
obclient [test]> select * from test;
+----+-----------+
| id | name |
+----+-----------+
| 1 | zhangsan |
| 2 | lisi |
| 3 | wangwu |
| 4 | chenfeng |
| 5 | liujing |
| 6 | huangshan |
+----+-----------+
6 rows in set (0.021 sec)
obclient [test]> \q
##obd命令幫助
# 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管理的叢集列表:
# obd cluster list
+--------------------------------------------------------+
| Cluster List |
+---------+----------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+---------+----------------------------+-----------------+
| ob_test | /root/.obd/cluster/ob_test | running |
| test | /root/.obd/cluster/test | configured |
+---------+----------------------------+-----------------+
檢視叢集狀態
# obd cluster display ob_test
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 |
+---------------+---------+------+-------+--------+
| 192.168.1.3 | 3.1.4 | 2881 | zone1 | active |
| 192.168.1.4 | 3.1.4 | 2881 | zone1 | active |
| 192.168.1.5 | 3.1.4 | 2881 | zone1 | active |
+---------------+---------+------+-------+--------+
### obd clustern命令幫助
# obd cluster --help
Usage: obd cluster <command> [options]
Available commands:
autodeploy Deploy a cluster automatically by using a simple configuration file.
check4ocp Check Whether OCP Can Take Over Configurations in Use
chst Change Deployment Configuration Style
deploy Deploy a cluster by using the current deploy configuration or a deploy yaml file.
destroy Destroy a deployed cluster.
display Display the information for a cluster.
edit-config Edit the configuration file for a specific deployment.
list List all the deployments.
redeploy Redeploy a started cluster.
reinstall Reinstall a deployed component
reload Reload a started cluster.
restart Restart a started cluster.
start Start a deployed cluster.
stop Stop a started cluster.
tenant Create or drop a tenant.
upgrade Upgrade a cluster.
Options:
-h, --help Show help and exit.
-v, --verbose Activate verbose output.
銷燬一個叢集:
# obd cluster destroy ob_test
Get local repositories ok
Search plugins ok
Open ssh connection ok
Cluster status check ok
observer work dir cleaning ok
ob_test destroyed
OceanBase 部署中遇到的相關報錯:
一.[ERROR] lo fail to ping . Please check configuration `devname`
解決方法:
修改local-example.yaml配置檔案裡devname: p8p1,此處要求三臺伺服器的網路卡名稱必須一致,否則會報如上錯。
二.[ERROR] Cluster NTP is out of sync
解決方法:
oceanbase需要用到ntp服務來同步每臺機器的伺服器時間,需要分別啟動三臺機器的ntp服務:
# systemctl start ntpd
檢視ntp服務狀態:
# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
Active: active (running) since 四 2022-08-25 14:22:29 CST; 21s ago
Process: 26162 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 26163 (ntpd)
Tasks: 1
Memory: 1.4M
CGroup: /system.slice/ntpd.service
└─26163 /usr/sbin/ntpd -u ntp:ntp -g
8月 25 14:22:29 test3 ntpd[26163]: Listen normally on 2 lo 127.0.0.1 UDP 123
8月 25 14:22:29 test3 ntpd[26163]: Listen normally on 3 p8p1 192.168.1.4 UDP 123
8月 25 14:22:29 test3 ntpd[26163]: Listen normally on 4 docker0 172.17.0.1 UDP 123
8月 25 14:22:29 test3 ntpd[26163]: Listen normally on 5 lo ::1 UDP 123
8月 25 14:22:29 test3 ntpd[26163]: Listen normally on 6 p8p1 fe80::edcf:9cb5:2fbe:d875 UDP 123
8月 25 14:22:29 test3 ntpd[26163]: Listening on routing socket on fd #23 for interface updates
8月 25 14:22:29 test3 ntpd[26163]: 0.0.0.0 c016 06 restart
8月 25 14:22:29 test3 ntpd[26163]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
8月 25 14:22:29 test3 ntpd[26163]: 0.0.0.0 c011 01 freq_not_set
8月 25 14:22:37 test3 ntpd[26163]: 0.0.0.0 c614 04 freq_mode
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2912004/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在centos7上用PXD方式部署PolarDB-X叢集步驟CentOS
- greenplum 6.9 for centos7叢集搭建步驟CentOS
- Ubuntu上搭建Hadoop叢集環境的步驟UbuntuHadoop
- 在CentOS7環境下部署weblogic叢集CentOSWeb
- CentOS部署ElasticSearch7.6.1叢集CentOSElasticsearch
- TDengine 叢集 多機器docker 部署Docker
- centos7 hadoop3.2.0分散式叢集搭建步驟CentOSHadoop分散式
- 使用 Terraform 在 AWS 上快速部署 MQTT 叢集ORMMQQT
- 使用 Terraform 在阿里雲上快速部署 MQTT 叢集ORM阿里MQQT
- Kubernetes — 在 OpenStack 上使用 kubeadm 部署高可用叢集
- redis Cluster模式叢集 多機器 docker 部署Redis模式Docker
- Centos7部署Redis叢集CentOSRedis
- 在華為雲 OSC 上快速部署 EMQX MQTT 叢集MQQT
- Oceanbase 4.0 三節點叢集x86平臺安裝實踐
- 在 Azure 上部署 Kubernetes 叢集
- 在kubernetes上部署consul叢集
- CentOS 6.5下ZooKeeper3.4.6叢集環境部署及單機部署詳解CentOS
- 如何在CentOS上建立Kubernetes叢集CentOS
- 在 Azure AKS 上部署 EMQX MQTT 伺服器叢集MQQT伺服器
- 使用虛擬機器在CentOS上安裝部署資料庫使用虛擬機CentOS資料庫
- 使用虛擬機器在3臺centos7系統安裝docker和k8s叢集虛擬機CentOSDockerK8S
- PostgreSQL-HA 高可用叢集在 Rainbond 上的部署方案SQLAI
- VMware 虛擬機器安裝CentOS映象詳細步驟虛擬機CentOS
- 在linux伺服器上搭建slurm叢集部署Linux伺服器
- 【ASK_ORACLE】Relink RAC叢集詳細步驟Oracle
- GBase 8a 叢集修改 IP 地址操作步驟
- 在 Azure 中部署 Kubernetes 容器叢集
- 在阿里雲 ACK 上部署 EMQX MQTT 伺服器叢集阿里MQQT伺服器
- CentOS 7上安裝WordPress詳細步驟CentOS
- 節點加入k8s 叢集的步驟K8S
- DKHhadoop叢集新增節點管理功能的操作步驟Hadoop
- NoSQL之Redis叢集搭建——6臺伺服器,三臺主伺服器,三臺從伺服器SQLRedis伺服器
- 【Linux合集】單機部署zk叢集Linux
- 在 AWS EKS 上部署 EMQX MQTT 叢集MQQT
- 在Rainbond上部署高可用Apollo叢集AI
- 容器化 | 在 KubeSphere 中部署 MySQL 叢集MySql
- 教你在Kubernetes中快速部署ES叢集
- 使用虛擬機器在CentOS上安裝部署openGauss資料庫指導虛擬機CentOS資料庫