暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

单机手动部署oceanbase

原创 陈军 2022-01-10
2276

1、系统环境
单台虚拟机32G内存,

图片.png

2、操作系统版本

[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

3、ip地址

[root@localhost ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:05:f9:82 brd ff:ff:ff:ff:ff:ff inet 192.168.153.131/24 brd 192.168.153.255 scope global noprefixroute dynamic ens33 valid_lft 1271sec preferred_lft 1271sec inet6 fe80::bb4f:40ea:2564:b35a/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether 52:54:00:f4:da:8d brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:f4:da:8d brd ff:ff:ff:ff:ff:ff

4、配置sysctl.conf

[root@localhost ~]# cat /etc/sysctl.conf # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). [root@localhost ~]# vi /etc/sysctl.conf # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # "/etc/sysctl.conf" 35L, 1181C written [root@localhost ~]# sysctl -p net.core.somaxconn = 2048 net.core.netdev_max_backlog = 10000 net.core.rmem_default = 16777216 net.core.wmem_default = 16777216 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.ip_local_port_range = 3500 65535 net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.tcp_syncookies = 0 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_fin_timeout = 15 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_slow_start_after_idle = 0 vm.swappiness = 0 vm.min_free_kbytes = 2097152 vm.max_map_count = 655360 fs.aio-max-nr = 1048576

5、配置limit.conf

[root@localhost ~]# vi /etc/security/limits.conf # /etc/security/limits.conf # #This file sets the resource limits for the users logged in via PAM. #It does not affect resource limits of the system services. # #Also note that configuration files in /etc/security/limits.d directory, #which are read in alphabetical order, override the settings in this #file in case the domain is the same or more specific. #That means for example that setting a limit for wildcard domain here #can be overriden with a wildcard setting in a config file in the #subdirectory, but a user specific setting here can be overriden only #with a user specific setting in the subdirectory. # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # /etc/security/limits.conf # #This file sets the resource limits for the users logged in via PAM. #It does not affect resource limits of the system services. # #Also note that configuration files in /etc/security/limits.d directory, #which are read in alphabetical order, override the settings in this #file in case the domain is the same or more specific. #That means for example that setting a limit for wildcard domain here #can be overriden with a wildcard setting in a config file in the #subdirectory, but a user specific setting here can be overriden only #with a user specific setting in the subdirectory. # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # #<domain> <type> <item> <value> # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 # End of file * soft nofile 655360 * hard nofile 655360 * soft nproc 655360 * hard nproc 655360 * soft core unlimited * hard core unlimited * soft stack unlimited * hard stack unlimited "/etc/security/limits.conf" 72L, 2597C written

6、安装obceanbase相关软件

[root@localhost obdata]# ls libobclient-2.0.0-2.el7.x86_64.rpm oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm obclient-2.0.0-2.el7.x86_64.rpm oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm obproxy-3.2.0-1.el7.x86_64.rpm ocp-3.1.1-ce.tar.gz [root@localhost obdata]# rpm -ivh libobclient-2.0.0-2.el7.x86_64.rpm warning: libobclient-2.0.0-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY Preparing... ################################# [100%] Updating / installing... 1:libobclient-2.0.0-2.el7 ################################# [100%] [root@localhost obdata]# rpm -ivh obclient-2.0.0-2.el7.x86_64.rpm warning: obclient-2.0.0-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY Preparing... ################################# [100%] Updating / installing... 1:obclient-2.0.0-2.el7 ################################# [100%] [root@localhost obdata]# yum -y localinstall *.rpm Loaded plugins: fastestmirror, langpacks Examining obproxy-3.2.0-1.el7.x86_64.rpm: obproxy-3.2.0-1.el7.x86_64 Marking obproxy-3.2.0-1.el7.x86_64.rpm to be installed Examining oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm: oceanbase-ce-3.1.2-10000392021123010.el7.x86_64 Marking oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm to be installed Examining oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm: oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64 Marking oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package obproxy.x86_64 0:3.2.0-1.el7 will be installed ---> Package oceanbase-ce.x86_64 0:3.1.2-10000392021123010.el7 will be installed ---> Package oceanbase-ce-libs.x86_64 0:3.1.2-10000392021123010.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: obproxy x86_64 3.2.0-1.el7 /obproxy-3.2.0-1.el7.x86_64 35 M oceanbase-ce x86_64 3.1.2-10000392021123010.el7 /oceanbase-ce-3.1.2-10000392021123010.el7.x86_64 193 M oceanbase-ce-libs x86_64 3.1.2-10000392021123010.el7 /oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64 458 k Transaction Summary ============================================================================================ Install 3 Packages Total size: 229 M Installed size: 229 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64 1/3 Installing : oceanbase-ce-3.1.2-10000392021123010.el7.x86_64 2/3 Installing : obproxy-3.2.0-1.el7.x86_64 3/3 Verifying : oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64 1/3 Verifying : obproxy-3.2.0-1.el7.x86_64 2/3 Verifying : oceanbase-ce-3.1.2-10000392021123010.el7.x86_64 3/3 Installed: obproxy.x86_64 0:3.2.0-1.el7 oceanbase-ce.x86_64 0:3.1.2-10000392021123010.el7 oceanbase-ce-libs.x86_64 0:3.1.2-10000392021123010.el7 Complete!

7、确认软件

[root@localhost obdata]# rpm -ql|grep oceanbase rpm: no arguments given for query [root@localhost obdata]# rpm -ql oceanbase package oceanbase is not installed [root@localhost obdata]# 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@localhost obdata]# 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@localhost obdata]# 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

8、安装tree查看目录

[root@localhost obdata]# mkdir /data [root@localhost obdata]# chown admin.admin /data [root@localhost obdata]# su - admin [admin@localhost ~]$ mkdir -p /data/{observer01,observer02,observer03,obproxy} [admin@localhost ~]$ mkdir -p /data/observer{01,02,03}/store/{sort_dir,sstable,clog,ilog,slog} [root@localhost obdata]# yum -y install tree Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.bfsu.edu.cn * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package tree.x86_64 0:1.6.0-10.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: tree x86_64 1.6.0-10.el7 base 46 k Transaction Summary ============================================================================================ Install 1 Package Total download size: 46 k Installed size: 87 k Downloading packages: warning: /var/cache/yum/x86_64/7/base/packages/tree-1.6.0-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for tree-1.6.0-10.el7.x86_64.rpm is not installed tree-1.6.0-10.el7.x86_64.rpm | 46 kB 00:00:00 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Importing GPG key 0xF4A80EB5: Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>" Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 Package : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : tree-1.6.0-10.el7.x86_64 1/1 Verifying : tree-1.6.0-10.el7.x86_64 1/1 Installed: tree.x86_64 0:1.6.0-10.el7 Complete! [root@localhost obdata]# su - admin [admin@localhost data]$ tree /data/ /data/ ├── obproxy ├── observer01 │   └── store │   ├── clog │   ├── ilog │   ├── slog │   ├── sort_dir │   └── sstable ├── observer02 │   └── store │   ├── clog │   ├── ilog │   ├── slog │   ├── sort_dir │   └── sstable └── observer03 └── store ├── clog ├── ilog ├── slog ├── sort_dir └── sstable 22 directories, 0 files

9、配置bootstrap集群

[admin@localhost data]$ cd /home/admin/oceanbase/lib/ [admin@localhost lib]$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib/ [admin@localhost lib]$ source ~/.bash_profile [admin@localhost lib]$ cd /data/observer01/ && /home/admin/oceanbase/bin/observer -r "192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone1 -p 2881 -P 2882 -c 1 -d /data/observer01/store -i ens33 -l INFO /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone1 -p 2881 -P 2882 -c 1 -d /data/observer01/store -i ens33 -l INFO rs list: 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 zone: zone1 mysql port: 2881 rpc port: 2882 cluster id: 1 data_dir: /data/observer01/store devname: ens33 log level: INFO [admin@localhost observer01]$ [admin@localhost observer01]$ [admin@localhost observer01]$ cd /data/observer02/ && /home/admin/oceanbase/bin/observer -r "192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone2 -p 3881 -P 3882 -c 1 -d /data/observer02/store -i ens33 -l INFO /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone2 -p 3881 -P 3882 -c 1 -d /data/observer02/store -i ens33 -l INFO rs list: 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 zone: zone2 mysql port: 3881 rpc port: 3882 cluster id: 1 data_dir: /data/observer02/store devname: ens33 log level: INFO [admin@localhost observer02]$ cd /data/observer03/ && /home/admin/oceanbase/bin/observer -r "192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone3 -p 4881 -P 4882 -c 1 -d /data/observer03/store -i ens33 -l INFO /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone3 -p 4881 -P 4882 -c 1 -d /data/observer03/store -i ens33 -l INFO rs list: 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 zone: zone3 mysql port: 4881 rpc port: 4882 cluster id: 1 data_dir: /data/observer03/store devname: ens33 log level: INFO

10、确认服务启动集群

[admin@localhost observer03]$ ps -ef |grep observer admin 13711 1 99 22:49 ? 00:01:34 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone1 -p 2881 -P 2882 -c 1 -d /data/observer01/store -i ens33 -l INFO admin 14289 1 99 22:49 ? 00:00:36 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone2 -p 3881 -P 3882 -c 1 -d /data/observer02/store -i ens33 -l INFO admin 14450 1 99 22:49 ? 00:00:13 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone3 -p 4881 -P 4882 -c 1 -d /data/observer03/store -i ens33 -l INFO admin 14662 13572 0 22:49 pts/1 00:00:00 grep --color=auto observer [admin@localhost ~]$ netstat -ntlp|grep ob (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:3881 0.0.0.0:* LISTEN 14289/observer tcp 0 0 0.0.0.0:3882 0.0.0.0:* LISTEN 14289/observer tcp 0 0 0.0.0.0:4881 0.0.0.0:* LISTEN 14450/observer tcp 0 0 0.0.0.0:4882 0.0.0.0:* LISTEN 14450/observer tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 13711/observer tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 13711/observer [root@localhost obdata]# ps -ef|grep obse admin 13711 1 99 22:49 ? 00:50:30 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone1 -p 2881 -P 2882 -c 1 -d /data/observer01/store -i ens33 -l INFO admin 14289 1 99 22:49 ? 00:49:00 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone2 -p 3881 -P 3882 -c 1 -d /data/observer02/store -i ens33 -l INFO admin 14450 1 99 22:49 ? 00:48:36 /home/admin/oceanbase/bin/observer -r 192.168.153.131:2882:2881;192.168.153.131:3882:3881;192.168.153.131: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,sys_bkgd_migration_retry_num=3,minor_freeze_times=10,enable_separate_sys_clog=0,enable_merge_by_turn=False,datafile_size=50G,enable_syslog_recycle=True,max_syslog_file_count=10 -z zone3 -p 4881 -P 4882 -c 1 -d /data/observer03/store -i ens33 -l INFO root 15995 13105 0 23:19 pts/1 00:00:00 grep --color=auto obse

11、配置租户

[root@localhost obdata]# su - admin Last login: Sun Jan 9 23:20:00 PST 2022 on pts/1 [admin@localhost ~]$ obclient -h 192.168.153.131 -u root -P 2881 -p -c -A Enter password: Welcome to the OceanBase. 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)]> show databases; ERROR 1146 (42S02): Table 'oceanbase.__all_database' doesn't exist MySQL [(none)]> set session ob_query_timeout=1000000000; Query OK, 0 rows affected (0.001 sec) MySQL [(none)]> alter system bootstrap ZONE 'zone1' SERVER '192.168.153.131:2882' , ZONE 'zone2' SERVER '192.168.153.131:3882' , ZONE 'zone3' SERVER '192.168.153.131:4882'; Query OK, 0 rows affected (32.338 sec) MySQL [(none)]> alter user root identified by 'obceanbase_33'; Query OK, 0 rows affected (0.030 sec) MySQL [(none)]> create user proxyro identified by 'obceanbase_33'; Query OK, 0 rows affected (0.024 sec) MySQL [(none)]> exit Bye [admin@localhost ~]$ obclient -h 192.168.153.131 -u root@sys -p -P 2881 Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 3221493674 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)]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | SYS | | LBACSYS | | ORAAUDITOR | | test | +--------------------+ 7 rows in set (0.032 sec) MySQL [(none)]> alter resource unit sys_unit_config min_cpu=2; Query OK, 0 rows affected (0.063 sec) MySQL [(none)]> 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 [(none)]> CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1; Query OK, 0 rows affected (0.019 sec) MySQL [(none)]> 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 (1.706 sec) MySQL [(none)]> exit Bye

11、测试数据库创建及表信息

[admin@localhost ~]$ obclient -h 192.168.153.131 -uroot@obmysql -p -P 2881 -c -A Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 3221498305 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)]> use test; Database changed MySQL [test]> show tables; Empty set (0.011 sec) MySQL [test]> create table t1(id int,name varchar(30)); Query OK, 0 rows affected (0.111 sec) MySQL [test]> insert into t1 values(1,'tom'); Query OK, 1 row affected (0.028 sec) MySQL [test]> select * from t1; +------+------+ | id | name | +------+------+ | 1 | tom | +------+------+ 1 row in set (0.005 sec) MySQL [test]> show tables; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+ 1 row in set (0.002 sec) MySQL [test]>
最后修改时间:2022-01-10 15:55:13
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论