练习目的
本次练习目的掌握 OceanBase 集群的自动化部署(OBD工具)技术,能自动部署OB集群,包含 OBProxy,以及部署 OBAgent 等。
练习条件
- 有 服务器,内存资源至少 12G3台 或者 32G1台
练习内容
请记录并分享下列内容:
-
(必选)部署 OBD 软件,在线都可以。
-
(必选)使用 OBD 部署一套三副本集群 单机3节点 部署至少1个 OBProxy
-
(必选)部署至少一个 OBAgent 。
目录我都放到 cm
mkdir /cm
1、在线安装OBD
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install -y ob-deploy
2 、编辑ymal文件 (非常重要)
## Only need to configure when remote login is required
## 这里的目录不需要mkdir 创建
user:
username: root
password: '123456'
key_file: /root/.ssh/id_rsa.pub
# port: your ssh port, default 22
# timeout: ssh connection timeout (second), default 30
oceanbase-ce:
servers:
- name: server1
# Please don't use hostname, only IP can be supported
ip: 192.168.237.132
- name: server2
ip: 192.168.237.132
- name: server3
ip: 192.168.237.132
global:
# 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 #这里是网卡的名字
cluster_id: 1
# please set memory limit to a suitable value which is matching resource.
emory_limit: 4G # The maximum running memory for an observer
system_memory: 2G # 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: 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
major_freeze_duty_time: Disable
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.
# observer cluster name, consistent with obproxy's cluster_name
appname: obcluster
root_password: 123456 # root user password, can be empty
# proxyro_password:123456 # proxyro user pasword, consistent with obproxy's observer_sys_password, can be empty
server1:
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.
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /cm/observer/1
# The directory for data storage. The default value is $home_path/store.
# data_dir: /cm/data/1
# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
# redo_dir: /cm/redo/1
zone: zone1
server2:
mysql_port: 3881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
rpc_port: 3882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /cm/observer/2
# The directory for data storage. The default value is $home_path/store.
# data_dir: /cm/data/2
# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
# redo_dir: /cm/redo/2
zone: zone2
server3:
mysql_port: 4881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
rpc_port: 4882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /cm/observer/3
# The directory for data storage. The default value is $home_path/store.
# data_dir: /cm/data/3
# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
# redo_dir: /cm/redo/3
zone: zone3
obproxy:
# Set dependent components for the component.
# When the associated configurations are not done, OBD will automatically get the these configurations from the dependent components.
depends:
- oceanbase-ce
servers:
- 192.168.237.132
global:
listen_port: 5883 # External port. The default value is 2883.
prometheus_listen_port: 5884 # The Prometheus port. The default value is 2884.
home_path: /cm/obproxy/ocean
# oceanbase root server list
# format: ip:mysql_port;ip:mysql_port. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
# rs_list: 192.168.1.2:2881;192.168.1.3:2881;192.168.1.4:2881
enable_cluster_checkout: false
# observer cluster name, consistent with oceanbase-ce's appname. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
cluster_name: obcluster
skip_proxy_sys_private_check: true
# obproxy_sys_password: # obproxy sys user password, can be empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
# observer_sys_password: # proxyro user pasword, consistent with oceanbase-ce's proxyro_password, can be empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
3、初始化副本
obd cluster deploy obce-single(集群名字) -c obce.yaml(脚本名字)
4、启动及初始化集群
obd cluster list
+------------------------------------------------------------+
| Cluster List |
+-----------+------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+-----------+------------------------------+-----------------+
| obcluster | /root/.obd/cluster/obcluster | running |
+-----------+------------------------------+-----------------+
obd cluster start obce
5、检查集群状态
obd cluster display obce
6、安装obclient客户端
rpm -ivh obclient-2.0.0-2.el7.x86_64.rpm libobclient-2.0.0-2.el7.x86_64.rpm