:注意虚拟机内存至少12G ,手动部署 OceanBase 三副本集群是在同一节点上部署。
下面的实验过程入
[root@db3 ~]# docker run -d --name chfyob16 -h chfyob16 -p 12881-12889:2881-2889 -v /sys/fs/cgroup:/sys/fs/cgroup --privileged=true centos76:8.5 /usr/sbin/init
d9f39a69cfc1baa161135b24008119b21c89dda58b5a184824601339e57446a5
[root@db3 ~]# docker exec -it chfyob16 bash
[root@chfyob16 /]# useradd admin
[root@chfyob16 /]# echo "admin:lhr" | chpasswd
[root@chfyob16 /]# chown -R admin:admin /home/admin
[root@chfyob16 /]# echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
[root@chfyob16 /]# rpm -ivh /soft/*.rpm
warning: /soft/obproxy-3.2.0-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:oceanbase-ce-libs-3.1.1-4.el7 ################################# [ 33%]
2:oceanbase-ce-3.1.1-4.el7 ################################# [ 67%]
3:obproxy-3.2.0-1.el7 ################################# [100%]
[root@chfyob16 /]# echo "export PATH=$PATH:/home/admin/oceanbase/bin:/home/admin/obproxy-3.2.0/bin" >> /home/admin/.bash_profile
[root@chfyob16 /]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib/" >> /home/admin/.bash_profile
[root@chfyob16 /]# source /home/admin/.bash_profile
[root@chfyob16 /]# yum install -y yum-utils
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/3): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(2/3): epel/x86_64/primary_db | 7.0 MB 00:00:01
(3/3): updates/7/x86_64/primary_db | 13 MB 00:00:02
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
[root@chfyob16 /]# yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
Loaded plugins: fastestmirror, ovl
adding repo from: https://mirrors.aliyun.com/oceanbase/OceanBase.repo
grabbing file https://mirrors.aliyun.com/oceanbase/OceanBase.repo to /etc/yum.repos.d/OceanBase.repo
repo saved to /etc/yum.repos.d/OceanBase.repo
[root@chfyob16 /]# yum install -y obclient mariadb mariadb-libs mariadb-devel
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
oceanbase.community.stable | 3.0 kB 00:00:00
oceanbase.development-kit | 3.0 kB 00:00:00
(1/2): oceanbase.community.stable/7/x86_64/primary_db | 23 kB 00:00:00
(2/2): oceanbase.development-kit/7/x86_64/primary_db | 16 kB 00:00:00
Package 1:mariadb-libs-5.5.68-1.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed
---> Package mariadb-devel.x86_64 1:5.5.68-1.el7 will be installed
---> Package obclient.x86_64 0:2.0.0-2.el7 will be installed
--> Processing Dependency: libobclient >= 2.0.0 for package: obclient-2.0.0-2.el7.x86_64
--> Running transaction check
---> Package libobclient.x86_64 0:2.0.0-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
mariadb x86_64 1:5.5.68-1.el7 base 8.8 M
mariadb-devel x86_64 1:5.5.68-1.el7 base 757 k
obclient x86_64 2.0.0-2.el7 oceanbase.community.stable 40 M
Installing for dependencies:
libobclient x86_64 2.0.0-2.el7 oceanbase.community.stable 643 k
Transaction Summary
=============================================================================================================================================================
Install 3 Packages (+1 Dependent package)
Total download size: 50 M
Installed size: 240 M
Downloading packages:
(1/4): mariadb-devel-5.5.68-1.el7.x86_64.rpm | 757 kB 00:00:00
warning: /var/cache/yum/x86_64/7/oceanbase.community.stable/packages/libobclient-2.0.0-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY
Public key for libobclient-2.0.0-2.el7.x86_64.rpm is not installed
(2/4): libobclient-2.0.0-2.el7.x86_64.rpm | 643 kB 00:00:00
(3/4): mariadb-5.5.68-1.el7.x86_64.rpm | 8.8 MB 00:00:01
(4/4): obclient-2.0.0-2.el7.x86_64.rpm | 40 MB 00:00:04
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 50 MB 00:00:04
Retrieving key from http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase
Importing GPG key 0xE9B4A7AA:
Userid : "OceanBase"
Fingerprint: ef7d e8e3 6987 b60c acf9 9a53 2ff8 45a6 e9b4 a7aa
From : http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : libobclient-2.0.0-2.el7.x86_64 1/4
Installing : obclient-2.0.0-2.el7.x86_64 2/4
Installing : 1:mariadb-devel-5.5.68-1.el7.x86_64 3/4
Installing : 1:mariadb-5.5.68-1.el7.x86_64 4/4
Verifying : 1:mariadb-5.5.68-1.el7.x86_64 1/4
Verifying : 1:mariadb-devel-5.5.68-1.el7.x86_64 2/4
Verifying : libobclient-2.0.0-2.el7.x86_64 3/4
Verifying : obclient-2.0.0-2.el7.x86_64 4/4
Installed:
mariadb.x86_64 1:5.5.68-1.el7 mariadb-devel.x86_64 1:5.5.68-1.el7 obclient.x86_64 0:2.0.0-2.el7
Dependency Installed:
libobclient.x86_64 0:2.0.0-2.el7
Complete!
[root@chfyob16 /]# mkdir -p /{data1,data2,data3}/chfyob/sstable
[root@chfyob16 /]# mkdir -p /{redo1,redo2,redo3}/chfyob/clog
[root@chfyob16 /]# mkdir -p /{redo1,redo2,redo3}/chfyob/slog
[root@chfyob16 /]# mkdir -p /{redo1,redo2,redo3}/chfyob/ilog
[root@chfyob16 /]# chown -R admin:admin /data*
[root@chfyob16 /]# chown -R admin:admin /redo*
[root@chfyob16 /]# chown -R admin:admin /home/admin
[root@chfyob16 /]# chmod -R 755 /data*
[root@chfyob16 /]# chmod -R 755 /redo*
[root@chfyob16 /]# chmod -R 755 /home/admin
[root@chfyob16 /]# su - admin
[admin@chfyob16 ~]$ mkdir -p /home/admin/oceanbase/{store1,store2,store3}/chfyob
[admin@chfyob16 ~]$
[admin@chfyob16 ~]$
[admin@chfyob16 ~]$ ln -s /data1/chfyob/sstable /home/admin/oceanbase/store1/chfyob/sstable
[admin@chfyob16 ~]$ ln -s /data2/chfyob/sstable /home/admin/oceanbase/store2/chfyob/sstable
[admin@chfyob16 ~]$ ln -s /data3/chfyob/sstable /home/admin/oceanbase/store3/chfyob/sstable
[admin@chfyob16 ~]$
[admin@chfyob16 ~]$ ln -s /redo1/chfyob/clog /home/admin/oceanbase/store1/chfyob/clog
[admin@chfyob16 ~]$ ln -s /redo1/chfyob/slog /home/admin/oceanbase/store1/chfyob/slog
[admin@chfyob16 ~]$ ln -s /redo1/chfyob/ilog /home/admin/oceanbase/store1/chfyob/ilog
[admin@chfyob16 ~]$
[admin@chfyob16 ~]$ ln -s /redo2/chfyob/clog /home/admin/oceanbase/store2/chfyob/clog
[admin@chfyob16 ~]$ ln -s /redo2/chfyob/slog /home/admin/oceanbase/store2/chfyob/slog
[admin@chfyob16 ~]$ ln -s /redo2/chfyob/ilog /home/admin/oceanbase/store2/chfyob/ilog
[admin@chfyob16 ~]$
[admin@chfyob16 ~]$ ln -s /redo3/chfyob/clog /home/admin/oceanbase/store3/chfyob/clog
[admin@chfyob16 ~]$ ln -s /redo3/chfyob/slog /home/admin/oceanbase/store3/chfyob/slog
[admin@chfyob16 ~]$ ln -s /redo3/chfyob/ilog /home/admin/oceanbase/store3/chfyob/ilog
[admin@chfyob16 ~]$ cd /home/admin/oceanbase/store1 && /home/admin/oceanbase/bin/observer -r "127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881" -o "__min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4" -z zone1 -p 2881 -P 2882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store1/chfyob -i lo -l ERROR
/home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone1 -p 2881 -P 2882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store1/chfyob -i lo -l ERROR
rs list: 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881
optstr: __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4
zone: zone1
mysql port: 2881
rpc port: 2882
cluster id: 20220115
appname: chfyob
data_dir: /home/admin/oceanbase/store1/chfyob
devname: lo
log level: ERROR
[admin@chfyob16 store1]$ cd /home/admin/oceanbase/store2 && /home/admin/oceanbase/bin/observer -r "127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881" -o "__min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4" -z zone2 -p 3881 -P 3882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store2/chfyob -i lo -l ERROR
/home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone2 -p 3881 -P 3882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store2/chfyob -i lo -l ERROR
rs list: 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881
optstr: __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4
zone: zone2
mysql port: 3881
rpc port: 3882
cluster id: 20220115
appname: chfyob
data_dir: /home/admin/oceanbase/store2/chfyob
devname: lo
log level: ERROR
[admin@chfyob16 store2]$ cd /home/admin/oceanbase/store3 && /home/admin/oceanbase/bin/observer -r "127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881" -o "__min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4" -z zone3 -p 4881 -P 4882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store3/chfyob -i lo -l ERROR
/home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone3 -p 4881 -P 4882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store3/chfyob -i lo -l ERROR
rs list: 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881
optstr: __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4
zone: zone3
mysql port: 4881
rpc port: 4882
cluster id: 20220115
appname: chfyob
data_dir: /home/admin/oceanbase/store3/chfyob
devname: lo
log level: ERROR
[admin@chfyob16 store3]$ ps -ef |grep observer
admin 734 0 67 12:45 ? 00:00:17 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone1 -p 2881 -P 2882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store1/chfyob -i lo -l ERROR
admin 1312 0 69 12:45 ? 00:00:12 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone2 -p 3881 -P 3882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store2/chfyob -i lo -l ERROR
admin 1889 0 71 12:45 ? 00:00:07 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone3 -p 4881 -P 4882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store3/chfyob -i lo -l ERROR
admin 2468 641 0 12:45 pts/0 00:00:00 grep --color=auto observer
[admin@chfyob16 store3]$ netstat -tulnp | grep 88
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 734/observer
tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 734/observer
tcp 0 0 0.0.0.0:3881 0.0.0.0:* LISTEN 1312/observer
tcp 0 0 0.0.0.0:3882 0.0.0.0:* LISTEN 1312/observer
tcp 0 0 0.0.0.0:4881 0.0.0.0:* LISTEN 1889/observer
tcp 0 0 0.0.0.0:4882 0.0.0.0:* LISTEN 1889/observer
[admin@chfyob16 obproxy-3.2.0]$ tree /home/admin/oceanbase/
/home/admin/oceanbase/
├── bin
│ ├── import_time_zone_info.py
│ └── observer
├── etc
│ └── timezone_V1.log
├── lib
│ ├── libaio.so -> libaio.so.1.0.1
│ ├── libaio.so.1 -> libaio.so.1.0.1
│ ├── libaio.so.1.0.1
│ ├── libmariadb.so -> libmariadb.so.3
│ └── libmariadb.so.3
├── store1
│ ├── chfyob
│ │ ├── clog -> /redo1/chfyob/clog
│ │ ├── ilog -> /redo1/chfyob/ilog
│ │ ├── slog -> /redo1/chfyob/slog
│ │ └── sstable -> /data1/chfyob/sstable
│ ├── etc
│ │ ├── observer.config.bin
│ │ └── observer.config.bin.history
│ ├── etc2
│ │ ├── observer.conf.bin
│ │ └── observer.conf.bin.history
│ ├── etc3
│ │ ├── observer.conf.bin
│ │ └── observer.conf.bin.history
│ ├── log
│ │ ├── election.log
│ │ ├── election.log.wf
│ │ ├── observer.log
│ │ ├── observer.log.wf
│ │ ├── rootservice.log
│ │ └── rootservice.log.wf
│ └── run
│ ├── mysql.sock
│ └── observer.pid
├── store2
│ ├── chfyob
│ │ ├── clog -> /redo2/chfyob/clog
│ │ ├── ilog -> /redo2/chfyob/ilog
│ │ ├── slog -> /redo2/chfyob/slog
│ │ └── sstable -> /data2/chfyob/sstable
│ ├── etc
│ │ ├── observer.config.bin
│ │ └── observer.config.bin.history
│ ├── etc2
│ │ ├── observer.conf.bin
│ │ └── observer.conf.bin.history
│ ├── etc3
│ │ ├── observer.conf.bin
│ │ └── observer.conf.bin.history
│ ├── log
│ │ ├── election.log
│ │ ├── election.log.wf
│ │ ├── observer.log
│ │ ├── observer.log.wf
│ │ ├── rootservice.log
│ │ └── rootservice.log.wf
│ └── run
│ ├── mysql.sock
│ └── observer.pid
└── store3
├── chfyob
│ ├── clog -> /redo3/chfyob/clog
│ ├── ilog -> /redo3/chfyob/ilog
│ ├── slog -> /redo3/chfyob/slog
│ └── sstable -> /data3/chfyob/sstable
├── etc
│ ├── observer.config.bin
│ └── observer.config.bin.history
├── etc2
│ ├── observer.conf.bin
│ └── observer.conf.bin.history
├── etc3
│ ├── observer.conf.bin
│ └── observer.conf.bin.history
├── log
│ ├── election.log
│ ├── election.log.wf
│ ├── observer.log
│ ├── observer.log.wf
│ ├── rootservice.log
│ └── rootservice.log.wf
└── run
├── mysql.sock
└── observer.pid
36 directories, 50 files
[admin@chfyob16 store3]$ mysql -h127.1 -uroot -P2881 -p -c -A
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3221225472
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> set session ob_query_timeout=1000000000;
Query OK, 0 rows affected (0.00 sec)
MySQL [(none)]> alter system bootstrap ZONE 'zone1' SERVER '127.0.0.1:2882',ZONE 'zone2' SERVER '127.0.0.1:3882',ZONE 'zone3' SERVER '127.0.0.1:4882';
Query OK, 0 rows affected (26.89 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 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
| 2022-01-16 12:46:47.302035 | 2022-01-16 12:47:03.447633 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308419463603 | 0 | 1 | 0 |
| 2022-01-16 12:46:47.280364 | 2022-01-16 12:47:01.728874 | 127.0.0.1 | 3882 | 2 | zone2 | 3881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308419701795 | 0 | 1 | 0 |
| 2022-01-16 12:46:47.298825 | 2022-01-16 12:47:00.086398 | 127.0.0.1 | 4882 | 3 | zone3 | 4881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308420083258 | 0 | 1 | 0 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
3 rows in set (0.02 sec)
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
+--------------------+
7 rows in set (0.03 sec)
MySQL [(none)]> use oceanbase
Database changed
MySQL [oceanbase]> select zone, svr_ip, svr_port, with_rootserver, status from __all_server order by zone, with_rootserver desc;
+-------+-----------+----------+-----------------+--------+
| zone | svr_ip | svr_port | with_rootserver | status |
+-------+-----------+----------+-----------------+--------+
| zone1 | 127.0.0.1 | 2882 | 1 | active |
| zone2 | 127.0.0.1 | 3882 | 0 | active |
| zone3 | 127.0.0.1 | 4882 | 0 | active |
+-------+-----------+----------+-----------------+--------+
3 rows in set (0.00 sec)
MySQL [oceanbase]> alter user root identified by 'chfy';
create user proxyro identified by 'chfy';
grant select on *.* to proxyro;
create database chfydb;
Query OK, 0 rows affected (0.07 sec)
MySQL [oceanbase]> create user proxyro identified by 'chfy';
Query OK, 0 rows affected (0.06 sec)
MySQL [oceanbase]> grant select on *.* to proxyro;
Query OK, 0 rows affected (0.03 sec)
MySQL [oceanbase]> create database chfydb;
Query OK, 1 row affected (0.03 sec)
MySQL [oceanbase]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
| chfydb |
+--------------------+
8 rows in set (0.00 sec)
MySQL [oceanbase]> exit
Bye
[admin@chfyob16 store3]$ mysql -h127.1 -uroot -P2881 -pchfy -c -A -e "show databases;"
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
| chfydb |
+--------------------+
[admin@chfyob16 store3]$ mysql -h127.1 -uroot -P3881 -pchfy -c -A -e "show databases;"
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
| chfydb |
+--------------------+
[admin@chfyob16 store3]$ mysql -h127.1 -uroot -P4881 -pchfy -c -A -e "show databases;"
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
| chfydb |
+--------------------+
[admin@chfyob16 store3]$ cd /home/admin/obproxy-3.2.0/ && /home/admin/obproxy-3.2.0/bin/obproxy -r "127.0.0.1:2881" -p 2883 -o "enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false" -c 20220115
/home/admin/obproxy-3.2.0/bin/obproxy -r 127.0.0.1:2881 -p 2883 -o enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false -c 20220115
rs list: 127.0.0.1:2881
listen port: 2883
optstr: enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false
cluster_name: 20220115
[admin@chfyob16 obproxy-3.2.0]$ netstat -ntlp | grep obproxy
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:2883 0.0.0.0:* LISTEN 2673/obproxy
tcp 0 0 0.0.0.0:2884 0.0.0.0:* LISTEN 2673/obproxy
[admin@chfyob16 obproxy-3.2.0]$ netstat -ntlp | grep 88
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 734/observer
tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 734/observer
tcp 0 0 0.0.0.0:2883 0.0.0.0:* LISTEN 2673/obproxy
tcp 0 0 0.0.0.0:2884 0.0.0.0:* LISTEN 2673/obproxy
tcp 0 0 0.0.0.0:3881 0.0.0.0:* LISTEN 1312/observer
tcp 0 0 0.0.0.0:3882 0.0.0.0:* LISTEN 1312/observer
tcp 0 0 0.0.0.0:4881 0.0.0.0:* LISTEN 1889/observer
tcp 0 0 0.0.0.0:4882 0.0.0.0:* LISTEN 1889/observer
[admin@chfyob16 obproxy-3.2.0]$ ps -ef|grep ob
admin 734 0 94 12:45 ? 00:04:15 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone1 -p 2881 -P 2882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store1/chfyob -i lo -l ERROR
admin 1312 0 85 12:45 ? 00:03:45 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone2 -p 3881 -P 3882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store2/chfyob -i lo -l ERROR
admin 1889 0 86 12:45 ? 00:03:39 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881;127.0.0.1:3882:3881;127.0.0.1:4882:4881 -o __min_full_resource_pool_memory=268435456,memory_limit=8G,system_memory=4G,stack_size=512K,cpu_count=16,cache_wash_threshold=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_size=5G,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 -z zone3 -p 4881 -P 4882 -c 20220115 -n chfyob -d /home/admin/oceanbase/store3/chfyob -i lo -l ERROR
admin 2673 0 1 12:49 ? 00:00:00 /home/admin/obproxy-3.2.0/bin/obproxy -r 127.0.0.1:2881 -p 2883 -o enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false -c 20220115
admin 2723 641 0 12:50 pts/0 00:00:00 grep --color=auto ob
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@proxysys -P2883 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> alter proxyconfig set obproxy_sys_password='chfy';
Query OK, 0 rows affected (0.00 sec)
MySQL [(none)]> alter proxyconfig set observer_sys_password='chfy';
Query OK, 0 rows affected (0.00 sec)
MySQL [(none)]> show proxyconfig like '%sys_password%';
+------------------------+------------------------------------------+--------------------------------+-------------+---------------+
| name | value | info | need_reboot | visible_level |
+------------------------+------------------------------------------+--------------------------------+-------------+---------------+
| observer_sys_password1 | | password for observer sys user | false | SYS |
| observer_sys_password | 7ccfe8e335ca8b35976402146671055fe6a6e06b | password for observer sys user | false | SYS |
| obproxy_sys_password | 7ccfe8e335ca8b35976402146671055fe6a6e06b | password for obproxy sys user | false | SYS |
+------------------------+------------------------------------------+--------------------------------+-------------+---------------+
3 rows in set (0.00 sec)
MySQL [(none)]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@sys -P2883 -pchfy -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> select * from oceanbase.__all_server;
show full processlist;+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
| 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 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
| 2022-01-16 12:46:47.302035 | 2022-01-16 12:47:03.447633 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308419463603 | 0 | 1 | 0 |
| 2022-01-16 12:46:47.280364 | 2022-01-16 12:47:01.728874 | 127.0.0.1 | 3882 | 2 | zone2 | 3881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308419701795 | 0 | 1 | 0 |
| 2022-01-16 12:46:47.298825 | 2022-01-16 12:47:00.086398 | 127.0.0.1 | 4882 | 3 | zone3 | 4881 | 0 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:33:14) | 0 | 1642308420083258 | 0 | 1 | 0 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
3 rows in set (0.03 sec)
MySQL [oceanbase]> show full processlist;
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
| Id | User | Tenant | Host | db | Command | Time | State | Info | Ip | Port | Proxy_sessid |
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
| 3221494694 | root | sys | 127.0.0.1:40752 | oceanbase | Query | 0 | ACTIVE | show full processlist | 127.0.0.1 | 2881 | 2 |
| 3221494696 | proxyro | sys | 127.0.0.1:40756 | oceanbase | Sleep | 1 | SLEEP | NULL | 127.0.0.1 | 2881 | 3 |
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
2 rows in set (0.02 sec)
MySQL [oceanbase]> select unit_config_id, name from __all_unit_config;
+----------------+-----------------+
| unit_config_id | name |
+----------------+-----------------+
| 1 | sys_unit_config |
+----------------+-----------------+
1 row in set (0.01 sec)
MySQL [oceanbase]> select resource_pool_id, name from __all_resource_pool;
+------------------+----------+
| resource_pool_id | name |
+------------------+----------+
| 1 | sys_pool |
+------------------+----------+
1 row in set (0.00 sec)
MySQL [oceanbase]> select tenant_name from __all_tenant;
+-------------+
| tenant_name |
+-------------+
| sys |
+-------------+
1 row in set (0.01 sec)
MySQL [oceanbase]>
MySQL [oceanbase]> CREATE resource unit chfy_unit max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G';
Query OK, 0 rows affected (0.03 sec)
MySQL [oceanbase]> CREATE resource pool my_chfy_pool unit = 'chfy_unit', unit_num = 1;
create tenant obchfy resource_pool_list=('my_chfy_pool'), primary_zone='RANDOM',comment 'mysql tenant/instance', charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';Query OK, 0 rows affected (0.02 sec)
MySQL [oceanbase]> create tenant obchfy resource_pool_list=('my_chfy_pool'), primary_zone='RANDOM',comment 'mysql tenant/instance', charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';
Query OK, 0 rows affected (29.14 sec)
MySQL [oceanbase]> select unit_config_id, name from __all_unit_config;
select resource_pool_id, name from __all_resource_pool;
select tenant_name from __all_tenant;+----------------+-----------------+
| unit_config_id | name |
+----------------+-----------------+
| 1 | sys_unit_config |
| 1001 | chfy_unit |
+----------------+-----------------+
2 rows in set (0.04 sec)
MySQL [oceanbase]> select resource_pool_id, name from __all_resource_pool;
+------------------+--------------+
| resource_pool_id | name |
+------------------+--------------+
| 1 | sys_pool |
| 1001 | my_chfy_pool |
+------------------+--------------+
2 rows in set (0.00 sec)
MySQL [oceanbase]> select tenant_name from __all_tenant;
+-------------+
| tenant_name |
+-------------+
| sys |
| obchfy |
+-------------+
2 rows in set (0.00 sec)
MySQL [oceanbase]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@obchfy -P2883 -p -c -A oceanbase
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> alter user root identified by 'chfy';
grant all privileges on *.* to root@'%';Query OK, 0 rows affected (0.05 sec)
MySQL [oceanbase]> grant all privileges on *.* to root@'%';
Query OK, 0 rows affected (0.02 sec)
MySQL [oceanbase]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@obchfy -P2883 -pchfy -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> create database chfydb;
show databases;
Query OK, 1 row affected (0.03 sec)
MySQL [oceanbase]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| test |
| chfydb |
+--------------------+
5 rows in set (0.01 sec)
MySQL [oceanbase]> use chfydb;
Database changed
MySQL [chfydb]> create table user1(id int(4) primary key, name varchar(20));
insert into user1 values(1, 'timmy');
insert into user1 values(2, 'lucy');
insert into user1 values(3, 'tim');
select * from user1;
Query OK, 0 rows affected (0.10 sec)
MySQL [chfydb]> insert into user1 values(1, 'timmy');
Query OK, 1 row affected (0.06 sec)
MySQL [chfydb]> insert into user1 values(2, 'lucy');
Query OK, 1 row affected (0.03 sec)
MySQL [chfydb]> insert into user1 values(3, 'tim');
Query OK, 1 row affected (0.00 sec)
MySQL [chfydb]> select * from user1;
+----+-------+
| id | name |
+----+-------+
| 1 | timmy |
| 2 | lucy |
| 3 | tim |
+----+-------+
3 rows in set (0.00 sec)
MySQL [chfydb]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@obchfy -P2881 -pchfy -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3221498803
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> use chfydb;
Database changed
MySQL [chfydb]> select * from user1;
+----+-------+
| id | name |
+----+-------+
| 1 | timmy |
| 2 | lucy |
| 3 | tim |
+----+-------+
3 rows in set (0.00 sec)
MySQL [chfydb]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@obchfy -P3881 -pchfy -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3221750844
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> use chfydb;
Database changed
MySQL [chfydb]> select * from user1;
+----+-------+
| id | name |
+----+-------+
| 1 | timmy |
| 2 | lucy |
| 3 | tim |
+----+-------+
3 rows in set (0.01 sec)
MySQL [chfydb]> exit
Bye
[admin@chfyob16 obproxy-3.2.0]$ mysql -h127.1 -uroot@obchfy -P4881 -pchfy -c -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3222016623
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]> use chfydb;
Database changed
MySQL [chfydb]> select * from user1;
+----+-------+
| id | name |
+----+-------+
| 1 | timmy |
| 2 | lucy |
| 3 | tim |
+----+-------+
3 rows in set (0.00 sec)
MySQL [chfydb]>