利用Docker搭建OceanBase 3.1.1社区版的集群
Tags: DockerOceanBase安装部署环境搭建集群部署高可用
环境规划
环境是这样的,只有一台虚拟机,配置16c80G,准备使用docker来模拟出4台CentOS主机,搭建OceanBase 3.1.1社区版的集群。OBServer每台至少需要8G内存,否则不能启动。
具体配置如下所示:
主机名 | IP | 端口 | 主机映射端口 | Zone | 作用 |
---|---|---|---|---|---|
lhrob1 | 172.72.8.11 | 2881 | 28811 | zone1 | OB Server1 |
lhrob2 | 172.72.8.12 | 2881 | 28812 | zone2 | OB Server2 |
lhrob3 | 172.72.8.13 | 2881 | 28813 | zone3 | OB Server3 |
lhrobproxy | 172.72.8.14 | 2883 | 28814 | 用于OBD、OBProxy、OBClient、mysql客户端、时间服务器等 |
初始化准备
申请环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | docker network create --subnet=172.72.8.0/24 lhrob-network docker network inspect lhrob-network docker rm -f lhrob1 lhrob2 lhrob3 lhrobproxy docker run -d --name lhrob1 -h lhrob1 \ --net=lhrob-network --ip 172.72.8.11 \ -p 28811:2881 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:8.5 \ /usr/sbin/init docker run -d --name lhrob2 -h lhrob2 \ --net=lhrob-network --ip 172.72.8.12 \ -p 28812:2881 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:8.5 \ /usr/sbin/init docker run -d --name lhrob3 -h lhrob3 \ --net=lhrob-network --ip 172.72.8.13 \ -p 28813:2881 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:8.5 \ /usr/sbin/init docker run -d --name lhrobproxy -h lhrobproxy \ --net=lhrob-network --ip 172.72.8.14 \ -p 28814:2883 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:8.5 \ /usr/sbin/init docker exec -it lhrobproxy bash |
配置时钟源
如果您使用集群安装 OceanBase,则需要保证集群内各机器的时间同步。否则集群无法启动,服务在运行时也会出现异常。如果您已配置 NTP 时钟同步,则无需重新配置。
OceanBase 集群中的服务器时间必须保持一致,否则会导致 OceanBase 集群无法启动,运行时也会出现故障。物理机与时钟服务器的误差在 50ms 以下可认为时钟是同步状态,OceanBase 集群最大容忍误差不能超过 100ms。当超过 100ms 时,会出现无主情况。恢复时钟同步后。重启 OceanBase 集群, 可以恢复正常。
部署 OceanBase 集群时,各个 OBServer 的 RPC 允许的时钟偏差最大是100ms。
这里以“172.72.8.14”为时间服务器,其它3台OBServer同步该机器的时间:
1 2 3 4 | yum install ntp ntpdate -y ntpq -4p ntpstat timedatectl |
1、修改“172.72.8.14”为时间服务器/etc/ntp.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift #新增:日志目录 logfile /var/log/ntpd.log # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict ::1 #新增:这一行的含义是授权172.72.8.0网段上的所有机器可以从这台机器上查询和同步时间. restrict 172.72.8.0 mask 255.255.255.0 nomodify notrap # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #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 #新增:时间服务器列表. server 0.cn.pool.ntp.org iburst server 1.cn.pool.ntp.org iburst server 2.cn.pool.ntp.org iburst server 3.cn.pool.ntp.org iburst #新增:当外部时间不可用时,使用本地时间 server 127.0.0.1 iburst fudge 127.0.0.1 stratum 10 #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats # Disable the monitoring facility to prevent amplification attacks using ntpdc # monlist command when default restrict does not include the noquery flag. See # CVE-2013-5211 for more details. # Note: Monitoring will not be disabled with the limited restriction flag. disable monitor |
配置开机启动:
1 2 3 4 5 6 7 8 9 10 | systemctl enable ntpd systemctl is-enabled ntpd ntpdate -u 1.cn.pool.ntp.org systemctl restart ntpd [root@lhrobproxy /]# ntpstat synchronised to NTP server (84.16.73.33) at stratum 2 time correct to within 98 ms polling server every 64 s |
其它客户端,修改“/etc/ntp.conf”,注释server开头的行,并添加如下行:
1 2 3 4 5 6 7 | server 172.72.8.14 restrict 172.72.8.14 nomodify notrap noquery server 127.0.0.1 fudge 127.0.0.1 stratum 10 |
配置开机启动:
1 2 | systemctl enable ntpd systemctl restart ntpd |
客户端配置自动同步:
1 2 | crontab -e * * * * * /usr/sbin/ntpdate -u 172.72.8.14 & > /dev/null |
配置内核参数
4个节点都运行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | cat >> /etc/security/limits.conf <<"EOF" 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 EOF echo "fs.aio-max-nr=1048576" >> /etc/sysctl.conf sysctl -p |
如果只是测试,您可以只设置 fs.aio-max-nr=1048576
。
创建用户
1 2 3 4 5 6 7 | useradd -U admin -d /home/admin -s /bin/bash echo "admin:lhr" | chpasswd chown -R admin:admin /home/admin echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
设置无密码SSH登陆
可以使用rac上的sshUserSetup.sh快速配置,只在lhrobproxy上运行:
1 | sh sshUserSetup.sh -user admin -hosts "lhrob1 lhrob2 lhrob3 lhrobproxy" -advanced exverify -confirm |
安装集群
在lhrobproxy操作:
安装OBD
1 2 3 | yum install -y yum-utils yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo yum install -y ob-deploy |
设置yaml的配置文件
OBD根据这个yaml文件即可自动创建集群
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | cat > /tmp/obd_observer_obproxy.yaml <<"EOF" ## Only need to configure when remote login is required user: username: admin #用户名,前提三个节点保持一致 password: lhr #密码 ,前提三个节点保持一致 key_file: #密钥,可省略 #################### 下面是 observer搭建参数 ############################## oceanbase-ce: servers: - name: z1 # zone名 # Please don't use hostname, only IP can be supported ip: 172.72.8.11 # OB1 地址 - name: z2 ip: 172.72.8.12 # OB2 地址 - name: z3 ip: 172.72.8.13 # OB3 地址 global: mysql_port: 2881 # 数据库端口 rpc_port: 2882 # 远程访问的协议端口号 home_path: /home/admin/oceanbase # 软件目录 #data_dir: /data # 数据目录 #redo_dir: /redo # redo目录 devname: eth0 # 设置要部署节点的网卡 memory_limit: 8G system_memory: 2G # 系统剩余保留内存2G lower_case_table_names: 1 # 数据库不区分大小写 foreign_key_checks: 0 # DML 语句不检查外建约束,DDL 操作不受影响 sys_bkgd_migration_retry_num: 5 # 副本迁移失败时最多重试次数。 stack_size: 512K # 设置程序函数调用栈的大小。 磁盘要512k 对齐,如果不是可能会启动失败 cpu_count: 16 # cpu 16核 cache_wash_threshold: 1G # 设置触发缓存清理的容量阈值。如果内存空间小于指定值时,内存空间将被清理。 __min_full_resource_pool_memory: 1073741824 # 默认普通租户的内存最小规格必须大于等于 5 GB,这里设置成1G,就说明我可以最低设置租户内存为1G workers_per_cpu_quota: 10 # 用于设置分配给每个 CPU 配额的工作线程数量。 schema_history_expire_time: 1d # 元数据历史数据过期时间。 net_thread_count: 4 # 设置网络 I/O 线程数,The value of net_thread_count had better be same as cpu's core number. major_freeze_duty_time: Disable minor_freeze_times: 10 # 多少次小合并触发一次全局合并。 enable_separate_sys_clog: True # 是否把系统事务日志与用户事务日志分开存储。 enable_merge_by_turn: FALSE datafile_size: 5G # datafile_disk_percentage: 0.1 # 数据库系统初始化用于存储数据,例如这里设置了40,表示百分之四十,如果我单节点是1TB的,约400多G空间将会被立即占用 syslog_level: INFO # 日志警报级别 enable_syslog_recycle: True # 开启回收系统日志的功能 max_syslog_file_count: 4 # 日志文件数量 log_dir_size_threshold: 1G cluster_id: 1 # 集群ID # observer cluster name, consistent with obproxy's cluster_name appname: lhrob311cluster # 集群名,要与下面obproxy的对应一致 root_password: lhr proxyro_password: lhr ###下面设置节点信息 z1: zone: zone1 # 设置节点所在的 Zone 的名字 z2: zone: zone2 z3: zone: zone3 ########################## 以下是obrpoxy的 搭建参数 ######################3 obproxy: servers: - 127.0.0.1 global: listen_port: 2883 prometheus_listen_port: 2884 home_path: /home/admin/obproxy # oceanbase root server list # format: ip:mysql_port,ip:mysql_port rs_list: 172.72.8.11:2881;172.72.8.12:2881;172.72.8.13:2881 enable_cluster_checkout: false EOF |
使用OBD初始化集群
1 2 3 4 5 6 7 8 9 10 11 | sh /etc/profile.d/obd.sh obd cluster deploy lhrob311cluster -c /tmp/obd_observer_obproxy.yaml -f obd cluster list obd cluster display lhrob311cluster obd cluster start lhrob311cluster -- 修改参数 obd cluster edit-config lhrob311cluster |
执行过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | [root@lhrobproxy soft]# obd cluster deploy lhrob311cluster -c /tmp/obd_observer_obproxy.yaml -f Update OceanBase-community-stable-el7 ok Update OceanBase-development-kit-el7 ok Download oceanbase-ce-3.1.1-4.el7.x86_64.rpm (46.21 M): 100% [###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################] Time: 0:00:18 2.58 MB/s Package oceanbase-ce-3.1.1 is available. Download obproxy-3.1.0-1.el7.x86_64.rpm (7.70 M): 100% [#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################] Time: 0:00:01 4.62 MB/s Package obproxy-3.1.0 is available. install oceanbase-ce-3.1.1 for local ok install obproxy-3.1.0 for local ok +-----------------------------------------------------------------------------+ | Packages | +--------------+---------+---------+------------------------------------------+ | Repository | Version | Release | Md5 | +--------------+---------+---------+------------------------------------------+ | oceanbase-ce | 3.1.1 | 4.el7 | f19f8bfb67723712175fb0dfd60579196b3168f1 | | obproxy | 3.1.0 | 1.el7 | 0b17cf0459a3b53c5a2febb6572894d183154c64 | +--------------+---------+---------+------------------------------------------+ Repository integrity check ok Parameter check ok Open ssh connection ok Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository install ok Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check !! [WARN] z1(172.72.8.11) oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 require: libmariadb.so.3 [WARN] z2(172.72.8.12) oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 require: libmariadb.so.3 [WARN] z3(172.72.8.13) oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 require: libmariadb.so.3 Remote obproxy-3.1.0-0b17cf0459a3b53c5a2febb6572894d183154c64 repository install ok Remote obproxy-3.1.0-0b17cf0459a3b53c5a2febb6572894d183154c64 repository lib check ok Try to get lib-repository Download oceanbase-ce-libs-3.1.1-4.el7.x86_64.rpm (155.15 K): 100% [#########################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################] Time: 0:00:00 1.87 MB/s Package oceanbase-ce-libs-3.1.1 is available. install oceanbase-ce-libs-3.1.1 for local ok Use oceanbase-ce-libs-3.1.1-58384f7ab4ee736e9d530f4bdd63c20ced0e7aba for oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 Remote oceanbase-ce-libs-3.1.1-58384f7ab4ee736e9d530f4bdd63c20ced0e7aba repository install ok Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check ok Cluster status check ok Initializes observer work home ok Initializes obproxy work home ok lhrob311cluster deployed [root@lhrobproxy soft]# obd cluster list +------------------------------------------------------------------------+ | Cluster List | +-----------------+------------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-----------------+------------------------------------+-----------------+ | lhrob311cluster | /root/.obd/cluster/lhrob311cluster | deployed | +-----------------+------------------------------------+-----------------+ [root@lhrobproxy soft]# obd cluster start lhrob311cluster Get local repositories and plugins ok Open ssh connection ok Cluster param config check ok Check before start observer ok [WARN] (172.72.8.11) clog and data use the same disk (/) [WARN] (172.72.8.12) clog and data use the same disk (/) [WARN] (172.72.8.13) clog and data use the same disk (/) Check before start obproxy ok Start observer ok observer program health check ok Connect to observer ok Initialize cluster Cluster bootstrap ok Wait for observer init ok +-----------------------------------------------+ | observer | +-------------+---------+------+-------+--------+ | ip | version | port | zone | status | +-------------+---------+------+-------+--------+ | 172.72.8.11 | 3.1.1 | 2881 | zone1 | active | | 172.72.8.12 | 3.1.1 | 2881 | zone2 | active | | 172.72.8.13 | 3.1.1 | 2881 | zone3 | active | +-------------+---------+------+-------+--------+ Start obproxy ok obproxy program health check ok Connect to obproxy ok Initialize cluster +---------------------------------------------+ | obproxy | +-----------+------+-----------------+--------+ | ip | port | prometheus_port | status | +-----------+------+-----------------+--------+ | 127.0.0.1 | 2883 | 2884 | active | +-----------+------+-----------------+--------+ lhrob311cluster running [root@lhrobproxy soft]# obd cluster list +------------------------------------------------------------------------+ | Cluster List | +-----------------+------------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-----------------+------------------------------------+-----------------+ | lhrob311cluster | /root/.obd/cluster/lhrob311cluster | running | +-----------------+------------------------------------+-----------------+ [root@lhrobproxy soft]# [root@lhrobproxy soft]# netstat -tulnp| grep 288 tcp 0 0 0.0.0.0:2883 0.0.0.0:* LISTEN 8048/obproxy tcp 0 0 0.0.0.0:2884 0.0.0.0:* LISTEN 8048/obproxy -- 剩余节点类似 [root@lhrob1 log]# netstat -tulnp| grep 288 tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 8244/observer tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 8244/observer |
配置obproxy
https://open.oceanbase.com/articles/1100243
obproxy跟OB集群通信是使用sys租户内的一个内部账户proxyro。这个账户需要创建。
obproxy启动后,默认用 root@proxysys 登录,密码为空。需要改密码(通过proxy参数obproxy_sys_password指定)。
obproxy启动后,还需要修改proxyro的密码(通过proxy参数observer_sys_password指定),设置为跟OB集群里创建的proxyro密码一致才能链接那个OB集群。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | mysql -h127.1 -uroot@sys -P2881 -plhr -c -A oceanbase create user proxyro identified by 'lhr'; alter user proxyro identified by 'lhr'; grant select on *.* to proxyro; mysql -h127.1 -uroot@proxysys -P2883 -p alter proxyconfig set obproxy_sys_password='lhr'; alter proxyconfig set observer_sys_password='lhr'; show proxyconfig like '%sys_password%'; mysql -h127.1 -uroot@sys -P2883 -plhr -c -A oceanbase mysql -uroot@sys -plhr -h192.168.66.35 -P28814 select * from oceanbase.__all_server; show full processlist; |
安装客户端
1 | yum install -y obclient mariadb mariadb-libs mariadb-devel |
可以查询:
1 2 3 4 5 6 | mysql -uroot@proxysys#lhrob311cluster -p -h192.168.66.35 -P28814 obclient -h 127.0.0.1 -uroot@proxysys -P2883 obclient -h 127.0.0.1 -uroot@proxysys#lhrob311cluster -P2883 mysql -uroot@sys -plhr -h192.168.66.35 -P28811 mysql -uroot@sys -plhr -h192.168.66.35 -P28814 |
如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | C:\Users\lhrxxt>mysql -uroot@sys -plhr -h192.168.66.35 -P28814 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 92 Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | SYS | | LBACSYS | | ORAAUDITOR | | test | +--------------------+ 7 rows in set (0.64 sec) MySQL [(none)]> create database lhrdb; Query OK, 1 row affected (0.62 sec) MySQL [(none)]> select * from oceanbase.__all_server; +----------------------------+----------------------------+-------------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+ | gmt_create | gmt_modified | svr_ip | svr_port | id | zone | inner_port | with_rootserver | status | block_migrate_in_time | build_version | stop_time | start_service_time | first_sessid | with_partition | last_offline_time | +----------------------------+----------------------------+-------------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+ | 2021-11-03 10:07:29.148223 | 2021-11-03 15:36:29.125523 | 172.72.8.11 | 2882 | 1 | zone1 | 2881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1635907362335045 | 0 | 1 | 0 | | 2021-11-03 10:07:28.665950 | 2021-11-03 15:36:29.126133 | 172.72.8.12 | 2882 | 2 | zone2 | 2881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1635907363335302 | 0 | 1 | 0 | | 2021-11-03 10:07:28.675445 | 2021-11-03 15:36:29.126735 | 172.72.8.13 | 2882 | 3 | zone3 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1635907362334795 | 0 | 1 | 0 | +----------------------------+----------------------------+-------------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+ 3 rows in set (0.12 sec) MySQL [(none)]> select -> zone, -> concat(svr_ip, ':', svr_port) as observer, -> concat(cpu_assigned, ' : ', cpu_total) as cpu_summary, -> concat(mem_assigned/(1024*1024*1024),' : ', mem_total/(1024*1024*1024)) as mem_summary_gb, -> concat(disk_assigned/(1024*1024*1024),' : ', disk_total/(1024*1024*1024)) as disk_summary_gb, -> cast(cpu_weight as decimal(5,2)) as c_weight, -> cast(memory_weight as decimal(5,2)) as m_weight, -> cast(disk_weight as decimal(5,2)) as d_weight, -> unit_num -> from oceanbase.__all_virtual_server_stat -> order by zone,observer; +-------+------------------+-------------+-----------------+-----------------+----------+----------+----------+----------+ | zone | observer | cpu_summary | mem_summary_gb | disk_summary_gb | c_weight | m_weight | d_weight | unit_num | +-------+------------------+-------------+-----------------+-----------------+----------+----------+----------+----------+ | zone1 | 172.72.8.11:2882 | 2.5 : 10 | 1.5000 : 6.0000 | 2.0000 : 2.0000 | 0.50 | 0.50 | 0.00 | 1 | | zone2 | 172.72.8.12:2882 | 2.5 : 10 | 1.5000 : 6.0000 | 2.0000 : 2.0000 | 0.50 | 0.50 | 0.00 | 1 | | zone3 | 172.72.8.13:2882 | 2.5 : 10 | 1.5000 : 6.0000 | 2.0000 : 2.0000 | 0.50 | 0.50 | 0.00 | 1 | +-------+------------------+-------------+-----------------+-----------------+----------+----------+----------+----------+ 3 rows in set (0.40 sec) |
接下来就是创建租户啥的操作,这里不再详细演示。
巡检脚本
可以使用麦老师的OceanBase的巡检脚本(https://www.xmmup.com/shujukuxunjianjiaoben.html), 脚本目前不是很详细,当然一直在完善中,如下:
1 2 | C:\Users\lhrxxt>mysql -uroot@sys -plhr -h192.168.66.35 -P28814 -f --silent < D:\DB_OceanBase_HC_lhr_v7.0.0.sql > D:\lhr_OceanBase_check.html mysql: [Warning] Using a password on the command line interface can be insecure. |
运行结果:
其它不再列举。
这里只列出部分结果,其它的详细内容可以参考:https://share.weiyun.com/5lb2U2M