OceanBase安装部署

OceanBase自动化安装部署OBD

  • 前提条件
  • [一、 OceanBase 集群部署规划](#一、 OceanBase 集群部署规划)
  • 二、安装OceanBase环境
    • [1、 方案一:若机器能联网执行如下命令在线下载并安装 all-in-one 安装包](#1、 方案一:若机器能联网执行如下命令在线下载并安装 all-in-one 安装包)
    • [2、 方案二:若机器不能联网需要在官网下载 all-in-one安装包,步骤如下:](#2、 方案二:若机器不能联网需要在官网下载 all-in-one安装包,步骤如下:)
  • 三、OBD部署单节点集群
    • [1、编辑 OBD 配置文件](#1、编辑 OBD 配置文件)

前提条件

官方给出硬件条件需要满足以下要求

Red Hat Enterprise Linux 8 64 位

下载链接:https://pan.baidu.com/s/1rZ39xJFhk0HdmC4wEJcxvg

提取码:c01x

本文操作系为:CentOS7

一、 OceanBase 集群部署规划

1、创建用户

OceanBase数据库可以在任何用户下运行。该软件包的默认解压目录位于 /home/admin/ 。为了安全起见,我们将其安装在 admin 用户下。

  1. 使用以下命令新建用户:
powershell 复制代码
 useradd admin
  1. 给用户admin赋予root权限
    使用以下命令进入相关配置文件并进行修改,示例如下图:
powershell 复制代码
  vi /etc/sudoers

2、规划目录

参数或目录 备注
observer部署/启动目录 /home/admin/oceanbase RPM包自动创建
observer数据总目录 /home/admin/oceanbase/store/obdemo 手动创建
observer数据文件实际目录 /data/obdemo/sstable 手动创建,通过软链接映射到数据总目录下
observer事务日志实际目录 /redo/obdemo/{clog,slog,ilog} 手动创建,通过软链接映射到数据总目录下
observer参数文件目录 /home/admin/oceanbase/etc 启动时在启动目录自动创建或自动读取
observer运行日志目录 /home/admin/oceanbase/log 启动时在启动目录自动创建

创建命令如下:

powershell 复制代码
 sudo mkdir -p /home/admin/oceanbase/store/obdemo /data/obdemo/sstable /redo/obdemo/{clog,slog,ilog}
powershell 复制代码
sudo ln -s /data/obdemo/sstable /home/admin/oceanbase/store/obdemo/sstable
powershell 复制代码
sudo ln -s /redo/obdemo/slog /home/admin/oceanbase/store/obdemo/slog
powershell 复制代码
 sudo ln -s /redo/obdemo/clog /home/admin/oceanbase/store/obdemo/clog
powershell 复制代码
 sudo ln -s /redo/obdemo/ilog /home/admin/oceanbase/store/obdemo/ilog
powershell 复制代码
echo 'export LD_LIBRARY_PATH=\SLD_LIBRARY_PAT:~/oceanbase/lib'>> ~/.bash_profile

设置文件所有者

xml 复制代码
sudo chown -R admin.admin /data /redo

查看目录结构:

powershell 复制代码
tree oceanbase/ /data/ /redo/

二、安装OceanBase环境

1、 方案一:若机器能联网执行如下命令在线下载并安装 all-in-one 安装包

powershell 复制代码
bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"

执行完成后显示 Install Finished

然后在执行如下命令设置环境变量

powershell 复制代码
source ~/.oceanbase-all-in-one/bin/env.sh

2、 方案二:若机器不能联网需要在官网下载 all-in-one安装包,步骤如下:

(1)进入https://open.oceanbase.com/quickStart下载

(2)上传至虚拟机适当位置(这里我使用的是ssh客户端)

(3)进入其存放目录进行解压并安装

解压命令如下:

powershell 复制代码
tar -xzf oceanbase-all-in-one-*.tar.gz

解压后进入其bin目录下:

powershell 复制代码
 cd oceanbase-all-in-one/bin/

执行 ./install.sh进行安装

安装成功后执行source ~/.oceanbase-all-in-one/bin/env.sh,安装环境

示例如下:

bash 复制代码
[admin@localhost ~]$ ls
mini-single-with-obproxy-example.yaml  oceanbase  oceanbase-all-in-one-4.2.1.0-100120231013145059.el7.x86_64.tar.gz
[admin@localhost ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
[admin@localhost ~]$ cd oceanbase-all-in-one/bin/
[admin@localhost 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: 4.2.0
release:3.el7
arch: x86_64
md5: 30793df12dc6b8ec5ccdc93262e5e9f1d51ed50a
add /home/admin/oceanbase-all-in-one/rpms/obagent-4.2.0-3.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.2.1.0
release:11.el7
arch: x86_64
md5: 0aed4b782120e4248b749f67be3d2cc82cdcb70d
add /home/admin/oceanbase-all-in-one/rpms/obproxy-ce-4.2.1.0-11.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.2.1.0
release:100000102023092807.el7
arch: x86_64
md5: a8b9979de1f2809d74de71b2a536cff8aab15bff
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-4.2.1.0-100000102023092807.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.2.1.0
release:100000102023092807.el7
arch: x86_64
md5: c440e2a7f36297521a108c2316ef0e35ce1251f7
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.2.1.0-100000102023092807.el7.x86_64.rpm to local mirror
name: ocp-express
version: 4.2.0
release:100000042023073111.el7
arch: x86_64
md5: ccec08112a29067633797d20685b6e6d70e890d9
add /home/admin/oceanbase-all-in-one/rpms/ocp-express-4.2.0-100000042023073111.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
Trace ID: cd8397b2-748c-11ee-a969-000c2911f467
If you want to view detailed obd logs, please run: obd display-trace cd8397b2-748c-11ee-a969-000c2911f467
Disable remote ok
Trace ID: d00fd7de-748c-11ee-a6eb-000c2911f467
If you want to view detailed obd logs, please run: obd display-trace d00fd7de-748c-11ee-a6eb-000c2911f467

add auto set env logic to profile: /home/admin/.bash_profile

#####################################################################
 Install Finished
=====================================================================
Setup Environment:     source ~/.oceanbase-all-in-one/bin/env.sh
Start Web Service:     obd web
Quick Start:           obd demo
More Details:          obd -h
=====================================================================
[admin@localhost bin]$ source ~/.oceanbase-all-in-one/bin/env.sh
[admin@localhost bin]$

(4)确认OBD是否安装成功

三、OBD部署单节点集群

1、编辑 OBD 配置文件

(1)部署单节点 observer 和 obproxy 进程,需要在官网下载配置文件
https://github.com/oceanbase/obdeploy/blob/master/example/mini-single-with-obproxy-example.yaml

(2)按照自己的设置编辑配置文件

xml 复制代码
## Only need to configure when remote login is required
user:
  username: admin
  password: 112424wjw
#   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.66.110
  global:
    #  The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
    home_path: /home/admin/oceanbase-ce
    # 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: 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: 2G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
    datafile_size: 2G # Size of the data file. 
    datafile_next: 2G # the auto extend step. Please enter an capacity, such as 2G
    datafile_maxsize: 20G # the auto extend max size. Please enter an capacity, such as 20G
    log_disk_size: 13G # The size of disk space used by the clog files.
    cpu_count: 16
    production_mode: false
    syslog_level: WARN 
    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: root # root user password, can be empty
    proxyro_password: root # proxyro user pasword, consistent with obproxy's observer_sys_password, can be empty
obproxy-ce:
  # 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.66.110
  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. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
    rs_list: 192.168.66.110: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
    enable_strict_kernel_release: false
    # 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.
  1. 部署集群
    使用如下命令部署集群
xml 复制代码
obd cluster deploy obcluster -c single-with-obproxy.yaml

报上图中所示错误原因:配置文件中的 user 用户(未填的情况下默认为当前用户)没有对应目录的写权限。可修改配置文件解决。

待其执行结束如下图所示:

  1. 部署结果
    使用命令 obd cluster list 查看部署状态
  2. 启动和初始化集群
xml 复制代码
 obd cluster stop obcluster
相关推荐
daqinzl2 分钟前
java获取机器ip、mac
java·mac·ip
激流丶17 分钟前
【Kafka 实战】如何解决Kafka Topic数量过多带来的性能问题?
java·大数据·kafka·topic
Themberfue21 分钟前
Java多线程详解⑤(全程干货!!!)线程安全问题 || 锁 || synchronized
java·开发语言·线程·多线程·synchronized·
时差95336 分钟前
【面试题】Hive 查询:如何查找用户连续三天登录的记录
大数据·数据库·hive·sql·面试·database
让学习成为一种生活方式38 分钟前
R包下载太慢安装中止的解决策略-R语言003
java·数据库·r语言
晨曦_子画43 分钟前
编程语言之战:AI 之后的 Kotlin 与 Java
android·java·开发语言·人工智能·kotlin
秋意钟1 小时前
MySQL日期类型选择建议
数据库·mysql
南宫生1 小时前
贪心算法习题其三【力扣】【算法学习day.20】
java·数据结构·学习·算法·leetcode·贪心算法
Heavydrink1 小时前
HTTP动词与状态码
java
ktkiko111 小时前
Java中的远程方法调用——RPC详解
java·开发语言·rpc