接我上一篇笔记:https://www.modb.pro/db/193823 OceanBase社区版搭建笔记-单副本,我们搭建继续学习一个服务器搭建三副本+单obproxy,
因为我是基于上次搭建单副本的那台服务器,所以我要先删除掉原ob集群。
1、停止单节点集群
obd cluster stop obce-single
2、销毁单节点集群
obd cluster destroy obce-single
3、重新安装obd和obd的本地库
由于已经销毁了obd,需要重新安装obd
Root用户:rpm -ivh ob-deploy-1.1.2-1.el7.x86_64.rpm
Admin用户依次执行:
source /etc/profile.d/obd.sh
rm -rf ~/.obd/mirror/remote/OceanBase.repo
obd mirror clone ./*.rpm
4、编辑三节点和obproxy的yaml文件,请见文章最后
5、创建ob集群
obd cluster deploy obce-3zones -c
threezone.yaml
此处提示警告需要libmariadb.so,但是没有终止,不知道有什么影响。
6、启动ob集群
报错,提示[ERROR] (10.251.19.65) / not enough disk space for clog. Use `redo_dir`
to set other disk for clog, or reduce the value of `datafile_size`
下图是我的磁盘情况
我是用的是 / 的挂载目录。总共283G剩余113G,datafile_size是一个比例,我本地是3个节点,因此需要重新计算datafile_size的大小,官方建议重新挂载分区,这样比较简洁明了,因为我是在客户现场偷偷借用的服务器,就不重新挂载了,
datafile_disk_percentage=113G(剩余内存)/3(节点个数)/280G(总硬盘大小)=10%
此时修改应该修改如下目录的配置文件,不应该再修改配置ob集群的那个配置文件了
vi /home/admin/.obd/cluster/obce-3zones
继续安装,还是报错
[WARN] failed to start obce01(10.251.19.65)
observer
[WARN] failed to start obce02(10.251.19.65)
observer
[WARN] failed to start obce03(10.251.19.65)
observer
[ERROR] oceanbase-ce start failed
查看日志,日志路径在如下路径
Vi /home/admin/.odb/log/odb
admin@10.251.19.65 execute: cat
/home/admin/oceanbase-ce1/run/observer.pid
exited code 1, error output:
cat: /home/admin/oceanbase-ce1/run/observer.pid:
No such file or directory
因为observer还没有启动,所以肯定也没有pid文件,但是没有别错误提示,还是得从参数配置入手在检查一下。毕竟官网也说可能是那些内存啊、硬盘大小的设置问题
把datafile_size修改成10G以后可以了。。。,看来我上面不使用datafile_size, 使用一个公式计算出来的datafile_disk_percentage有点打脸
继续重新启动,我们看到已经启动成功了。
7、通过obproxy连接ob
8、附录我的集群配置文件
oceanbase-ce:
servers:
- name: obce01
# Please don't use hostname, only IP can be supported
ip: 10.251.19.65
- name: obce02
ip: 10.251.19.65
- name: obce03
ip: 10.251.19.65
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: ens192
cluster_id: 2
# please set memory limit to a suitable value which is matching
resource.
memory_limit: 8G # The maximum running memory for an observer
system_memory: 3G # The reserved system memory. 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: 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: 3 # 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.
datafile_size: 10G
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. 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: 10 # 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: obce-3zones
root_password: 0EI5N08d # root user password, can be empty
proxyro_password: uY7Yf8zx # proxyro user pasword, consistent with
obproxy's observer_sys_password, can be empty
obce01:
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.
# The working directory for
OceanBase Database. OceanBase Database is started under this directory. This
is a required field.
home_path: /home/admin/oceanbase-ce1
# The directory for data storage. The default value is
$home_path/store.
data_dir: /data1
# The directory for clog, ilog, and slog. The default value is the
same as the data_dir value.
redo_dir: /redo1
zone: zone1
obce02:
mysql_port: 3881 # External port for OceanBase Database. The default
value is 2881.
rpc_port: 3882 # Internal port for OceanBase Database. The default
value is 2882.
# The working directory for
OceanBase Database. OceanBase Database is started under this directory. This
is a required field.
home_path: /home/admin/oceanbase-ce2
# The directory for data storage. The default value is
$home_path/store.
data_dir: /data2
# The directory for clog, ilog, and slog. The default value is the
same as the data_dir value.
redo_dir: /redo2
zone: zone2
obce03:
mysql_port: 4881 # External port for OceanBase Database. The default
value is 2881.
rpc_port: 4882 # Internal port for OceanBase Database. The default
value is 2882.
# The working directory for
OceanBase Database. OceanBase Database is started under this directory. This
is a required field.
home_path: /home/admin/oceanbase-ce3
# The directory for data storage. The default value is
$home_path/store.
data_dir: /data3
# The directory for clog, ilog, and slog. The default value is the
same as the data_dir value.
redo_dir: /redo3
zone: zone3 obproxy:
servers:
- 10.251.19.65 #
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
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/obproxy
# oceanbase root server list
# format: ip:mysql_port;ip:mysql_port
rs_list: 10.251.19.65:2881;10.251.19.65:3881;10.251.19.65:4881
enable_cluster_checkout: false
# observer cluster name, consistent with oceanbase-ce's appname
cluster_name: obce-3zones
obproxy_sys_password: 0MdTv1tm # obproxy sys user password, can be
empty
observer_sys_password: uY7Yf8zx # proxyro user pasword, consistent
with oceanbase-ce's proxyro_password, can be empty |