1.OceanBase 集合安装包下载。
OceanBase社区版一键安装包 (OceanBase All in One)
OceanBase 数据库一键离线安装包,包括数据库软件和OBD、OBProxy、OBClient、Prometheus、Grafana。
1.68中控机解压操作。
tar xvf oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz
2.查看README;
vi README.md
# What is OceanBase Database
OceanBase Database is a native distributed relational database.
It is developed entirely by Ant Group. OceanBase Database is built on a common server cluster.
Based on the Paxos protocol and its distributed structure, OceanBase Database provides high availability and linear scalability.
OceanBase Database is not dependent on specific hardware architectures.
# Packages included in this package
* ob-deploy: 1.6.2-10
* oceanbase-ce: 4.0.0.0-103000022023011215 (updated since last version)
* oceanbase-ce-libs: 4.0.0.0-103000022023011215 (updated since last version)
* obclient: 2.2.1-4
* obagent: 1.2.0-4
* obproxy-ce: 4.0.0-5
* grafana: 7.5.17-1
* prometheus: 2.37.1
# How to use this package
## Installation
run `bin/install.sh` to install obd, obclient and prepare rpm packages
## Deploy Oceanbase
* run `obd demo` to quickly start a local oceanbase cluster
* run `obd -h` for more details
3.安装OBD,OBCLIENT和安装依赖包。
中控机操作。
su - admin
cd /home/admin/oceanbase-all-in-one
[admin@observer1 oceanbase-all-in-one]$ bin/install.sh
name: grafana
version: 7.5.17
release:1
arch: x86_64
md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
add /home/admin/oceanbase-all-in-one/rpms/grafana-7.5.17-1.el7.x86_64.rpm to local mirror
name: obagent
version: 1.2.0
release:4.el7
arch: x86_64
md5: 0e8f5ee68c337ea28514c9f3f820ea546227fa7e
add /home/admin/oceanbase-all-in-one/rpms/obagent-1.2.0-4.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.0.0
release:5.el7
arch: x86_64
md5: de53232a951184fad75b15884458d85e31d2f6c3
add /home/admin/oceanbase-all-in-one/rpms/obproxy-ce-4.0.0-5.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.0.0.0
release:103000022023011215.el7
arch: x86_64
md5: 1d56dc742f5f05a2d15797d291b51a94019e728d
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-103000022023011215.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.0.0.0
release:103000022023011215.el7
arch: x86_64
md5: ef48cff7633e3dbc39f5c0abdcd72348213e09a2
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-103000022023011215.el7.x86_64.rpm to local mirror
name: prometheus
version: 2.37.1
release:10000102022110211.el7
arch: x86_64
md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
add /home/admin/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
Disable remote ok
add auto set env logic to profile: /home/admin/.bash_profile
#####################################################################
Install Finished
=====================================================================
Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh
Quick Start: obd demo
More Details: obd -h
=====================================================================
4.查看仓库的RPM列表。
--上一步安装的本地镜像地址:
[admin@obcontrol local]$ pwd
/home/admin/.obd/mirror/local
[admin@obcontrol local]$ ll
total 205088
-rw-r--r-- 1 admin admin 51953690 Mar 2 23:14 grafana-7.5.17-1.x86_64.rpm
-rw-r--r-- 1 admin admin 7149936 Mar 2 23:14 obagent-1.2.0-4.el7.x86_64.rpm
-rw-r--r-- 1 admin admin 10591224 Mar 2 23:14 obproxy-ce-4.0.0-5.el7.x86_64.rpm
-rw-r--r-- 1 admin admin 67196700 Mar 2 23:14 oceanbase-ce-4.0.0.0-103000022023011215.el7.x86_64.rpm
-rw-r--r-- 1 admin admin 158316 Mar 2 23:14 oceanbase-ce-libs-4.0.0.0-103000022023011215.el7.x86_64.rpm
-rw-r--r-- 1 admin admin 72947432 Mar 2 23:14 prometheus-2.37.1-10000102022110211.el7.x86_64.rpm
[admin@obcontrol local]$
[admin@obcontrol local]$
--查看本地镜像源。
obd mirror list local
[admin@obcontrol local]$ obd mirror list local
+----------------------------------------------------------------------------------------------------------+
| local Package List |
+-------------------+---------+------------------------+--------+------------------------------------------+
| name | version | release | arch | md5 |
+-------------------+---------+------------------------+--------+------------------------------------------+
| grafana | 7.5.17 | 1 | x86_64 | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obagent | 1.2.0 | 4.el7 | x86_64 | 0e8f5ee68c337ea28514c9f3f820ea546227fa7e |
| obproxy-ce | 4.0.0 | 5.el7 | x86_64 | de53232a951184fad75b15884458d85e31d2f6c3 |
| oceanbase-ce | 4.0.0.0 | 103000022023011215.el7 | x86_64 | 1d56dc742f5f05a2d15797d291b51a94019e728d |
| oceanbase-ce-libs | 4.0.0.0 | 103000022023011215.el7 | x86_64 | ef48cff7633e3dbc39f5c0abdcd72348213e09a2 |
| prometheus | 2.37.1 | 10000102022110211.el7 | x86_64 | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
+-------------------+---------+------------------------+--------+------------------------------------------+
--查看OBD版本
[admin@obcontrol local]$ obd --version
OceanBase Deploy: 1.6.2
REVISION: 188385cf71729311c33df8cfa2d9b059ade337fd
BUILD_BRANCH: HEAD
BUILD_TIME: Dec 14 2022 11:34:49OURCE
Copyright (C) 2021 OceanBase
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
--销毁之前安装的集群:
[admin@obcontrol .obd]$ obd cluster destroy hjzqobce
Get local repositories ok
Search plugins ok
Open ssh connection ok
Cluster status check ok
observer work dir cleaning x
[WARN] OBD-1003: Fail to clean observer1(192.168.1.61):/data
[WARN] OBD-1003: Fail to clean observer1(192.168.1.61):/redo
[WARN] OBD-1003: Fail to clean observer2(192.168.1.62):/data
[WARN] OBD-1003: Fail to clean observer2(192.168.1.62):/redo
[WARN] OBD-1003: Fail to clean observer3(192.168.1.63):/data
[WARN] OBD-1003: Fail to clean observer3(192.168.1.63):/redo
obproxy work dir cleaning ok
hjzqobce destroyed
--删除旧的集群。
[admin@obcontrol cluster]$ pwd
/home/admin/.obd/cluster
[admin@obcontrol cluster]$ rm -rf hjzqobce/
[admin@obcontrol cluster]$ obd cluster list
Local deploy is empty
--集群查看。
[admin@obcontrol cluster]$ obd cluster list
Local deploy is empty
5.参数准备
[admin@obcontrol ~]$ cat config.yaml
user:
username: admin
password: admin
key_file: /home/admin/.ssh/id_rsa.pub
port: #your ssh port, default 22
oceanbase-ce:
servers:
- name: observer1
ip: 192.168.1.61
- name: observer2
ip: 192.168.1.62
- name: observer3
ip: 192.168.1.63
global:
devname: ens33
cluster_id: 2
memory_limit: 17G # The maximum running memory for an observer
system_memory: 3G # ±£á?′? 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: 2684354560
workers_per_cpu_quota: 10
schema_history_expire_time: 1d
net_thread_count: 4
major_freeze_duty_time: Disable
minor_freeze_times: 10
enable_separate_sys_clog: 0
enable_merge_by_turn: FALSE
datafile_size: 50G
syslog_level: WARN # 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.
enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.
max_syslog_file_count: 10 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
appname: hjzqobce
root_password: rootroot # root user password, can be empty
proxyro_password: rootroot # proxyro user pasword, consistent with obproxy observer_sys_password, can be empty
observer1:
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. Database is started under this directory. This is a required field.
home_path: /home/admin/oceanbase-ce
data_dir: /data
redo_dir: /redo
zone: zone1
observer2:
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
home_path: /home/admin/oceanbase-ce
data_dir: /data
redo_dir: /redo
zone: zone2
observer3:
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
home_path: /home/admin/oceanbase-ce
data_dir: /data
redo_dir: /redo
zone: zone3
obproxy-ce:
servers:
- 192.168.1.61
- 192.168.1.62
- 192.168.1.63
depends:
- oceanbase-ce
global:
listen_port: 2883 # External port. The default value is 2883.
prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
home_path: /home/admin/oceanbase-ce
rs_list: 192.168.1.61:2881;192.168.1.62:2881;192.168.1.63:2881
enable_cluster_checkout: false
cluster_name: hjzqobce
obproxy_sys_password: rootroot # obproxy sys user password, can be empty
observer_sys_password: rootroot # proxyro user pasword,consistent with oceanbase-ce proxyro_password, can be empty
grafana:
servers:
- 192.168.1.68
global:
home_path: /home/admin/grafana
login_password: oceanbase
prometheus:
servers:
- 192.168.1.68
global:
# The working directory for prometheus. prometheus is started under this directory. This is a required field.
home_path: /home/admin/prometheus
login_password: oceanbase
6.部署集群
[admin@obcontrol ~]$ obd cluster deploy hjzqobce -c config.yaml
install oceanbase-ce-4.0.0.0 for local ok
install obproxy-ce-4.0.0 for local ok
install grafana-7.5.17 for local ok
install prometheus-2.37.1 for local ok
+--------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.0.0.0 | 103000022023011215.el7 | 1d56dc742f5f05a2d15797d291b51a94019e728d |
| obproxy-ce | 4.0.0 | 5.el7 | de53232a951184fad75b15884458d85e31d2f6c3 |
| grafana | 7.5.17 | 1 | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| prometheus | 2.37.1 | 10000102022110211.el7 | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
Initializes grafana work home ok
Initializes prometheus work home ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository install ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository lib check !!
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Try to get lib-repository
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-103000022023011215.el7-ef48cff7633e3dbc39f5c0abdcd72348213e09a2 repository install ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository lib check ok
hjzqobce deployed
7.启动集群
memory_limit 不少于16G;
--普通用户的最大进程数在这里调整。
[WARN] OBD-1007: (192.168.1.62) The recommended number of max user processes is 12288 (Current value: 4096)
vi /etc/security/limits.d/20-nproc.conf
* soft nproc 16384
root soft nproc unlimited
--启动集群:hjzqobce ;
[admin@obcontrol ~]$ obd cluster start hjzqobce
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
Check before start obproxy ok
Check before start grafana ok
Check before start prometheus ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Initialize cluster ok
Start promethues ok
prometheus program health check ok
Connect to Prometheus ok
Initialize cluster ok
Wait for observer init ok
+------------------------------------------------+
| observer |
+--------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+--------------+---------+------+-------+--------+
| 192.168.1.61 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
| 192.168.1.62 | 4.0.0.0 | 2881 | zone2 | ACTIVE |
| 192.168.1.63 | 4.0.0.0 | 2881 | zone3 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h192.168.1.61 -P2881 -uroot -prootroot -Doceanbase -A
+------------------------------------------------+
| obproxy |
+--------------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+--------------+------+-----------------+--------+
| 192.168.1.61 | 2883 | 2884 | active |
| 192.168.1.62 | 2883 | 2884 | active |
| 192.168.1.63 | 2883 | 2884 | active |
+--------------+------+-----------------+--------+
obclient -h192.168.1.61 -P2883 -uroot -prootroot -Doceanbase -A
+-------------------------------------------------------+
| grafana |
+--------------------------+-------+-----------+--------+
| url | user | password | status |
+--------------------------+-------+-----------+--------+
| http://192.168.1.68:3000 | admin | oceanbase | active |
+--------------------------+-------+-----------+--------+
+-----------------------------------------------------+
| prometheus |
+--------------------------+------+----------+--------+
| url | user | password | status |
+--------------------------+------+----------+--------+
| http://192.168.1.68:9090 | | | active |
+--------------------------+------+----------+--------+
hjzqobce running
GRAFANA登录。
http://192.168.1.68:3000
admin/oceanbase
prometheus登录
http://192.168.1.68:9090
8.登录使用。
--本地登录。
obclient -h192.168.1.61 -P2881 -uroot -prootroot -Doceanbase -A
MySQL [oceanbase]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| LBACSYS |
| mysql |
| oceanbase |
| ORAAUDITOR |
| SYS |
| test |
+--------------------+
7 rows in set (0.007 sec)
--通过OBPROXY代理登录。
obclient -h192.168.1.61 -P2883 -uroot -prootroot -Doceanbase -A
MySQL [oceanbase]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| LBACSYS |
| mysql |
| oceanbase |
| ORAAUDITOR |
| SYS |
| test |
+--------------------+
7 rows in set (0.007 sec)
9.grafana,prometheus 和集群部署在一起:68节点部署。前面已经部署成功。