首页 » OceanBase » Oceanbase V4.2 (企业版) OBD单机安装(CentOS 7.9 Linux VBOX虚拟机)

Oceanbase V4.2 (企业版) OBD单机安装(CentOS 7.9 Linux VBOX虚拟机)

在学习OceanBase时,测试环境是必不可少的。我在个人笔记本电脑(18核CPU,32GB内存)上的VBOX虚拟机中创建了一个配置为8核CPU、16GB内存和100GB磁盘空间的虚拟机,并在其上安装了OceanBase V4.2.1环境(Oracle租户),以便后续进行语法研究。以下是安装过程的简单记录。

 Oracle VM VirtualBox配置

8c Cpu, 16G memory,100GB disk

centOS 7.9 linux x86-64,    ISO 镜像 aliyun 下载

[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 7.8G     0  7.8G   0% /dev
tmpfs                    7.8G     0  7.8G   0% /dev/shm
tmpfs                    7.8G  8.8M  7.8G   1% /run
tmpfs                    7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/mapper/centos-root   50G   32G   19G  63% /
/dev/mapper/centos-home   44G   33M   44G   1% /home
/dev/sda1               1014M  150M  865M  15% /boot
tmpfs                    1.6G     0  1.6G   0% /run/user/0
[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        4.0G        9.0G        8.8M        2.5G        7.2G
Swap:          7.9G          0B        7.9G
[root@localhost ~]# cat /etc/*release
CentOS Linux release 7.9.2009 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)

生产配置参考 官方文档建议

Ocenabase 安装介质

-rw-r–r–. 1 root root 34789136 Jul 18 22:40 obproxy-4.2.1.0-20231017181929.el7.x86_64.rpm
-rw-r–r–. 1 root root 189023064 Jul 18 22:40 oceanbase-4.2.1.2-102010012023120119.el7.x86_64.rpm

下载并上传到服务器,用于后面制作obd镜像,因为我环境可以连Internet , 所以OBD(OceanBase Deployer,即 OceanBase 安装部署工具)和 obclient可以在线yum, 未准备本地安装介质。

 OS内核配置

# sysctl for oceanbase
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 = 0
net.ipv4.tcp_slow_start_after_idle=0
fs.aio-max-nr = 1048576
vm.max_map_count=655360
fs.file-max=6573688

kernel.numa_balancing = 0
vm.zone_reclaim_mode = 0
vm.swappiness = 0

配置在/etc/sysctl.conf,也可以在自定义配置文件 /etc/sysctl.d/oceanbase.conf 中, 如果检查不通过在OBD在启动时会提示,不通过的会提示如下:

[ERROR] OBD-1017: (192.168.56.100) The value of the “vm.max_map_count” must be within [327600, 1310720] (Current value: 65530, Recommended value: 655360), Please execute `echo “vm.max_map_count=655360” >> /etc/sysctl.conf; sysctl -p` as root in 192.168.56.100.
[ERROR] OBD-1017: (192.168.56.100) The value of the “fs.file-max” must be greater than 6573688 (Current value: 1555703, Recommended value: 6573688), Please execute `echo “fs.file-max=6573688” >> /etc/sysctl.conf; sysctl -p` as root in 192.168.56.100.

禁用透明大页
#  echo never > /sys/kernel/mm/transparent_hugepage/enabled

Python 检查
检查OS已安装python,确保执行 python -V 命令返回的版本为 2.7。

建议禁用 SELinux

/etc/selinux/config 中的配置修改为 disabled

检查 ulimit 信息

$ vi /etc/security/limits.d/99-oceanbase_limits.conf
root soft nofile 655350
root hard nofile 655350
admin soft nofile 655350
admin hard nofile 655350
admin soft stack 10240
admin hard stack 10240
admin soft nproc 655360
admin hard nproc 655360
admin soft core unlimited
admin hard core unlimited

更多配置参考官方文档 主机标准化检查项

安装OBD

挂载os iso,安装yum-utils
$ cd /etc/yum.repos.d

$ vi public-yum-ol7.repo
[oel7]
name = Enterprise Linux 7.9 DVD
baseurl=file:///media/disk/
gpgcheck=0
enabled=1

# yum install -y yum-utils
...
Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8

# yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
...
repo saved to /etc/yum.repos.d/OceanBase.repo

# yum install -y ob-deploy
...
Installed:
  ob-deploy.x86_64 0:2.9.2-1.el7

 OBD将安装包添加至本地镜像

[root@localhost ~]# obd mirror clone oceanbase-4.2.1.2-102010012023120119.el7.x86_64.rpm

name: oceanbase
version: 4.2.1.2
release:102010012023120119.el7
arch: x86_64
md5: 33c161d94a6ac640c5ae5c1293ff32eddd31445c
size: 860805515
add oceanbase-4.2.1.2-102010012023120119.el7.x86_64.rpm to local mirror
Trace ID: c1c9e548-4579-11ef-8885-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace c1c9e548-4579-11ef-8885-0800270d9b44

[root@localhost ~]# obd mirror clone obproxy-4.2.1.0-20231017181929.el7.x86_64.rpm
name: obproxy
version: 4.2.1.0
release:20231017181929.el7
arch: x86_64
md5: 18a7fedecac8d12d8491050f8f5c13a81a499c5d
size: 164364793
add obproxy-4.2.1.0-20231017181929.el7.x86_64.rpm to local mirror
Trace ID: d03a546e-4579-11ef-8173-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace d03a546e-4579-11ef-8173-0800270d9b44

--禁用远程仓库
[root@localhost ~]# obd mirror disable remote
Disable remote ok

[root@localhost ~]# obd mirror list
+-----------------------------------------------------------------------------+
|                            Mirror Repository List                           |
+----------------------------+--------+---------+----------+------------------+
| SectionName                | Type   | Enabled | Avaiable | Update Time      |
+----------------------------+--------+---------+----------+------------------+
| local                      | local  | -       | True     | 2024-07-18 22:54 |
| oceanbase.community.stable | remote | False   | False    | 1969-12-31 19:00 |
| oceanbase.development-kit  | remote | False   | False    | 1969-12-31 19:00 |
+----------------------------+--------+---------+----------+------------------+

[root@localhost ~]# obd mirror list local
+--------------------------------------------------------------------------------------------------+
|                                        local Package List                                        |
+-----------+---------+------------------------+--------+------------------------------------------+
| name      | version | release                | arch   | md5                                      |
+-----------+---------+------------------------+--------+------------------------------------------+
| oceanbase | 4.2.1.2 | 102010012023120119.el7 | x86_64 | 33c161d94a6ac640c5ae5c1293ff32eddd31445c |
| obproxy   | 4.2.1.0 | 20231017181929.el7     | x86_64 | 18a7fedecac8d12d8491050f8f5c13a81a499c5d |
+-----------+---------+------------------------+--------+------------------------------------------+

[root@localhost ~]#  obd devmode enable
Dev Mode: ON

Note:  开启开发者模式,是使用工具命令组的前提。开启开发者模式后,会出现部分异常报错被降级,OBD 忽略异常参数等情况。非内核开发人员请谨慎使用。禁用obd devmode disable

安装客户端

[root@localhost ~]# yum -y install libaio-devel.x86_64
...
Installed:
  libaio-devel.x86_64 0:0.3.109-13.el7

[root@localhost ~]# yum install libobclient
...
Installed:
  libobclient.x86_64 0:2.2.6-3.el7

[root@localhost ~]# yum install obclient
...
Installed:
  obclient.x86_64 0:2.2.6-1.el7

配置OBD配置文件

因为我们obd 是通过直接下载的方式安装,可在 /usr/obd/example 目录下查看 obd 提供的配置文件示例

# vi 1ecs-1ob.yaml

user:
  username: root
  password: www.anbob.com      
#  key_file: your ssh-key file path if need
  port:  22
#  timeout: ssh connection timeout (second), default 30
oceanbase:
  servers:
    - 192.168.56.100    
  global:
    home_path: /root/observer
    # 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: enp0s8    
    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
    memory_limit: 10G
    system_memory: 4G
    stack_size: 512K
    cpu_count: 16
    cache_wash_threshold: 1G
    __min_full_resource_pool_memory: 1184354560  # large than 1G
    workers_per_cpu_quota: 10
    schema_history_expire_time: 1d
    net_thread_count: 4
    major_freeze_duty_time: Disable
    minor_freeze_times: 10
    enable_separate_sys_clog: 0
    enable_merge_by_turn: FALSE
    datafile_disk_percentage: 20
    syslog_level: INFO
    enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true.
    enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.
    max_syslog_file_count: 10 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
    # observer cluster name, consistent with obproxy's cluster_name
    appname: ob_test
    # root_password: # root user password, can be empty
    # proxyro_password: # proxyro user pasword, consistent with obproxy's observer_sys_password, can be empty
obproxy:
  depends:
    - oceanbase
  servers:
    - 192.168.56.100    
  global:
    listen_port: 2883
    prometheus_listen_port: 2884
    home_path: /root/obproxy
    enable_cluster_checkout: false
    skip_proxy_sys_private_check: true
    enable_strict_kernel_release: false

更多配置 参数 官方文档 , 这里仅为了快速安装,安装在root用户下,如果要非root,如使用admin, 可以修复参数文件 修改用户信息

## Only need to configure when remote login is required
user:
  username: admin
#   password: your password if need
  key_file: /home/admin/.ssh/id_rsa
#   port: your ssh port, default 22
#   timeout: ssh connection timeout (second), default 30

username 为登录到目标机器的用户名,确保您的用户名有 home_path 的写权限。password 和 key_file 均用于验证用户,通常情况下只需要填写一个

obd安装部署

[root@localhost ~]# obd cluster deploy ob_test -c 1ecs-1ob.yaml
+------------------------------------------------------------------------------------------+
|                                         Packages                                         |
+------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release                | Md5                                      |
+------------+---------+------------------------+------------------------------------------+
| oceanbase  | 4.2.1.2 | 102010012023120119.el7 | 33c161d94a6ac640c5ae5c1293ff32eddd31445c |
| obproxy    | 4.2.1.0 | 20231017181929.el7     | 18a7fedecac8d12d8491050f8f5c13a81a499c5d |
+------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Load param plugin ok
Open ssh connection ok
Parameter check ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
Remote oceanbase-4.2.1.2-102010012023120119.el7-33c161d94a6ac640c5ae5c1293ff32eddd31445c repository install ok
Remote oceanbase-4.2.1.2-102010012023120119.el7-33c161d94a6ac640c5ae5c1293ff32eddd31445c repository lib check ok
Remote obproxy-4.2.1.0-20231017181929.el7-18a7fedecac8d12d8491050f8f5c13a81a499c5d repository install ok
Remote obproxy-4.2.1.0-20231017181929.el7-18a7fedecac8d12d8491050f8f5c13a81a499c5d repository lib check ok
ob_test deployed
Please execute ` obd cluster start ob_test ` to start
Trace ID: d568ddfe-457c-11ef-9522-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace d568ddfe-457c-11ef-9522-0800270d9b44

Note:
如果配置文本中__min_full_resource_pool_memory 配置的小会提示报错如下 ,而在V3版本要求更低.
Parameter check x
[ERROR] __min_full_resource_pool_memory less then 1073741824

启动OB集群

[root@localhost ~]# obd cluster start ob_test
Get local repositories ok
Search plugins ok
Load cluster param plugin ok
Open ssh connection ok
Check before start observer ok
[WARN] OBD-2009: (192.168.56.100): when production_mode is True, memory_limit can not be less then 16384M
[WARN] OBD-1007: (192.168.56.100) The recommended number of stack size is unlimited (Current value: 20480)
[WARN] OBD-2000: (192.168.56.100) not enough memory. (Free: 12246M, Need: 12288M)
[WARN] OBD-1012: (192.168.56.100) clog and data use the same disk (/)

Check before start obproxy ok
Start observer ok
observer program health check x
[WARN] OBD-2002: Failed to start 192.168.56.100 observer
[ERROR] oceanbase start failed
See https://www.oceanbase.com/product/ob-deployer/error-codes .
Trace ID: 9810888e-457d-11ef-8fb6-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace 9810888e-457d-11ef-8fb6-0800270d9b44


查看错误日志
[root@localhost ~]# obd display-trace 9810888e-457d-11ef-8fb6-0800270d9b44

[2024-07-18 23:18:46.813] [DEBUG] -- 192.168.56.100 program health check
[2024-07-18 23:18:46.814] [DEBUG] -- root@192.168.56.100 execute: cat /root/observer/run/observer.pid
[2024-07-18 23:18:47.337] [DEBUG] -- exited code 0
[2024-07-18 23:18:47.374] [DEBUG] -- root@192.168.56.100 execute: ls /proc/8473
[2024-07-18 23:18:47.445] [ERROR] Traceback (most recent call last):
[2024-07-18 23:18:47.445] [ERROR]   File "ssh.py", line 463, in _execute_command
[2024-07-18 23:18:47.445] [ERROR]   File "paramiko/client.py", line 510, in exec_command
[2024-07-18 23:18:47.445] [ERROR]   File "paramiko/transport.py", line 919, in open_session
[2024-07-18 23:18:47.445] [ERROR]   File "paramiko/transport.py", line 1050, in open_channel
[2024-07-18 23:18:47.445] [ERROR] paramiko.ssh_exception.SSHException: Unable to open channel.
[2024-07-18 23:18:47.445] [ERROR]
[2024-07-18 23:18:47.445] [ERROR] During handling of the above exception, another exception occurred:
[2024-07-18 23:18:47.445] [ERROR]
[2024-07-18 23:18:47.445] [ERROR] Traceback (most recent call last):
[2024-07-18 23:18:47.445] [ERROR]   File "core.py", line 2065, in start_cluster
[2024-07-18 23:18:47.445] [ERROR]   File "core.py", line 2159, in _start_cluster
[2024-07-18 23:18:47.445] [ERROR]   File "core.py", line 197, in call_plugin
[2024-07-18 23:18:47.445] [ERROR]   File "_plugin.py", line 348, in __call__
[2024-07-18 23:18:47.445] [ERROR]   File "_plugin.py", line 305, in _new_func
[2024-07-18 23:18:47.445] [ERROR]   File "/root/.obd/plugins/oceanbase/4.2.0.0/start.py", line 229, in start
[2024-07-18 23:18:47.445] [ERROR]     if remote_pid and client.execute_command('ls /proc/%s' % remote_pid):
...

[root@localhost ~]# ls ~/.ssh/id_rsa.pub
ls: cannot access /root/.ssh/id_rsa.pub: No such file or directory

[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:2dgbM94GdQTL4bXqdMrG5PCSzffAj/mNZm65RjdwFVg root@localhost.localdomain

[root@localhost ~]# obd cluster start ob_test
Get local repositories ok
Search plugins ok
Load cluster param plugin ok
Open ssh connection ok
Check before start observer ok
[WARN] OBD-2009: (192.168.56.100): when production_mode is True, memory_limit can not be less then 16384M
[WARN] OBD-1007: (192.168.56.100) The recommended number of stack size is unlimited (Current value: 20480)
[WARN] OBD-2000: (192.168.56.100) not enough memory. (Free: 12198M, Need: 12288M)
[WARN] OBD-1012: (192.168.56.100) clog and data use the same disk (/)

Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer 192.168.56.100:2881 ok
Initialize oceanbase ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize obproxy ok
Wait for observer init ok
+--------------------------------------------------+
|                     observer                     |
+----------------+---------+------+-------+--------+
| ip             | version | port | zone  | status |
+----------------+---------+------+-------+--------+
| 192.168.56.100 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
+----------------+---------+------+-------+--------+
obclient -h192.168.56.100 -P2881 -uroot -p'3NFSGBtz431cSHiGUR1F' -Doceanbase -A

cluster unique id: 509eb762-74ac-5fbd-a353-782b7bb03088-190c944ece7-02010204

+--------------------------------------------------+
|                     obproxy                      |
+----------------+------+-----------------+--------+
| ip             | port | prometheus_port | status |
+----------------+------+-----------------+--------+
| 192.168.56.100 | 2883 | 2884            | active |
+----------------+------+-----------------+--------+
obclient -h192.168.56.100 -P2883 -uroot@proxysys -p'nKmwiON31v' -Doceanbase -A

ob_test running
Trace ID: c7dfcf0c-4587-11ef-a777-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace c7dfcf0c-4587-11ef-a777-0800270d9b44
[root@localhost ~]#

Note:
启动中提示的内存低于配置warning 但不影响测试。 记录上面的密码,就可以使用root 连OB sys租户管理了,或通过obproxy。

登录管理租户并创建1个oracle租户

创建resource unit

仅 sys 租户的 root 用户(root@sys)可以创建 Unit,其他租户不支持创建 Unit。

# v3
create resource unit unit1 max_cpu=1, min_cpu=1, max_memory='2G', min_memory='2G', max_iops=128, max_disk_size='10G', max_session_num=100;

#v4
CREATE RESOURCE UNIT unit1 MAX_CPU 1, MEMORY_SIZE '2G', MAX_IOPS 1280,LOG_DISK_SIZE '10G', MIN_IOPS=1024, IOPS_WEIGHT=1;

obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE NAME='unit1';
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------+----------+-------------+
| UNIT_CONFIG_ID | NAME  | CREATE_TIME                | MODIFY_TIME                | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT |
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------+----------+-------------+
|           1001 | unit1 | 2024-07-19 12:56:01.090502 | 2024-07-19 12:56:01.090502 |       1 |       1 |  2147483648 |   10737418240 |     1280 |     1024 |           1 |
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------+----------+-------------+

-- or --
select * from oceanbase.__all_unit_config;

Note:

Unit 的资源规格定义的是单个 Zone 内单个 OBServer 节点可分配的资源总量,包括 CPU、内存、日志盘存储空间、IOPS 等

创建resurce pool

仅 sys 租户的 root 用户(root@sys)可以创建资源池,其他租户不支持创建资源池。

# 如果参数配置不合理,这步会报错
obclient [test]> create resource pool pool1_ora unit='unit1', unit_num=1, zone_list=('zone1');
ERROR 1235 (0A000): unit MEMORY_SIZE less than __min_full_resource_pool_memory not supported

obclient [oceanbase]> create resource pool pool1_ora unit='unit1', unit_num=1, zone_list=('zone1');
Query OK, 0 rows affected (1.814 sec)

obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_RESOURCE_POOLS
    -> ;
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME      | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
|                1 | sys_pool  |         1 | 2024-07-19 12:34:11.200934 | 2024-07-19 12:34:12.142473 |          1 |              1 | zone1     | FULL         |
|             1001 | pool1_ora |      1002 | 2024-07-19 14:42:47.661062 | 2024-07-19 14:53:50.136394 |          1 |           1001 | zone1     | FULL         |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
2 rows in set (0.152 sec)

Note:

资源池描述了可以分配给租户的资源单元集合,每个资源池仅能绑定给一个租户,租户在各 Zone 内被分配的所有资源总量为:Unit 规格 * Unit 数量。

创建租户tenant

obclient [oceanbase]> CREATE TENANT ob_ora charset='gbk', replica_num=1, zone_list=('zone1'), resource_pool_list=('pool1_ora') SET ob_tcp_invited_nodes='%', ob_compatibility_mode='oracle';
Query OK, 0 rows affected (5 min 16.436 sec)

obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
|         1 | sys         | SYS         | 2024-07-19 12:34:13.543530 | 2024-07-19 12:34:13.543530 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.2.1.2    |         1 |
|      1001 | META$1002   | META        | 2024-07-19 14:53:49.567809 | 2024-07-19 14:58:32.607496 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.2.1.2    |         1 |
|      1002 | ob_ora      | USER        | 2024-07-19 14:53:49.679136 | 2024-07-19 14:58:34.562040 | RANDOM       | FULL{1}@zone1 | NULL              | ORACLE             | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1721373249059063564 | 1721373249059063564 | 1721373248534052981 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        1 | 4.2.1.2    |      1001 |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
3 rows in set (1.772 sec)

NOTE:
默认管理员用户(MySQL 模式为 root,Oracle 模式为 sys)的密码为空,您需要及时修改管理员用户的密码。

登录应用租户

root@localhost ~]# obclient -h192.168.56.100 -P2881 -usys@ob_ora

Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221487644
Server version: OceanBase 4.2.1.2 (r102010012023120119-130bf91ba413a00bb696fe8853906fde1f29f83d) (Built Dec  1 2023 20:00:25)
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 [SYS]> create user anbob identified by anbob;
Query OK, 0 rows affected (3.273 sec)

obclient [SYS]> grant dba to anbob;
Query OK, 0 rows affected (1.695 sec)

[root@localhost ~]# obclient -h192.168.56.100 -P2881 -uanbob@ob_ora  -p'anbob'
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221487646
Server version: OceanBase 4.2.1.2 (r102010012023120119-130bf91ba413a00bb696fe8853906fde1f29f83d) (Built Dec  1 2023 20:00:25)

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 [ANBOB]> select * from NLS_DATABASE_PARAMETERS;
+-------------------------+------------------------------+
| PARAMETER               | VALUE                        |
+-------------------------+------------------------------+
| NLS_DATE_FORMAT         | DD-MON-RR                    |
| NLS_TIMESTAMP_FORMAT    | DD-MON-RR HH.MI.SSXFF AM     |
| NLS_TIMESTAMP_TZ_FORMAT | DD-MON-RR HH.MI.SSXFF AM TZR |
| NLS_TERRITORY           | AMERICA                      |
| NLS_SORT                | BINARY                       |
| NLS_COMP                | BINARY                       |
| NLS_CHARACTERSET        | ZHS16GBK                     |
| NLS_NCHAR_CHARACTERSET  | AL16UTF16                    |
| NLS_DATE_LANGUAGE       | AMERICAN                     |
| NLS_LENGTH_SEMANTICS    | BYTE                         |
| NLS_NCHAR_CONV_EXCP     | FALSE                        |
| NLS_CALENDAR            | GREGORIAN                    |
| NLS_NUMERIC_CHARACTERS  | .,                           |
| NLS_CURRENCY            | $                            |
| NLS_ISO_CURRENCY        | AMERICA                      |
| NLS_DUAL_CURRENCY       | $                            |
+-------------------------+------------------------------+
16 rows in set (0.172 sec)

停止集群

[root@localhost ~]# obd cluster stop ob_test
Get local repositories ok
Search plugins ok
Open ssh connection ok
Stop observer ok
Stop obproxy ok
ob_test stopped
Trace ID: 29657424-45bb-11ef-8f8a-0800270d9b44
If you want to view detailed obd logs, please run: obd display-trace 29657424-45bb-11ef-8f8a-0800270d9b44

OK, 开始OB之旅吧。

打赏

,

对不起,这篇文章暂时关闭评论。