重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 99|回复: 1
打印 上一主题 下一主题

使用命令行部署 OceanBase v4.5 数据库生产环境

[复制链接]
跳转到指定楼层
楼主
发表于 2026-2-20 00:55:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
使用命令行部署 OceanBase 数据库生产环境

1.环境准备

1.1.硬件
  obd   2c/8g
  observer 2c/12g X 3,内存最好是16g以上。

1.2.IP规划
  ip             用途
  192.168.133.10 obd obconfigserver prometheus granfana
  192.168.133.11 observer1 odp obagent
  192.168.133.12 observer2 odp obagent
  192.168.133.13 observer3 odp obagent

1.3.版本
  本次操作系统使用的龙蜥23.4,OB使用的v4.5

  os: anolis 23.4,操作系统可以选择最小安装
  ob: v4.5.0

1.4 系统设置
  对三个OBSERVER 机器的内核参数及资源限制进行设置


   配置资源限制
   vim /etc/security/limits.conf

   * soft nofile 655350
   * hard nofile 655350

   * soft stack unlimited
   * hard stack unlimited

   * soft core unlimited
   * hard core unlimited


   配置内核参数

   vim /etc/sysctl.conf

   vm.swappiness = 0
   vm.max_map_count = 655360
   vm.min_free_kbytes = 2097152
   vm.overcommit_memory = 0
   fs.file-max = 6573688
   fs.aio-max-nr = 1048576

   使用sysctl -p 让内核参数配置生效。

   # sysctl -p


1.5 用户建立
  在所有机器,OBD,三个OBSERVER 机器上创建安装用户admin ,可以使用root安装,但建议使用非root用户安装
   # useradd admin
   # echo ob |passwd --stdin admin

1.6 建立 data及log目录,并授权
   在三台OBSERVER机器上创建数据和日志的目录
    # mkdir -p /data /redo
    # chown -R admin:admin /data /redo


2.安装
   2.1 安装 Oceanbase ALL IN ONE 包

   选择离线安装

   下载 all in one安装包,注意,由于操作系统是最新的操作系统,all in one 安装包,要下载el8的,下载下来如下:oceanbase-all-in-one-4.5.0_20260203.el8.x86_64.tar.gz,
并上传到中控机器

   使用admin 用户解压all in one 安装包:
   su - admin
   $ tar xvf oceanbase-all-in-one-4.5.0_20260203.el8.x86_64.tar.gz

   $ cd oceanbase-all-in-one/bin
   ./install.sh

   。。。
   If you want to view detailed obd logs, please run: obd display-trace 3fbab2d8-0d70-11f1-a094-000c29d50a70

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
Quick Start (performance):      obd perf
Interactive install:            obd cluster deploy -i
Use Web Service to install:     obd web
Use Web Service to upgrade:     obd web upgrade
More Details:                   obd -h
=========================================================================================

   环境变量生效

   source ~/.oceanbase-all-in-one/bin/env.sh


  2.2 配置 OBD

  2.2.1 禁用远程仓库
   使用 obd mirror disable remote 命令完成

   [admin@obd4 bin]$ obd mirror disable remote

  2.2.2 查看禁用情况   
[admin@obd4 bin]$ obd mirror list
+---------------------------------------------------------------------------------+
|                              Mirror Repository List                             |
+--------------------------------+--------+---------+----------+------------------+
| SectionName                    | Type   | Enabled | Avaiable | Update Time      |
+--------------------------------+--------+---------+----------+------------------+
| local                          | local  | -       | True     | 2026-02-19 16:55 |
| oceanbase.community.stable.al8 | remote | False   | False    | 1970-01-01 08:00 |
| oceanbase.development-kit.al8  | remote | False   | False    | 1970-01-01 08:00 |
| oceanbase.community.stable.el  | remote | False   | False    | 1970-01-01 08:00 |
| oceanbase.development-kit.el   | remote | False   | False    | 1970-01-01 08:00 |
+--------------------------------+--------+---------+----------+------------------+

   2.2.3 将安装包添加至本地镜像库

   [admin@obd4 local]$ obd mirror clone *.rpm

   2.2.4 查看本地镜像库中安装包列表

   [admin@obd4 local]$ obd mirror list local

+---------------------------------------------------------------------------------------------------------------------+
|                                                  local Package List                                                 |
+---------------------------+-----------+------------------------+---------+------------------------------------------+
| name                      | version   | release                | arch    | md5                                      |
+---------------------------+-----------+------------------------+---------+------------------------------------------+
| alertmanager              | 0.28.1    | 32025073111.el8        | x86_64  | 13b24d72fe5296a68a9dca70193ed693f5697a5e |
| grafana                   | 7.5.17    | 1                      | x86_64  | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obagent                   | 4.2.4     | 200000022025090416.el8 | x86_64  | a1f4d48503fce2f8b07eb1af3889161c6bc4c264 |
| ob-configserver           | 1.0.0     | 2.el8                  | x86_64  | 664f93205c913d5dc84e0779d565768fd60f1d5e |
| ob-deploy                 | 4.2.0     | 1.el8                  | x86_64  | eb9188e03fab53aed739672db79f488cb2ef415b |
| obproxy-ce                | 4.3.5.0   | 3.el8                  | x86_64  | 73d0e9b4cecb53c8ba91f3ef50ac6742baa8be57 |
| ob-sysbench               | 1.0.20    | 21.el8                 | x86_64  | ae4bb45f91e434a62af366a59787bcfe6069951c |
| obtpcc                    | 5.0.0     | 1.el8                  | x86_64  | 9bb0d729187938dd66fcfdf89eb7c5e9b59b0e58 |
| obtpch                    | 3.0.0     | 1.el8                  | x86_64  | a09e5586ea25223f97169ee64acd7191610ec602 |
| oceanbase-ce              | 4.2.1.8   | 108000022024072217.el8 | x86_64  | 67cdfd029a461e9563b4ed301c661479136e58bc |
| oceanbase-ce              | 4.5.0.0   | 100000012025112711.el8 | x86_64  | 354e83c2c5a6d296aee92c5c762fd4dcee9d9ac5 |
| oceanbase-ce-libs         | 4.2.1.8   | 108000022024072217.el8 | x86_64  | b7a867b144db1900a77c50dff33018adcc523232 |
| oceanbase-ce-libs         | 4.5.0.0   | 100000012025112711.el8 | x86_64  | 9bbee841e80f1a6682b668a14ec36a38a0354bf0 |
| oceanbase-ce-utils        | 4.2.1.8   | 108000022024072217.el8 | x86_64  | 8830434f4fde3a60dcfa9308182aa7d07163bda1 |
| oceanbase-ce-utils        | 4.5.0.0   | 100000012025112711.el8 | x86_64  | f1dd0cd4a39ae6a7996539732b419d8500523e5f |
| oceanbase-diagnostic-tool | 3.7.1     | 12025102215.el8        | x86_64  | 92fb7e58edd3dd5507dfeed0e4fbc1562a50fae7 |
| ocp-agent-ce              | 4.4.0     | 20251114143405.el7     | aarch64 | 6c619c8406abb57771d26e29ea7b0f58d5fed3de |
| ocp-agent-ce              | 4.4.0     | 20251114143405.el7     | x86_64  | f8dd0ebfaa2c2f413fb3eafb922cfabde114d32f |
| ocp-server-ce             | 4.4.0     | 20251114143405.el7     | noarch  | f673d693677a2c640f925ad2127a604aaebf00bf |
| openjdk-jre               | 17.0.16_8 | 92025080421.el8        | x86_64  | 6bd4c45a7b95d55433a18f244cea182232003d50 |
| prometheus                | 2.37.1    | 10000102022110211.el8  | x86_64  | e4f8a3e784512fca75bf1b3464247d1f31542cb9 |
+---------------------------+-----------+------------------------+---------+------------------------------------------+



   2.2.5 选择配置文件

    在 ~/.oceanbase-all-in-one/obd/usr/obd/example 位置,有模板文件,我们选择 all-components.yaml作为模板文件
    cp ~/.oceanbase-all-in-one/obd/usr/obd/example/all-components.yaml ~/deploy.yaml

   2.2.6 修改配置文件
     vim deploy.yaml

user:
   username: admin
   password: ob
oceanbase-ce:
  depends:
    - ob-configserver
  servers:
    - name: server1
      ip: 192.168.133.11
    - name: server2
      ip: 192.168.133.12
    - name: server3
      ip: 192.168.133.13
  global:
    devname: ens160
    memory_limit: 10G # 使用free -g 可用的内存
    system_memory: 6G # 低于 memory_limit的75%
    datafile_size: 50G # Size of the data file.
    log_disk_size: 20G # The size of disk space used by the clog files.
    enable_syslog_wf: false
    max_syslog_file_count: 4

    appname: obcluster

    mysql_port: 2881
    rpc_port: 2882
    obshell_port: 2886
    home_path: /home/admin/observer
    data_dir: /data
    redo_dir: /redo

  server1:   
    zone: zone1
  server2:
    zone: zone2
  server3:
    zone: zone3

obproxy-ce:
  depends:
    - oceanbase-ce
    - ob-configserver
  servers:
    - name: server1
      ip: 192.168.133.11

    - name: server2
      ip: 192.168.133.12

    - name: server3
      ip: 192.168.133.13

  global:
    listen_port: 2883
    prometheus_listen_port: 2884
    home_path: /home/admin/obtest/obproxy
    enable_cluster_checkout: false
    skip_proxy_sys_private_check: true
    enable_strict_kernel_release: false
    obproxy_sys_password: ob
    observer_sys_password: ob
obagent:
  depends:
    - oceanbase-ce
  servers:
    - name: server1
      ip: 192.168.133.11
    - name: server2
      ip: 192.168.133.12
    - name: server3
      ip: 192.168.133.13
  global:
    home_path: /home/admin/obagent

prometheus:
  servers:
    - 192.168.133.10
  depends:
    - obagent
  global:
    home_path: /home/admin/prometheus
    port: 9090
    data_dir: /home/admin/prometheus/data
    basic_auth_users:  
    admin: ob  

grafana:
  servers:
    - 192.168.133.10
  depends:
    - prometheus
  global:
    home_path: /home/admin/grafana
    login_password: 'oceanbase'


  2.3 部署 OceanBase 集群

   [admin@obd4 ~]$ obd cluster deploy obtest -c deploy.yaml

    启动集群

   [admin@obd4 ~]$ obd cluster start obtest

Wait for observer init ok
+--------------------------------------------------+
|                   oceanbase-ce                   |
+----------------+---------+------+-------+--------+
| ip             | version | port | zone  | status |
+----------------+---------+------+-------+--------+
| 192.168.133.11 | 4.5.0.0 | 2881 | zone1 | ACTIVE |
| 192.168.133.12 | 4.5.0.0 | 2881 | zone2 | ACTIVE |
| 192.168.133.13 | 4.5.0.0 | 2881 | zone3 | ACTIVE |
+----------------+---------+------+-------+--------+
obclient -h192.168.133.11 -P2881 -uroot@sys -p'9Ppk3kstwd9YFfjTiOQW' -Doceanbase -A

cluster unique id: 844da582-3e09-59ae-a25d-43c59f91d5c3-19c758fe5a4-00000504

obshell program health check ok
display obshell dashboard ok
+---------------------------------------------------------------------+
|                          obshell Dashboard                          |
+----------------------------+------+------------------------+--------+
| url                        | user | password               | status |
+----------------------------+------+------------------------+--------+
| http://192.168.133.11:2886 | root | '9Ppk3kstwd9YFfjTiOQW' | active |
+----------------------------+------+------------------------+--------+

Connect to obproxy ok
+--------------------------------------------------------------------+
|                             obproxy-ce                             |
+----------------+------+-----------------+-----------------+--------+
| ip             | port | prometheus_port | rpc_listen_port | status |
+----------------+------+-----------------+-----------------+--------+
| 192.168.133.11 | 2883 | 2884            | 2885            | active |
| 192.168.133.12 | 2883 | 2884            | 2885            | active |
| 192.168.133.13 | 2883 | 2884            | 2885            | active |
+----------------+------+-----------------+-----------------+--------+
obclient -h192.168.133.11 -P2883 -uroot@proxysys -p'ob' -Doceanbase -A

Connect to Obagent ok
+-------------------------------------------------------------------+
|                              obagent                              |
+----------------+--------------------+--------------------+--------+
| ip             | mgragent_http_port | monagent_http_port | status |
+----------------+--------------------+--------------------+--------+
| 192.168.133.11 | 8089               | 8088               | active |
| 192.168.133.12 | 8089               | 8088               | active |
| 192.168.133.13 | 8089               | 8088               | active |
+----------------+--------------------+--------------------+--------+
Connect to Prometheus ok
+-------------------------------------------------------+
|                       prometheus                      |
+----------------------------+------+----------+--------+
| url                        | user | password | status |
+----------------------------+------+----------+--------+
| http://192.168.133.10:9090 |      |          | active |
+----------------------------+------+----------+--------+
Connect to grafana ok
+-----------------------------------------------------------------------+
|                                grafana                                |
+----------------------------------------+-------+-------------+--------+
| url                                    | user  | password    | status |
+----------------------------------------+-------+-------------+--------+
| http://192.168.133.10:3000/d/oceanbase | admin | 'oceanbase' | active |
+----------------------------------------+-------+-------------+--------+
obtest running
Trace ID: 495580e0-0d82-11f1-885d-000c29d50a70
If you want to view detailed obd logs, please run: obd display-trace 495580e0-0d82-11f1-885d-000c29d50a70
[admin@obd4 ~]$

  可以登录 obshell http://192.168.133.11:2886 进行查看

到此,社区版 OB基于 OBD 黑盒安装已经完成。


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2026-2-20 00:57:26 | 只看该作者
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2026-4-17 19:49 , Processed in 0.253520 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表