1. 环境介绍
centos 7.6
可用内存不少于8G
根目录可用空间不少于30G
2. 介绍
obd针对不同部署场景提供不同配置文件
谷歌浏览器:https://github.com/oceanbase/obdeploy/tree/master/example
- mini-single-example.yaml:observer单节点配置文件(最小资源配置)
- mini-single-with-obproxy-example.yaml:observer和obproxy单节点配置文件(最小资源配置)
3. 下载observer单节点配置文件:mini-single-example.yaml
[root]# cat mini-single-example.yaml
## Only need to configure when remote login is required
# user:
# username: your username
# password: your password if need
# key_file: your ssh-key file path if need
# port: your ssh port, default 22
# timeout: ssh connection timeout (second), default 30
oceanbase-ce:
servers:
# Please don't use hostname, only IP can be supported
- 192.168.1.71 # 修改为本机IP
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/observer/store
# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
# redo_dir: /data/observer/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: ens33 # 修改网卡
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: 6G # The maximum running memory for an observer
system_memory: 1G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
datafile_size: 20G # Size of the data file.
log_disk_size: 15G # The size of disk space used by the clog files.
cpu_count: 4
production_mode: false
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
提示: 根据自己的环境修改:IP、网卡、端口、zone名称、cluster_id、安装目录、data路径、redo路径、资源等。
4. 安装ob-deploy、observer、obclient
[root]# rpm -ivh obclient-2.2.2-1.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:obclient-2.2.2-1.el7 ################################# [100%]
[root]# rpm -ivh oceanbase-ce-*
Preparing... ################################# [100%]
Updating / installing...
1:oceanbase-ce-libs-4.0.0.0-1000002################################# [ 50%]
2:oceanbase-ce-4.0.0.0-100000272022################################# [100%]
[root]# rpm -ivh ob-deploy-2.0.0-10.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:ob-deploy-2.0.0-10.el7 ################################# [100%]
Installation of obd finished successfully
Please source /etc/profile.d/obd.sh to enable it
[root]# source /etc/profile.d/obd.sh
6. 部署集群
obd cluster deploy [集群名称] -c [配置文件]
[root]# obd cluster deploy obce-single -c single-observer.yaml
+--------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.1.0.0 | 100000192023032010.el7 | 8439ecf8db5e0649bd49671b41ea9e8c85756b63 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes observer work home ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository install ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository lib check !!
Try to get lib-repository
Download oceanbase-ce-libs-4.1.0.0-100000192023032010.el7.x86_64.rpm (155.18 K): 99% [######################################################################################################################################### ] ETA: 0:00:00 744.80 kB/s
Package oceanbase-ce-libs-4.1.0.0-100000192023032010.el7 is available.
install oceanbase-ce-libs-4.1.0.0 for local ok
Remote oceanbase-ce-libs-4.1.0.0-100000192023032010.el7-a83b1dd1cab44d3f610d439931322be7a08555f2 repository install ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository lib check ok
obce-single deployed
Trace ID: da1b83e6-df26-11ed-808f-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace da1b83e6-df26-11ed-808f-000c29501e19
7. 检查集群状态,status当前为“deployed”,obd cluster deploy...操作只是安装了软件和准备初始化目录
[root]# obd cluster list
+----------------------------------------------------------------+
| Cluster List |
+-------------+--------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+-------------+--------------------------------+-----------------+
| obce-single | /root/.obd/cluster/obce-single | deployed |
+-------------+--------------------------------+-----------------+
Trace ID: 8bf84a36-df27-11ed-be0f-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 8bf84a36-df27-11ed-be0f-000c29501e19
8. 查看obce-single集群组件信息,此时还看不到相关组件信息
[root]# obd cluster display obce-single
Deploy "obce-single" is deployed
See https://www.oceanbase.com/product/ob-deployer/error-codes .
Trace ID: 30ae90ae-df27-11ed-acbd-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 30ae90ae-df27-11ed-acbd-000c29501e19
9. 检查observer进程,observer进程还未运行
[root]# ps -ef | grep observer
10. 启动并初始化集群
[root]# obd cluster start obce-single
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] OBD-1012: (192.168.1.71) clog and data use the same disk (/data)
Start observer ok
observer program health check ok
Connect to observer ok
Initialize oceanbase-ce ok
Wait for observer init ok
+------------------------------------------------+
| observer |
+--------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+--------------+---------+------+-------+--------+
| 192.168.1.71 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h192.168.1.71 -P2881 -uroot -Doceanbase -A
obce-single running
Trace ID: cf7afe48-df27-11ed-9473-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace cf7afe48-df27-11ed-9473-000c29501e19
11. 再次检查observer进程,此时可以看到observer进程已经启动
[root]# ps -ef | grep observer
root 10539 1 99 11:02 ? 00:12:42 /data/observer/bin/observer -r 192.168.1.71:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /data/observer/store -i ens33 -o __min_full_resource_pool_memory=2147483648,memory_limit=6G,system_memory=1G,datafile_size=20G,log_disk_size=15G,cpu_count=4,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4
12. 再次检查集群状态,status当前为“running”
[root]# obd cluster list
+----------------------------------------------------------------+
| Cluster List |
+-------------+--------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+-------------+--------------------------------+-----------------+
| obce-single | /root/.obd/cluster/obce-single | running |
+-------------+--------------------------------+-----------------+
Trace ID: 39e7f20e-df28-11ed-b8b2-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 39e7f20e-df28-11ed-b8b2-000c29501e19
13. 再次查看obce-single集群组件信息 ,此时可以看到相关组件信息
[root]# obd cluster display obce-single
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.71 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h192.168.1.71 -P2881 -uroot -Doceanbase -A
Trace ID: a1a0c880-df28-11ed-be22-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace a1a0c880-df28-11ed-be22-000c29501e19
14. 连接oceanbase
obclient方式:
[root]# obclient -h192.168.1.71 -P2881 -uroot -Doceanbase -A -p
mysqlclient方式:
[root]# mysql -h192.168.1.71 -P2881 -uroot -Doceanbase -A -p
参考:《oceanbase社区版入门与实战.pdf》
标签:副本,ok,observer,oceanbase,obd,single,集群,root From: https://www.cnblogs.com/haha029/p/17335840.html