说明

相关连接:

https://open.oceanbase.com/blog/10900159

https://open.oceanbase.com/answer/detail?id=13700696

练习目的

本次练习目的掌握 OceanBase 集群的手动部署技能,理解进程的相关目录、集群初始化、OBProxy和 OB 集群关系等。

练习条件

有笔记本或服务器,内存至少12G 。

练习内容

请记录并分享下列内容:

  1. (必选)手动部署一个 OB 单副本集群,包括一个 OBProxy 节点。
  2. (必选)创建一个业务租户、一个业务数据库,以及一些表等。
  3. (可选)如果单台服务器内存有32G,或者有三台服务器,改为部署一个 OB 三副本集群,包括一个 OBProxy 节点。
  4. (可选)如果有三台服务器并且服务器内存有 32 G,可以单服务器内启动 2 个节点,实现 1-1-1 扩容到 2-2-2 。

软件下载

下载地址:https://open.oceanbase.com/softwareCenter/community

https://www.oceanbase.com/softwareCenter/community下载3个软件,分别是obproxy-3.2.0-1.el7.x86_64.rpmoceanbase-ce-3.1.1-4.el7.x86_64.rpmoceanbase-ce-libs-3.1.1-4.el7.x86_64.rpm

wget https://mdn.alipayobjects.com/ob_portal/afts/file/A*4VfBRbz_ncIAAAAAAAAAAAAADmF2AQ?af_fileName=oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm
wget https://mdn.alipayobjects.com/ob_portal/afts/file/A*obcATbEfH_QAAAAAAAAAAAAADmF2AQ?af_fileName=oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm
wget https://mdn.alipayobjects.com/ob_portal/afts/file/A*mMziSJneiZcAAAAAAAAAAAAADmF2AQ?af_fileName=obproxy-3.2.0-1.el7.x86_64.rpm

手动部署一个 OB 单副本集群

环境准备

docker rm -f lhrob312
docker run -d --name lhrob312 -h lhrob312 \-p 12881-12889:2881-2889 \-v /sys/fs/cgroup:/sys/fs/cgroup \--privileged=true lhrbest/lhrcentos76:8.5 \/usr/sbin/initdocker exec -it lhrob312 bash-- 创建用户
useradd admin
echo "admin:lhr" | chpasswdecho "admin       ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers-- 安装OB软件
rpm -ivh *.rpmecho "export PATH=$PATH:/home/admin/oceanbase/bin:/home/admin/obproxy-3.2.0/bin" >> /home/admin/.bash_profile
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib/" >> /home/admin/.bash_profile
source  /home/admin/.bash_profilechown -R admin:admin /home/admin-- 安装OB和MySQL客户端
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install -y obclient mariadb mariadb-libs mariadb-devel

安装过程:

[root@lhrob312 soft]# ll -h
total 55M
-rw-r--r-- 1 root root 7.9M Nov  5 09:10 obproxy-3.2.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  47M Dec 31 17:57 oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm
-rw-r--r-- 1 root root 156K Dec 31 19:40 oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm[root@lhrob312 soft]# useradd admin
[root@lhrob312 soft]# echo "admin:lhr" | chpasswd
[root@lhrob312 soft]#
[root@lhrob312 soft]# chown -R admin:admin /home/admin
[root@lhrob312 soft]# echo "admin       ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers
[root@lhrob312 soft]#
[root@lhrob312 soft]#
[root@lhrob312 soft]# rpm -ivh *.rpm
warning: 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.2-100003920################################# [ 33%]2:oceanbase-ce-3.1.2-10000392021123################################# [ 67%]3:obproxy-3.2.0-1.el7              ################################# [100%][root@lhrob312 soft]# echo "export PATH=$PATH:/home/admin/oceanbase/bin:/home/admin/obproxy-3.2.0/bin" >> /home/admin/.bash_profile
[root@lhrob312 soft]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib/" >> /home/admin/.bash_profile
[root@lhrob312 soft]# source  /home/admin/.bash_profile
[root@lhrob312 soft]#
[root@lhrob312 soft]# rpm -ql oceanbase-ce
/home/admin/oceanbase/bin
/home/admin/oceanbase/bin/import_time_zone_info.py
/home/admin/oceanbase/bin/observer
/home/admin/oceanbase/etc
/home/admin/oceanbase/etc/oceanbase_upgrade_dep.yml
/home/admin/oceanbase/etc/priv_checker.py
/home/admin/oceanbase/etc/timezone_V1.log
/home/admin/oceanbase/etc/upgrade_checker.py
/home/admin/oceanbase/etc/upgrade_cluster_health_checker.py
/home/admin/oceanbase/etc/upgrade_post.py
/home/admin/oceanbase/etc/upgrade_post_checker.py
/home/admin/oceanbase/etc/upgrade_pre.py
/home/admin/oceanbase/etc/upgrade_rolling_post.py
/home/admin/oceanbase/etc/upgrade_rolling_pre.py
[root@lhrob312 soft]# rpm -ql oceanbase-ce-libs
/home/admin/oceanbase/lib
/home/admin/oceanbase/lib/libaio.so
/home/admin/oceanbase/lib/libaio.so.1
/home/admin/oceanbase/lib/libaio.so.1.0.1
/home/admin/oceanbase/lib/libmariadb.so
/home/admin/oceanbase/lib/libmariadb.so.3
[root@lhrob312 soft]# rpm -ql obproxy
/home/admin/obproxy-3.2.0/bin
/home/admin/obproxy-3.2.0/bin/obproxy
/home/admin/obproxy-3.2.0/bin/obproxyd.sh
[root@lhrob312 ~]# chown -R admin:admin /home/admin

配置启动OB并初始化


-- 单副本
su - admin
mkdir -p /home/admin/oceanbase/store/sstable
cd /home/admin/oceanbase/store/ && /home/admin/oceanbase/bin/observer -r "127.0.0.1:2882:2881" -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 -n lhrob-single -c 20220108 -d /home/admin/oceanbase/store -i lo -l ERROR#以上命令中指定的参数作用可参考obd自动部署过程yaml文件的说明,请移步 https://gitee.com/oceanbase/obdeploy/tree/master/example # 查看进程信息
ps -ef |grep observer
netstat -tulnp | grep 288-- bootstrap集群(初始化集群)
mysql -h127.1 -uroot -P2881 -p -c -A  # 默认空密码set session ob_query_timeout=1000000000; alter system bootstrap ZONE 'zone1' SERVER '127.0.0.1:2882';# 修改root密码
alter user root identified by 'lhr';
create user proxyro identified by 'lhr';
grant select on *.* to proxyro;

过程:

[admin@lhrob312 oceanbase]$ mkdir -p /home/admin/oceanbase/store/sstable
[admin@lhrob312 oceanbase]$ ll /home/admin/oceanbase/store/sstable
total 0
[admin@lhrob312 oceanbase]$
[admin@lhrob312 oceanbase]$
[admin@lhrob312 oceanbase]$ /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881 -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 -n lhrob-single -c 20220108 -d /home/admin/oceanbase/store -i lo -l ERROR
/home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881 -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 -n lhrob-single -c 20220108 -d /home/admin/oceanbase/store -i lo -l ERROR
rs list: 127.0.0.1:2882:2881
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
appname: lhrob-single
cluster id: 20220108
data_dir: /home/admin/oceanbase/store
devname: lo
log level: ERROR
[admin@lhrob312 oceanbase]$ ll
total 24
drwxr-xr-x 2 admin admin 4096 Jan  8 11:34 bin
drwxr-xr-x 2 admin admin 4096 Jan  8 11:34 etc
drwxr-xr-x 2 admin admin 4096 Jan  8 11:33 lib
drwxrwxr-x 2 admin admin 4096 Jan  8 14:51 log
drwxrwxr-x 2 admin admin 4096 Jan  8 14:51 run
drwxrwxr-x 6 admin admin 4096 Jan  8 14:51 store
[admin@lhrob312 oceanbase]$ tree store/
store/
├── clog
│   └── 1
├── ilog
├── slog
└── sstable└── block_file4 directories, 2 files[admin@lhrob312 oceanbase]$ ps -ef|grep ob
admin    17740     0 99 14:51 ?        00:00:35 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881 -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 -n lhrob-single -c 20220108 -d /home/admin/oceanbase/store -i lo -l ERROR
admin    18337 15142  0 14:51 pts/0    00:00:00 grep --color=auto ob
[admin@lhrob312 oceanbase]$ cd
[admin@lhrob312 ~]$
[admin@lhrob312 ~]$ netstat -tulnp | grep 288
(Not all processes could be identified, non-owned process infowill 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      2516/observer
tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      2516/observer
[admin@lhrob312 ~]$
[admin@lhrob312 ~]$
[admin@lhrob312 ~]$ 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.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)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; alter system bootstrap ZONE 'zone1' SERVER '127.0.0.1:2882';
Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (3 min 30.85 sec)MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.10 sec)MySQL [(none)]> alter user root identified by 'lhr';
grant select on *.* to proxyro;Query OK, 0 rows affected (0.88 sec)MySQL [(none)]> create user proxyro identified by 'lhr';
Query OK, 0 rows affected (0.48 sec)MySQL [(none)]> grant select on *.* to proxyro;
Query OK, 0 rows affected (0.62 sec)

配置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集群。

-- 启动obproxy,其中-c 对应集群的名称,和前面的observer的启动参数对应。
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 20220108netstat -ntlp |grep obproxy-- 通过obproxy登录,初始密码为空
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 -P12883select * from oceanbase.__all_server;
show full processlist;

执行过程:

[admin@lhrob312 ~]$ /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 20220108
/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 20220108
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: 20220108
[root@lhrob312 soft]# netstat -ntlp |grep obproxy
tcp        0      0 0.0.0.0:2883            0.0.0.0:*               LISTEN      18870/obproxy
tcp        0      0 0.0.0.0:2884            0.0.0.0:*               LISTEN      18870/obproxy
[root@lhrob312 soft]# ps -ef|grep ob
admin    17740     0 99 14:51 ?        00:35:38 /home/admin/oceanbase/bin/observer -r 127.0.0.1:2882:2881 -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 -n lhrob-single -c 20220108 -d /home/admin/oceanbase/store -i lo -l ERROR
admin    18870     0  9 15:02 ?        00:00:20 /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 20220108
root     19095  3413  0 15:05 pts/1    00:00:00 grep --color=auto ob[admin@lhrob312 ~]$ mysql -h127.1 -uroot@proxysys -P2883 -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.25Copyright (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)]>
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  |       | password for observer sys user | false       | SYS           |
| obproxy_sys_password   |       | password for obproxy sys user  | false       | SYS           |
+------------------------+-------+--------------------------------+-------------+---------------+
3 rows in set (0.00 sec)MySQL [(none)]> alter proxyconfig set obproxy_sys_password='lhr';
Query OK, 0 rows affected (0.01 sec)MySQL [(none)]> alter proxyconfig set observer_sys_password='lhr';
Query OK, 0 rows affected (0.03 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  | 6095142f4b755fb18e0ca1edc3fa38fe0bdc78b9 | password for observer sys user | false       | SYS           |
| obproxy_sys_password   | 6095142f4b755fb18e0ca1edc3fa38fe0bdc78b9 | password for obproxy sys user  | false       | SYS           |
+------------------------+------------------------------------------+--------------------------------+-------------+---------------+
3 rows in set (0.01 sec)[admin@lhrob312 ~]$ mysql -h127.1 -uroot@sys -P2883 -plhr -c -A oceanbase
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)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]>
MySQL [oceanbase]> 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-08 14:52:34.064705 | 2022-01-08 15:00:26.771987 | 127.0.0.1 |     2882 |  1 | zone1 |       2881 |               1 | active |                     0 | 3.1.2_10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d(Dec 30 2021 02:47:29) |         0 |   1641624917461162 |            0 |              1 |                 0 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+----------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
1 row in set (0.01 sec)MySQL [oceanbase]> show full processlist;
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
| Id         | User    | Tenant | Host            | db        | Command | Time | State  | Info                  | Ip        | Port | Proxy_sessid |
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
| 3221487783 | proxyro | sys    | 127.0.0.1:42192 | oceanbase | Sleep   |    0 | SLEEP  | NULL                  | 127.0.0.1 | 2881 |            3 |
| 3221487781 | root    | sys    | 127.0.0.1:42188 | oceanbase | Query   |    0 | ACTIVE | show full processlist | 127.0.0.1 | 2881 |            2 |
| 3221487792 | root    | sys    | 127.0.0.1:43042 | NULL      | Sleep   |    8 | SLEEP  | NULL                  | 127.0.0.1 | 2881 |            4 |
+------------+---------+--------+-----------------+-----------+---------+------+--------+-----------------------+-----------+------+--------------+
3 rows in set (0.08 sec)
MySQL [oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.00 sec)

登录ob数据库并创建租户

mysql -uroot@sys -plhr -h192.168.66.35 -P12883
CREATE resource unit S4C1G 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';
CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1;
create tenant obmysql resource_pool_list=('my_pool'), primary_zone='RANDOM',comment 'mysql tenant/instance', charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';-- 密码为空
mysql -uroot@obmysql -p -h192.168.66.35 -P12883

过程:

C:\Users\lhrxxt>mysql -uroot@sys -plhr -h192.168.66.35 -P12883
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 262145
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)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)]> 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-08 14:52:34.064705 | 2022-01-08 15:00:26.771987 | 127.0.0.1 |     2882 |  1 | zone1 |       2881 |               1 | active |                     0 | 3.1.2_10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d(Dec 30 2021 02:47:29) |         0 |   1641624917461162 |            0 |              1 |                 0 |
+----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+----------------------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
1 row in set (0.09 sec)

创建资源单元、资源池、租户

MySQL [oceanbase]> CREATE resource unit S4C1G 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.006 sec)MySQL [oceanbase]> CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1;
Query OK, 0 rows affected (0.011 sec)MySQL [oceanbase]> create tenant obmysql resource_pool_list=('my_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.612 sec)MySQL [oceanbase]>

登录obmysql tenant并创建数据库及表等

C:\Users\lhrxxt>mysql -uroot@obmysql -p -h192.168.66.35 -P12883
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.6.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)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 [test]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.017 sec)MySQL [test]> create database lhrdb charset utf8mb4;
Query OK, 1 row affected (0.168 sec)MySQL [test]> use lhrdb;
Database changedMySQL [lhrdb]> source /tmp/mysql_employees.sql
Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected, 1 warning (0.004 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec)Query OK, 0 rows affected (0.001 sec).....
MySQL [lhrdb]> show tables;
+-----------------+
| Tables_in_lhrdb |
+-----------------+
| departments     |
| job_grades      |
| jobs            |
| late            |
| locations       |
+-----------------+
5 rows in set (0.018 sec)
MySQL [lhrdb]> select * from jobs;
+------------+---------------------------------+------------+------------+
| job_id     | job_title                       | min_salary | max_salary |
+------------+---------------------------------+------------+------------+
| AC_ACCOUNT | Public Accountant               |       4200 |       9000 |
| AC_MGR     | Accounting Manager              |       8200 |      16000 |
| AD_ASST    | Administration Assistant        |       3000 |       6000 |
| AD_PRES    | President                       |      20000 |      40000 |
| AD_VP      | Administration Vice President   |      15000 |      30000 |
| FI_ACCOUNT | Accountant                      |       4200 |       9000 |
| FI_MGR     | Finance Manager                 |       8200 |      16000 |
| HR_REP     | Human Resources Representative  |       4000 |       9000 |
| IT_PROG    | Programmer                      |       4000 |      10000 |
| MK_MAN     | Marketing Manager               |       9000 |      15000 |
| MK_REP     | Marketing Representative        |       4000 |       9000 |
| PR_REP     | Public Relations Representative |       4500 |      10500 |
| PU_CLERK   | Purchasing Clerk                |       2500 |       5500 |
| PU_MAN     | Purchasing Manager              |       8000 |      15000 |
| SA_MAN     | Sales Manager                   |      10000 |      20000 |
| SA_REP     | Sales Representative            |       6000 |      12000 |
| SH_CLERK   | Shipping Clerk                  |       2500 |       5500 |
| ST_CLERK   | Stock Clerk                     |       2000 |       5000 |
| ST_MAN     | Stock Manager                   |       5500 |       8500 |
+------------+---------------------------------+------------+------------+
19 rows in set (0.003 sec)

问题

搞不懂,为啥OB的CPU占用率总是这么高:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uOeENNyQ-1641637320223)(https://cdn.jsdelivr.net/gh/lhrbest/pic/img_2022/202201081514701.png)]

本实验结束!

实践练习二(必选):手动部署 OceanBase 单副本集群相关推荐

  1. k8s安装部署步骤_30分钟无坑部署K8S单Master集群

    Jesse导读:11月9号,我在中国.NET开发者峰会(.NET Conf China 2019)上分享了之前ASP.NET Core和Kubernetes做微服务的经验,在10号的时候又联合张善友. ...

  2. 30分钟无坑部署K8S单Master集群

    Jesse导读:11月9号,我在中国.NET开发者峰会(.NET Conf China 2019)上分享了之前ASP.NET Core和Kubernetes做微服务的经验,在10号的时候又联合张善友. ...

  3. 实践练习2:手动部署 OceanBase 集群

    实验要求 练习目的 本次练习目的掌握 OceanBase 集群的手动部署技能,理解进程的相关目录.集群初始化.OBProxy和 OB 集群关系等. 练习条件 有笔记本或服务器,内存至少12G . 练习 ...

  4. OceanBase迷你版集群安装记录

    文章目录 环境简介 搭建准备 资源文件与参考资料 总体规划 用户管理 磁盘规划 环境检查 操作系统 CPU 内存 硬盘 配置时钟同步 依赖软件安装 默认限制修改(此步未实际改动) 开始手动安装Ocea ...

  5. 实践练习六(必选):OceanBase TPC-C 测试和查看 执行计划

    实践练习六(必选):OceanBase TPC-C 测试和查看 执行计划 练习目的 本次练习目的掌握 OceanBase 的执行计划查看方法,包括 explain 命令和查看实际执行计划. 练习条件 ...

  6. Ceph分布式存储系列(二):ceph-deploy方式部署三节点ceph集群

    承接上文:Ceph分布式存储系列(一):Ceph工作原理及架构浅析梳理 之前都是使用Deepsea方式部署的ceph,长时间不用ceph-deploy了,这次来回顾,顺便总结下! 前言: ceph-d ...

  7. CentOS 使用二进制部署 Kubernetes 1.13集群

    CentOS 使用二进制部署 Kubernetes 1.13集群 一.概述 kubernetes 1.13 已发布,这是 2018 年年内第四次也是最后一次发布新版本.Kubernetes 1.13 ...

  8. 在阿里云上部署生产级别Kubernetes集群

    阿里云是国内非常受欢迎的基础云平台,随着Kubernetes的普及,越来越多的企业开始筹划在阿里云上部署自己的Kubernetes集群. 本文将结合实战中总结的经验,分析和归纳一套在阿里云上部署生产级 ...

  9. K8S部署工具:KubeOperator集群规划-自动模式

    K8S部署工具:KubeOperator集群规划-自动模式 KubeOperator 支持两种 Kubernetes 集群部署方式,一种是自动模式,另外一种是手动模式,我们推荐使用自动模式.在自动模式 ...

最新文章

  1. pyspider积累
  2. zabbix 3.4 ubuntu 16 用腾讯企业邮箱作为告警邮箱
  3. Intel发布神经网络压缩库Distiller:快速利用前沿算法压缩PyTorch模型
  4. 系统间通信1:阻塞与非阻塞式通信B
  5. 下载加载linux下用vmware-mount挂载vmdk虚拟硬盘分区
  6. java获取标准输出到文件_IO java标准输入与输出
  7. 最近,4000余名工程师,集体重学数学!竟都只用这一招,快来!
  8. 对称加密算法和非对称加密算法速度对比
  9. 微信信息轰炸【简易版】
  10. QGIS教程02---QGIS加载数据的4种方法
  11. 建议Mac M1关闭虚拟内存(交换内存 swap memory)
  12. 航模的无刷电机到底是什么电机
  13. 同济大学计算机专业辅修声乐,同济大学关于本科生修读辅修专业的管理办法
  14. python怎么读取txt文件并统计其字数-python读取word文本进行词频统计
  15. Shell版本循环语句(if//for/while/case)
  16. 搭档之家|独立面对人生的态度
  17. OpenCV实践之路——opencv玩数独之一九宫格轮廓提取与透视变换
  18. 用手机打开word图表位置很乱_word排版技巧:论文图表目录制作步骤
  19. python交换机ssh巡检_paramiko交换机巡检
  20. 信号完整性系统学习(一)前言

热门文章

  1. 惠普星 TP01-055ccn电脑重装系统步骤
  2. Java=微信支付详解与日志记录详解
  3. UE4_相对于某一个Actor的夹角计算
  4. pytorch to_device遇到数据迁移不成功的问题
  5. Laravel项目部署到线上需要注意的一些问题
  6. 弘辽科技:店铺前期可以不上宝贝吗?店铺如何上宝贝?
  7. 7.camera驱动06-自己实现v4l2驱动-虚拟摄像头
  8. 传统企业数字化转型方案
  9. HDU 1069 Monkey and Banana
  10. 【案例】简单图片和段落上下排版制作