首页 > 系统相关 >Centos 7 系统 OceanBase 4.0 社区版三副本集群安装部署指南

Centos 7 系统 OceanBase 4.0 社区版三副本集群安装部署指南

时间:2024-12-10 15:00:54浏览次数:10  
标签:10.110 ok 4.0 Centos OceanBase 0.0 oceanbase -- admin

==========================================
 
现供职于某上市互联网公司担任DBA
Oracle & PG ACE称号,
拥有 Oracle OCM、AWS、以及部分国产数据库等产品认证。
喜欢技术分享,热爱交友,也热爱健身。
墨天轮社区 MVP
OceanBase、PG中国分会、IvorySQL等南京地区组织者,也是TeckTalk技术交流社区创始人。


个人微信公众号: 尚雷的驿站
可微信公众号搜索 : 尚雷的驿站
==========================================

一、前言

本次部署OceanBase 4.0 社区版集群作为测试学习环境,通过一台服务器部署OBD作为中控机,通过该中控机部署三副本集群环境。

如部署生产环境请参照OceanBase官网服务器配置需求。

二、环境准备

1.1 服务器列表

选择其中一台服务器部署OBD中控机和obclient客户端,另外三台服务器用来部署OBServer和OBProxy。

服务器IP操作系统服务器配置角色备注
10.110.3.155Centos 7.94 CPU/ 8GOBD中控机,自动化部署软件
10.110.3.152Centos 7.94 CPU/ 12GOBServerOceanBase 数据库 zone1
10.110.3.153Centos 7.94 CPU/ 12GOBServerOceanBase 数据库 zone2
10.110.3.154Centos 7.94 CPU/ 12GOBServerOceanBase 数据库 zone3
10.110.3.152Centos 7.94 CPU/ 12GOBProxyOceanBase 访问反向代理
10.110.3.153Centos 7.94 CPU/ 12GOBProxyOceanBase 访问反向代理
10.110.3.154Centos 7.94 CPU/ 12GOBProxyOceanBase 访问反向代理
10.110.3.155Centos 7.94 CPU/ 8GOBClientOceanBase 命令行客户端

1.2、软硬件需求

1.2.1 软件资源需求
操作系统安装包下载地址
Anolis 7、CentOS 7、RedHat 7、Ubuntu 20.X、Debian 9.X、Anolis OS 8.Xhttps://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/
Anolis 8、CentOS 8、RedHat 8、Debian 10 、Anolis OS 8.Xhttps://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/

1.2.2 硬件资源需求
项目描述
系统Anolis OS 8.X 版本(内核 Linux 3.10.0 版本及以上)-- 推荐Red Hat Enterprise Linux Server 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上) – 推荐CentOS Linux 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上) – 推荐Debian 9.X 版本及以上版本 (内核 Linux 3.10.0 版本及以上)Ubuntu 20.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)SUSE / OpenSUSE 15.X 版本及以上版本(内核 Linux 3.10.0 版本及以上) --推荐
物理 CPU测试环境最低要求 2 核。生产环境最低要求 4 核,推荐 32 核及以上。性能测试场景推荐 24 核及以上。
内存测试环境最低要求 8 G。生产环境最低要求 16 G,长期使用要求不低于 32 G,推荐 256 G 及以上。性能测试场景推荐 128 G 及以上。注意 当部署多个集群时, 推荐使用 OCP 进行统一运维管理, 当部署集群比较少时, 建议使用 OBD 进行安装部署。
磁盘类型推荐使用 SSD
磁盘存储空间内存大小的 6 倍及以上
文件系统EXT4 戓 XFS,当数据超过 16T 时,使用 XFS
网卡千兆互联及以上

1.3 操作系统配置

1.3.1 查看操作系统内核
-- 【每个OB节点都应保持相同内核版本】
[root@oceanbase-dbx ~]# uname -r
3.10.0-1160.76.1.el7.x86_64
-- OceanBase 数据库要求操作系统为 3.10.0 及以上。
1.3.2 关闭禁用透明大页
-- root用户 【每个OB节点都需操作】
[root@oceanbase-dbx ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@oceanbase-dbx ~]# cat /sys/kernel/mm/transparent_hugepage/enabled         
always madvise [never]
1.3.3 查看内存
-- 每个OB节点内存不应低于官网内存需求
[root@oceanbase-dbx ~]# free -g
1.3.4 查看磁盘
-- 每个OB节点磁盘不应低于官网磁盘需求
[root@oceanbase-dbx ~]# df -h
1.3.5 配置limits.conf
-- root用户,每台observer服务器都要执行,在每台/etc/security/limits.conf文件末尾填写如下内容
root soft nofile 655350
root hard nofile 655350
* soft nofile 655350
* hard nofile 655350
* soft stack 20480
* hard stack 20480
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
1.3.6 配置sysctl.conf
-- root用户,每台observer服务器都要执行,在每台/etc/sysctl.conf 文件末尾填写如下内容
# for oceanbase
## 修改内核异步 I/O 限制
fs.aio-max-nr=1048576
​
## 网络优化
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 10000 
net.core.rmem_default = 16777216 
net.core.wmem_default = 16777216 
net.core.rmem_max = 16777216 
net.core.wmem_max = 16777216
​
net.ipv4.ip_local_port_range = 3500 65535 
net.ipv4.ip_forward = 0 
net.ipv4.conf.default.rp_filter = 1 
net.ipv4.conf.default.accept_source_route = 0 
net.ipv4.tcp_syncookies = 0 
net.ipv4.tcp_rmem = 4096 87380 16777216 
net.ipv4.tcp_wmem = 4096 65536 16777216 
net.ipv4.tcp_max_syn_backlog = 16384 
net.ipv4.tcp_fin_timeout = 15 
net.ipv4.tcp_max_syn_backlog = 16384 
net.ipv4.tcp_tw_reuse = 1 
net.ipv4.tcp_tw_recycle = 1 
net.ipv4.tcp_slow_start_after_idle=0
​
vm.swappiness = 0
vm.min_free_kbytes = 2097152
​
# 此处为 OceanBase 数据库的 data 目录
kernel.core_pattern = /data/core-%e-%p-%t
​
-- root用户,每台observer服务器都要执行,生效/etc/sysctl.conf配置
[root@oceanbase-dbxxx ~]# sysctl -p 
1.3.7 关闭防火墙
-- root用户,每台服务器都要执行
-- 关闭防火墙
systemctl stop firewalld.service
-- 永久关闭防火墙
systemctl disable firewalld.service
-- 查看防火墙状态
systemctl status firewalld.service
1.3.8 关闭SELinux
-- root用户,每台服务器都要执行
sed -i  "s/SELINUX=enforcing/SELINUX=disabled/"  /etc/selinux/config
cat /etc/selinux/config
1.3.9 配置NTP服务
1) 中控机服务器
-- root用户,中控机服务器操作如下
-- yum 安装 ntp服务
[root@obproxy-node ~]# yum install ntp ntpdate -y
-- 启动服务
[root@obproxy-node ~]# systemctl start ntpd
-- 设置服务自启
[root@obproxy-node ~]# systemctl enable ntpd
-- 查看ntp状态
[root@obproxy-node ~]# systemctl status ntpd
-- 配置NTP服务端/etc/ntp.conf 文件
-- 编辑/etc/ntp.conf 文件,添加如下内容
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
restrict 10.110.3.0 mask 255.255.255.0 nomodify notrap
-- 重启ntp服务
[root@obproxy-node ~]# systemctl restart ntpd
-- 查看ntp服务
[root@obproxy-node ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-a.chl.la        131.188.3.222    2 u  319 1024  275  275.417    6.935   3.770
+pingless.com    36.224.68.195    2 u  478 1024  377  328.498   -2.550   2.018
+ntp6.flashdance 192.36.143.130   2 u 1322 1024  376  276.299    1.376  23.159
*119.28.183.184  100.122.36.196   2 u  122 1024  277   50.314   -1.267   4.023
​
2)Observer服务器
-- root用户,每台Observer服务器都需执行
-- yum 安装 ntp服务
[root@oceanbase-dbxxx ~]# yum install ntp ntpdate -y
-- 启动服务
[root@oceanbase-dbxxx ~]# systemctl start ntpd
-- 设置服务自启
[root@oceanbase-dbxxx ~]# systemctl enable ntpd
-- 查看ntp状态
[root@oceanbase-dbxxx ~]# systemctl status ntpd
-- 配置客户端/etc/ntp.conf配置文件,每台Observer服务器都需操作
-- 编辑/etc/ntp.conf 文件,添加如下内容
server 10.110.3.155 iburst
-- 重启ntp服务
[root@oceanbase-dbxxx ~]# systemctl restart ntpd
-- 查看ntp服务
[root@oceanbase-dbxxx ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*obproxy-node    119.28.183.184   3 u  115 1024  377    0.307    3.360   2.080
1.3.10 创建用户
-- root用户,每个 ob节点
/usr/sbin/groupadd -g 1001 admin
/usr/sbin/useradd -u 1002 -g admin -G admin admin
echo "admin" | passwd --stdin admin
1.3.11 配置sudo
-- root用户,每个 ob节点
[root@oceanbase-db1 ~]# visudo
-- 添加 
admin    ALL=(ALL)      NOPASSWD: ALL
1.3.12 创建目录
-- root用户 每个 ob节点 
-- 因为本次测试环境未添加多余磁盘,选择将/data 和 /redo都放在 / 根目录下,生产环境不建议此方式
[root@oceanbase-dbx ~]# mkdir -p /data
[root@oceanbase-dbx ~]# mkdir -p /redo
[root@oceanbase-dbx ~]# chown -R admin:admin /data
[root@oceanbase-dbx ~]# chown -R admin:admin /redo
1.3.13 配置host文件
-- 四台服务器都要配置/etc/hosts文件,写入每台服务器的IP和主机名
10.110.3.152 oceanbase-db1
10.110.3.153 oceanbase-db2
10.110.3.154 oceanbase-db3
10.110.3.155 obproxy-node
1.3.14 配置SSH互信
-- 可用此方法来配置互信
-- 在中控机服务器使用admin用户编辑ssh_key.sh脚本,脚本内容如下。
[admin@obproxy-node ~]$ cat ssh_key.sh 
#!/usr/bin/bash
​
   SERVERS=("admin@10.110.3.152" "admin@10.110.3.153" "admin@10.110.3.154")
   PASSWORD="admin"
   keygen() {
   yum -y install expect
   expect -c "
      spawn ssh-keygen -t rsa
      expect {
         *(/root/.ssh/id_rsa):* { send -- \r;exp_continue}
         *(y/n)* { send -- y\r;exp_continue}
         *Enter* { send -- \r;exp_continue}
         *(y/n)* { send -- y\r;exp_continue}
         *Enter* { send -- \r;exp_continue}
         eof {exit 0}
      }
      expect eof
   "
   }
   copy(){
   expect -c "
      set timeout -1
      spawn ssh-copy-id $1
      expect {
         *(yes/no)* { send -- yes\r; exp_continue }
         *password:* { send -- $PASSWORD\r; exp_continue}
         eof {exit 0}
      }
      expect eof
   "
   }
   ssh_copy_id_to_all(){
   keygen ;
   for host in ${SERVERS[@]}
   do
         copy $host
   done
   }
   ssh_copy_id_to_all
   
-- 在中控机admin用户执行ssh_key.sh脚本
[admin@obproxy-node ~]$ sh ssh_key.sh

三、在线部署集群

3.1 下载并解压社区版 all-in-one package

从 V4.0.0 开始,OceanBase 提供统一的安装包 all-in-one package。可以通过这个统一的安装包一次性完成 OBD、OceanBase 数据库、OBProxy、obagent、Grafana 和 Prometheus 的安装;还可以根据实际需求选择部分组件安装或者指定组件的版本。

使用 admin用户 从 OceanBase 社区下载中心下载最新的 all-in-one package 到中控机,截止到2022-12-20日,最新版本为 4.0.0_beta_bp2,选择对应操作系统的版本。

image20221220161113112.png

-- 使用admin 用户在中控机服务器解压 all-in-one package包
[admin@obproxy-node ~]$ tar -zxf oceanbase-all-in-one-4.0.0.0-beta-100120221125154818.el7.x86_64.tar.gz

3.2 中控机安装OBD

-- 使用 admin用户 在中控机服务器操作
[admin@obproxy-node ~]$ cd oceanbase-all-in-one/bin
[admin@obproxy-node 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: 1.2.0
release:4.el7
arch: x86_64
md5: 0e8f5ee68c337ea28514c9f3f820ea546227fa7e
add /home/admin/oceanbase-all-in-one/rpms/obagent-1.2.0-4.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.0.0
release:5.el7
arch: x86_64
md5: de53232a951184fad75b15884458d85e31d2f6c3
add /home/admin/oceanbase-all-in-one/rpms/obproxy-ce-4.0.0-5.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.0.0.0
release:100000282022112511.el7
arch: x86_64
md5: 75ec57ebe42718b386901357cef1e5d3864748ee
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-100000282022112511.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.0.0.0
release:100000282022112511.el7
arch: x86_64
md5: c5f1e971cc335efe36233cae291a170a0f518e19
add /home/admin/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-100000282022112511.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
Disable remote ok
​
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 
More Details:          obd -h 
=====================================================================
​
-- 生效环境变量
[admin@obproxy-node ~]$ source /home/admin/.bash_profile
​
-- 可以查看环境变量内容如下
[admin@obproxy-node ~]$ more /home/admin/.bash_profile
# .bash_profile
​
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
​
# User specific environment and startup programs
​
PATH=$PATH:$HOME/.local/bin:$HOME/bin
​
export PATH
source /home/admin/.oceanbase-all-in-one/bin/env.sh
​
===============================
[admin@obproxy-node ~]$ more /home/admin/.oceanbase-all-in-one/bin/env.sh
#!/bin/bash
​
export OBD_INSTALL_PRE=~/.oceanbase-all-in-one/obd
source $OBD_INSTALL_PRE/etc/profile.d/obd.sh
export OBCLIENT_HOME=~/.oceanbase-all-in-one/obclient
export PATH=$OBD_INSTALL_PRE/usr/bin:$OBCLIENT_HOME/u01/obclient/bin:$PATH
​
-- obd 帮助命令
[admin@obproxy-node ~]$ obd -h
Usage: obd <command> [options]
​
Available commands:
​
cluster        Deploy and manage a cluster.
​
demo           Quickly start
​
mirror         Manage a component repository for OBD.
​
repo           Manage local repository for OBD.
​
test           Run test for a running deployment.
​
update         Update OBD.
​
​
Options:
  --version      show program's version number and exit
  -h, --help     Show help and exit.
  -v, --verbose  Activate verbose output.

3.3 编辑yaml文件

-- 使用admin用户在中控机服务器操作
[admin@obproxy-node ~]$ cd /home/admin/oceanbase-all-in-one/conf
-- 编辑 all-components.yaml文件
## Only need to configure when remote login is required
user:
   username: admin
   password: admin
#   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:
    - name: beijing
      # Please don't use hostname, only IP can be supported
      ip: 10.110.3.152
    - name: shanghai
      ip: 10.110.3.153
    - name: guangzhou
      ip: 10.110.3.154
  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
    # if current hardware's memory capacity is smaller than 50G, please use the setting of "mini-single-example.yaml" and do a small adjustment.
    memory_limit: 8G # The maximum running memory for an observer
    # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
    system_memory: 6G 
    datafile_size: 10G # Size of the data file. 
    log_disk_size: 2G # The size of disk space used by the clog files.
    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.
    skip_proxy_sys_private_check: true
    enable_strict_kernel_release: false
    # root_password: # root user password
  # In this example , support multiple ob process in single node, so different process use different ports.
  # If deploy ob cluster in multiple nodes, the port and path setting can be same. 
  beijing:
    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: /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
    zone: zone1
  shanghai:
    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: /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
    zone: zone2
  guangzhou:
    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: /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
    zone: zone3
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:
    - 10.110.3.152
    - 10.110.3.153
    - 10.110.3.154
  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.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
    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.
obagent:
  depends:
    - oceanbase-ce
  servers:
    - name: beijing
      # Please don't use hostname, only IP can be supported
      ip: 10.110.3.152
    - name: shanghai
      ip: 10.110.3.153
    - name: guangzhou
      ip: 10.110.3.154
  global:
    home_path: /home/admin/obagent
    ob_monitor_status: active
prometheus:
  depends:
    - obagent
  servers:
    - 10.110.3.155
  global:
    home_path: /home/admin/prometheus
grafana:
  depends:
    - prometheus
  servers:
    - 10.110.3.155
  global:
    home_path: /home/admin/grafana
    login_password: oceanbase

3.4 OBD部署集群

-- 使用admin用户在中控机服务器操作
[admin@obproxy-node conf]$ obd cluster deploy obcluster -c all-components.yaml
install oceanbase-ce-4.0.0.0 for local ok
install obproxy-ce-4.0.0 for local ok
install obagent-1.2.0 for local ok
install prometheus-2.37.1 for local ok
install grafana-7.5.17 for local ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.0.0.0 | 100000282022112511.el7 | 75ec57ebe42718b386901357cef1e5d3864748ee |
| obproxy-ce   | 4.0.0   | 5.el7                  | de53232a951184fad75b15884458d85e31d2f6c3 |
| obagent      | 1.2.0   | 4.el7                  | 0e8f5ee68c337ea28514c9f3f820ea546227fa7e |
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
Initializes obagent work home ok
Initializes prometheus work home ok
Initializes grafana work home ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository install ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository lib check !!
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository install ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Try to get lib-repository
Package oceanbase-ce-libs-4.0.0.0-100000282022112511.el7 is available.
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-100000282022112511.el7-c5f1e971cc335efe36233cae291a170a0f518e19 repository install ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository lib check ok
obcluster deployed
​
-- 查看集群状态
[admin@obproxy-node conf]$ obd cluster list
+------------------------------------------------------------------+
|                           Cluster List                           |
+-----------+------------------------------------+-----------------+
| Name      | Configuration Path                 | Status (Cached) |
+-----------+------------------------------------+-----------------+
| obcluster | /home/admin/.obd/cluster/obcluster | deployed        |
+-----------+------------------------------------+-----------------+

3.5 OBD 启动及初始化集群

-- 使用admin用户在中控机服务器操作
[admin@obproxy-node conf]$ obd cluster start obcluster
-- 遇到了如下报错
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer x
[ERROR] (beijing(10.110.3.152)): when production_mode is True, memory_limit can not be less then 16.0G
[ERROR] (shanghai(10.110.3.153)): when production_mode is True, memory_limit can not be less then 16.0G
[ERROR] (guangzhou(10.110.3.154)): when production_mode is True, memory_limit can not be less then 16.0G
[WARN] OBD-1007: (10.110.3.152) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.152) clog and data use the same disk (/)
[WARN] OBD-1007: (10.110.3.153) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.153) clog and data use the same disk (/)
[WARN] OBD-1007: (10.110.3.154) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.154) clog and data use the same disk (/)
​
Check before start obproxy ok
Check before start obagent ok
Check before start prometheus ok
Check before start grafana ok
See https://www.oceanbase.com/product/ob-deployer/error-codes .
​
-- 不能直接修改 all-components.yaml 并添加production_mode: false 该方法不生效
解决办法:
[admin@obproxy-node conf]$ obd cluster edit-config obcluster
-- 将production_mode: false 配置到global下,:wq保存修改后的文件
-- 然后执行obd cluster redeploy obcluster
[admin@obproxy-node conf]$ obd cluster redeploy obcluster
Get local repositories ok
Search plugins ok
Open ssh connection ok
Cluster status check ok
observer work dir cleaning x
[WARN] OBD-1003: Fail to clean beijing(10.110.3.152):/data
[WARN] OBD-1003: Fail to clean beijing(10.110.3.152):/redo
[WARN] OBD-1003: Fail to clean shanghai(10.110.3.153):/data
[WARN] OBD-1003: Fail to clean shanghai(10.110.3.153):/redo
[WARN] OBD-1003: Fail to clean guangzhou(10.110.3.154):/data
[WARN] OBD-1003: Fail to clean guangzhou(10.110.3.154):/redo
​
obproxy work dir cleaning ok
obagent work dir cleaning ok
prometheus work dir cleaning ok
grafana work dir cleaning ok
obcluster destroyed
install oceanbase-ce-4.0.0.0 for local ok
install obproxy-ce-4.0.0 for local ok
install obagent-1.2.0 for local ok
install prometheus-2.37.1 for local ok
install grafana-7.5.17 for local ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.0.0.0 | 100000282022112511.el7 | 75ec57ebe42718b386901357cef1e5d3864748ee |
| obproxy-ce   | 4.0.0   | 5.el7                  | de53232a951184fad75b15884458d85e31d2f6c3 |
| obagent      | 1.2.0   | 4.el7                  | 0e8f5ee68c337ea28514c9f3f820ea546227fa7e |
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
Initializes obagent work home ok
Initializes prometheus work home ok
Initializes grafana work home ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository install ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository lib check !!
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository install ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Try to get lib-repository
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-100000282022112511.el7-c5f1e971cc335efe36233cae291a170a0f518e19 repository install ok
Remote oceanbase-ce-4.0.0.0-100000282022112511.el7-75ec57ebe42718b386901357cef1e5d3864748ee repository lib check ok
obcluster deployed
Search plugins ok
Load cluster param plugin ok
Check before start observer ok
[WARN] OBD-1007: (10.110.3.152) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.152) clog and data use the same disk (/)
[WARN] OBD-1007: (10.110.3.153) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.153) clog and data use the same disk (/)
[WARN] OBD-1007: (10.110.3.154) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (10.110.3.154) clog and data use the same disk (/)
​
Check before start obproxy ok
Check before start obagent ok
Check before start prometheus ok
Check before start grafana ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster ok
Start obagent ok
obagent program health check ok
Start promethues ok
prometheus program health check ok
Connect to Prometheus ok
Initialize cluster ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Initialize cluster ok
Wait for observer init ok
+------------------------------------------------+
|                    observer                    |
+--------------+---------+------+-------+--------+
| ip           | version | port | zone  | status |
+--------------+---------+------+-------+--------+
| 10.110.3.152 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
| 10.110.3.153 | 4.0.0.0 | 2881 | zone2 | ACTIVE |
| 10.110.3.154 | 4.0.0.0 | 2881 | zone3 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h10.110.3.152 -P2881 -uroot -Doceanbase -A
​
+------------------------------------------------+
|                    obproxy                     |
+--------------+------+-----------------+--------+
| ip           | port | prometheus_port | status |
+--------------+------+-----------------+--------+
| 10.110.3.152 | 2883 | 2884            | active |
| 10.110.3.153 | 2883 | 2884            | active |
| 10.110.3.154 | 2883 | 2884            | active |
+--------------+------+-----------------+--------+
obclient -h10.110.3.152 -P2883 -uroot -Doceanbase -A
+--------------------------------------------------+
|                     obagent                      |
+--------------+-------------+------------+--------+
| ip           | server_port | pprof_port | status |
+--------------+-------------+------------+--------+
| 10.110.3.152 | 8088        | 8089       | active |
| 10.110.3.153 | 8088        | 8089       | active |
| 10.110.3.154 | 8088        | 8089       | active |
+--------------+-------------+------------+--------+
+-----------------------------------------------------+
|                      prometheus                     |
+--------------------------+------+----------+--------+
| url                      | user | password | status |
+--------------------------+------+----------+--------+
| http://10.110.3.155:9090 |      |          | active |
+--------------------------+------+----------+--------+
+-------------------------------------------------------------------+
|                              grafana                              |
+--------------------------------------+-------+-----------+--------+
| url                                  | user  | password  | status |
+--------------------------------------+-------+-----------+--------+
| http://10.110.3.155:3000/d/oceanbase | admin | oceanbase | active |
+--------------------------------------+-------+-----------+--------+
obcluster running
​
-- 查看集群状态,此时为running表示集群状态正常
[admin@obproxy-node conf]$ obd cluster list
+------------------------------------------------------------------+
|                           Cluster List                           |
+-----------+------------------------------------+-----------------+
| Name      | Configuration Path                 | Status (Cached) |
+-----------+------------------------------------+-----------------+
| obcluster | /home/admin/.obd/cluster/obcluster | running         |
+-----------+------------------------------------+-----------------+

3.6 检查 OceanBase 集群各个节点进程信息

[admin@obproxy-node ~]$ IPS="10.110.3.152 10.110.3.153 10.110.3.154"
[admin@obproxy-node ~]$ for ob in $IPS;do echo $ob; ssh $ob "ps -ef | grep observer | grep -v grep "; done
10.110.3.152
admin    18508     1 61 16:06 ?        00:10:40 /home/admin/oceanbase-ce/bin/observer -r 10.110.3.152:2882:2881;10.110.3.153:2882:2881;10.110.3.154:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /data -i ens33 -l INFO -o __min_full_resource_pool_memory=2147483648,memory_limit=8G,system_memory=6G,datafile_size=10G,log_disk_size=2G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4,skip_proxy_sys_private_check=True,enable_strict_kernel_release=False
10.110.3.153
admin    17963     1 53 16:06 ?        00:09:14 /home/admin/oceanbase-ce/bin/observer -r 10.110.3.152:2882:2881;10.110.3.153:2882:2881;10.110.3.154:2882:2881 -p 2881 -P 2882 -z zone2 -c 1 -d /data -i ens33 -l INFO -o __min_full_resource_pool_memory=2147483648,memory_limit=8G,system_memory=6G,datafile_size=10G,log_disk_size=2G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4,skip_proxy_sys_private_check=True,enable_strict_kernel_release=False
10.110.3.154
admin    31639     1 40 16:06 ?        00:06:58 /home/admin/oceanbase-ce/bin/observer -r 10.110.3.152:2882:2881;10.110.3.153:2882:2881;10.110.3.154:2882:2881 -p 2881 -P 2882 -z zone3 -c 1 -d /data -i ens33 -l INFO -o __min_full_resource_pool_memory=2147483648,memory_limit=8G,system_memory=6G,datafile_size=10G,log_disk_size=2G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4,skip_proxy_sys_private_check=True,enable_strict_kernel_release=False
[admin@obproxy-node ~]$ 
​
[admin@oceanbase-db1 ~]$ ll /home/admin/oceanbase-ce/bin/observer
lrwxrwxrwx 1 admin admin 104 Dec 13 16:05 /home/admin/oceanbase-ce/bin/observer -> /home/admin/.obd/repository/oceanbase-ce/4.0.0.0/75ec57ebe42718b386901357cef1e5d3864748ee/bin/./observer

3.7 检查 OceanBase 集群各个节点监听状况

[admin@oceanbase-db1 ~]$ IPS="10.110.3.152 10.110.3.153 10.110.3.154"             
[admin@oceanbase-db1 ~]$ for ob in $IPS;do echo $ob; ssh $ob "netstat -ntlp"; done
10.110.3.152
admin@10.110.3.152's password: 
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:9998            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16688           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16689           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2881            0.0.0.0:*               LISTEN      18508/observer      
tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      18508/observer      
tcp        0      0 0.0.0.0:60002           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2883            0.0.0.0:*               LISTEN      19822/obproxy       
tcp        0      0 0.0.0.0:2884            0.0.0.0:*               LISTEN      19822/obproxy       
tcp6       0      0 :::111                  :::*                    LISTEN      -                   
tcp6       0      0 :::8052                 :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 :::8088                 :::*                    LISTEN      20439/monagent      
tcp6       0      0 ::1:25                  :::*                    LISTEN      -                   
tcp6       0      0 :::8089                 :::*                    LISTEN      20439/monagent      
tcp6       0      0 :::18882                :::*                    LISTEN      -                   
tcp6       0      0 :::60002                :::*                    LISTEN      -                   
tcp6       0      0 :::18883                :::*                    LISTEN      -                   
10.110.3.153
admin@10.110.3.153's password: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2881            0.0.0.0:*               LISTEN      17963/observer      
tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      17963/observer      
tcp        0      0 0.0.0.0:60002           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2883            0.0.0.0:*               LISTEN      18828/obproxy       
tcp        0      0 0.0.0.0:2884            0.0.0.0:*               LISTEN      18828/obproxy       
tcp        0      0 0.0.0.0:9998            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16688           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16689           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:5236            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::8088                 :::*                    LISTEN      19421/monagent      
tcp6       0      0 ::1:25                  :::*                    LISTEN      -                   
tcp6       0      0 :::8089                 :::*                    LISTEN      19421/monagent      
tcp6       0      0 :::18882                :::*                    LISTEN      -                   
tcp6       0      0 :::60002                :::*                    LISTEN      -                   
tcp6       0      0 :::18883                :::*                    LISTEN      -                   
tcp6       0      0 :::111                  :::*                    LISTEN      -                   
tcp6       0      0 :::5236                 :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
10.110.3.154
admin@10.110.3.154's password: 
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:2881            0.0.0.0:*               LISTEN      31639/observer      
tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      31639/observer      
tcp        0      0 0.0.0.0:60002           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2883            0.0.0.0:*               LISTEN      32441/obproxy       
tcp        0      0 0.0.0.0:2884            0.0.0.0:*               LISTEN      32441/obproxy       
tcp        0      0 0.0.0.0:9998            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16688           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:16689           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::18882                :::*                    LISTEN      -                   
tcp6       0      0 :::60002                :::*                    LISTEN      -                   
tcp6       0      0 :::18883                :::*                    LISTEN      -                   
tcp6       0      0 :::111                  :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 :::8088                 :::*                    LISTEN      584/monagent        
tcp6       0      0 ::1:25                  :::*                    LISTEN      -                   
tcp6       0      0 :::8089                 :::*                    LISTEN      584/monagent   

3.8 下载并安装obclient

登陆阿里云镜像下载地址:https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/ 下载最新版obclient和libobclient包。

-- 可以在中控机服务器上安装 obclient 包
[root@obproxy-node ~]# rpm -ivh /root/rpm/obclient-*.rpm /root/rpm/libobclient-*.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:libobclient-2.2.1-2.el7          ################################# [ 50%]
   2:obclient-2.2.1-4.el7             ################################# [100%]
   
-- 使用obclient连接数据库
[root@obproxy-node ~]# su - admin
[admin@obproxy-node ~]$ obclient -h 10.110.3.152 -uroot@sys#obcluster -pob@Passwd -P2883 -c -A oceanbase
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 5
Server version: OceanBase_CE 4.0.0.0 (r100000282022112511-dd289d2407609a88b1fcdf2be9e7c384cb8e19d0) (Built Nov 25 2022 11:58:08)
​
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
obclient [oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ORAAUDITOR         |
| SYS                |
| test               |
+--------------------+
7 rows in set (0.011 sec)

3.9 创建多租户

[admin@obproxy-node ~]$ obd cluster tenant create obcluster -n obuser --max-cpu=1 --min-cpu=1 --max-memory=512M --min-memory=512M --mode=mysql --charset=GBK
Get local repositories and plugins ok
Open ssh connection ok
Connect to observer ok
[WARN] option max_memory is no longer supported
[WARN] option min_memory is no longer supported
Create tenant obuser ok
​
[admin@obproxy-node ~]$ obclient -h 10.110.3.152 -uroot@obuser -P2883  -p
Enter password: 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 11
Server version: OceanBase_CE 4.0.0.0 (r100000282022112511-dd289d2407609a88b1fcdf2be9e7c384cb8e19d0) (Built Nov 25 2022 11:58:08)
​
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
obclient [(none)]

3.10 查询集群资源分配情况

[admin@obproxy-node ~]$ obclient -h 10.110.3.152 -uroot@sys#obcluster -pob@Passwd -P2883 -c -A oceanbase 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 13
Server version: OceanBase_CE 4.0.0.0 (r100000282022112511-dd289d2407609a88b1fcdf2be9e7c384cb8e19d0) (Built Nov 25 2022 11:58:08)
​
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SERVERS;
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| SVR_IP       | SVR_PORT | ZONE  | SQL_PORT | CPU_CAPACITY | CPU_CAPACITY_MAX | CPU_ASSIGNED | CPU_ASSIGNED_MAX | MEM_CAPACITY | MEM_ASSIGNED | LOG_DISK_CAPACITY | LOG_DISK_ASSIGNED | LOG_DISK_IN_USE | DATA_DISK_CAPACITY | DATA_DISK_IN_USE | DATA_DISK_HEALTH_STATUS | MEMORY_LIMIT | DATA_DISK_ABNORMAL_TIME | SSL_CERT_EXPIRED_TIME |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| 10.110.3.154 |     2882 | zone3 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |       805306368 |        10737418240 |        218103808 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
| 10.110.3.153 |     2882 | zone2 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |       805306368 |        10737418240 |        213909504 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
| 10.110.3.152 |     2882 | zone1 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |       805306368 |        10737418240 |        318767104 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
3 rows in set (0.122 sec)

3.11 查询集群内各租户的资源分配情况

obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SERVERS;
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| SVR_IP       | SVR_PORT | ZONE  | SQL_PORT | CPU_CAPACITY | CPU_CAPACITY_MAX | CPU_ASSIGNED | CPU_ASSIGNED_MAX | MEM_CAPACITY | MEM_ASSIGNED | LOG_DISK_CAPACITY | LOG_DISK_ASSIGNED | LOG_DISK_IN_USE | DATA_DISK_CAPACITY | DATA_DISK_IN_USE | DATA_DISK_HEALTH_STATUS | MEMORY_LIMIT | DATA_DISK_ABNORMAL_TIME | SSL_CERT_EXPIRED_TIME |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| 10.110.3.153 |     2882 | zone2 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |      1946157056 |        10737418240 |       1337982976 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
| 10.110.3.152 |     2882 | zone1 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |      1946157056 |        10737418240 |       1329594368 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
| 10.110.3.154 |     2882 | zone3 |     2881 |            4 |                4 |            2 |                2 |   8589934592 |   8589934592 |       10737418240 |       10737418240 |      1946157056 |        10737418240 |       1346371584 | NORMAL                  |  10737418240 | NULL                    | NULL                  |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
3 rows in set (0.018 sec)

四、附录

4.1 创建多租户需要设置足够大的log_disk_size

如果log_disk_size设置足够小,会报如下错误

[admin@obproxy-node ~]$ obd cluster tenant create obcluster -n obuser --max-cpu=1 --min-cpu=1 --max-memory=512M --min-memory=512M --mode=mysql --charset=GBK   
Get local repositories and plugins ok
Open ssh connection ok
Connect to observer ok
[WARN] option max_memory is no longer supported
[WARN] option min_memory is no longer supported
Create tenant obuser x
[ERROR] ('zone1','zone2','zone3'): resource not enough: log disk size less than 1.0G
复制

4.2 集群部署后修改yaml文件

当部署了集群后,在创建多租户时如果因为配置文件设置有问题,不能直接修改yam文件,需要通过obd cluster edit-config obd集群名来修改配置信息,然后再执行obd cluster redeploy obd的集群名,但大部分配置通过reload也能生效。

标签:10.110,ok,4.0,Centos,OceanBase,0.0,oceanbase,--,admin
From: https://blog.csdn.net/shlei5580/article/details/144373911

相关文章

  • PostgreSQL 安装部署系列:采用源码方式在Centos 7.9 安装指定 PostgreSQL 数据库
    ========================================== 现供职于某上市互联网公司担任DBAOracle&PGACE称号,拥有OracleOCM、AWS、以及部分国产数据库等产品认证。喜欢技术分享,热爱交友,也热爱健身。2019年加入墨天轮,目前已发表了一百多篇原创文章,曾多次获评"月度墨力之星"。Oc......
  • ubuntu24.04在线安装Docker,设置容器目录与基础配置
    1、设置apt#AddDocker'saliyunGPGkey:sudoaptupdate#安装必要的软件包sudoaptinstall-yapt-transport-httpsca-certificatescurlsoftware-properties-common#添加阿里云GPT密钥管理sudocurl-fsSLhttps://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg......
  • ubuntu24.04挂载2.2T以上硬盘,实现开启挂载
    1、su进入root用户,输入密码。2、查看现有硬盘使用情况,可以发现数据硬盘暂未挂载到目录。df-hFilesystemSizeUsedAvailUse%Mountedonudev63G063G0%/devtmpfs13G1.2M13G1%/run/dev/vda140G5.3G32G......
  • Centos7.9实现远程挂载 nfs
    需求:现有2台华为云服务器(配置了同一个安全组,内网可以互ping),需要将192.168.0.141的/data/logs目录下的所有文件远程挂载到192.168.0.204的/data/logs目录下,采用了nfs的方式一、192.168.0.204配置如下1yuminstallnfs-utils23mkdir/data/logs4chmod755/data/logs......
  • Centos7安装Nginx教程,一步安装http和https
    nginx是一款轻量级web服务器,主要有负载均衡和反向代理的特性。安装准备nginx一些模块需要依赖lib库,所以先安装lib库,执行以下命令:[root@localhostlocal]#yum-yinstallgcc-c++pcrepcre-develzlibzlib-developensslopenssl-devel下载在官网下载安装包安装......
  • 新建虚拟机 VMware17 + Centos7
    新建虚拟机选择自定义,以便于安装CentOS7。直接下一步选择稍后安装操作系统。选择Linux系统,版本选择centos7;如果自己的电脑是32位就选centos732位;如果自己的电脑是64位就选centos764位。设置虚拟机名称,以及安装位置某个处理器内核数量建议选2虚拟机内......
  • 系统无法连接到 CentOS 的镜像源
    系统无法连接到CentOS的镜像源。CentOS7的官方支持已经结束,因此官方镜像源可能不再提供服务或已被移除。[root@master~]#yuminstallntp已加载插件:fastestmirror,langpacksLoadingmirrorspeedsfromcachedhostfileCouldnotretrievemirrorlisthttp://mir......
  • Linux系统:CentOS 7 CA证书服务器部署
    在CentOS7上部署CA证书服务器需要以下步骤:安装OpenSSL:OpenSSL是一个强大的安全套接字层密码库,包含了主要的加密、哈希和证书签名算法等。使用以下命令安装:sudoyuminstallopenssl创建CA私钥:首先,我们需要创建一个私钥,用于生成CA证书。使用以下命令创建私钥:opensslgenrs......
  • (简单5步实现,免费且比GPT4.0更好用)部署本地AI大语言模型聊天系统:Chatbox AI + 马斯克gr
    摘要:本文将指导您如何部署一个本地AI大语言模型聊天系统,使用ChatboxAI客户端应用和grok-beta大模型,以实现高效、智能的聊天体验。引言:由马斯克X-AI发布的Grok2大模型以其卓越的性能超越了GPT4.0。Grok模型支持超长文本上下文理解,易于使用且免费。部署步骤:获取API密......
  • 24.01.005 Complex Vectors and Matrices
    复数和复平面代数/几何表示形如\(z=a+bi\),\(i^2=-1\)的数,或者写成\(e^{}\)Conjugate共轭,\(z+\bar{z}=2Re(z),z-\bar{z}=2Im(z)\)。\(z=a+bi\)对应复平面上的点\((a,b)\)。模(绝对值)\(|z|=\sqrt{a^2+b^2}=z\bar{z}\),表示复平面向量的长度。对于一个实矩阵\(A\),若其有......