一、最小化安装银河麒麟V10
目前oceanbase社区版最小使用内存8G,虚拟机给了14G,
重启后资源情况
[root@yinh ~]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Sword)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)"
ANSI_COLOR="0;31"
[root@yinh ~]# cat /etc/kylin-release
Kylin Linux Advanced Server release V10 (Sword)
[root@yinh ~]# uname -a
Linux yinh 4.19.90-25.7.v2101.ky10.x86_64 #1 SMP Mon Oct 18 15:44:24 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
二、安装常用组件
[root@yinh tmp]# yum -y install flex bison gcc gcc-c++ glibc glibc-devel
Unable to detect release version (use '--releasever' to specify release version)
Last metadata expiration check: 0:13:56 ago on Thu 13 Jan 2022 04:14:21 PM CST.
Dependencies resolved.
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
bison x86_64 3.6.4-1.ky10 ks10-adv-os 334 k
flex x86_64 2.6.4-2.ky10 ks10-adv-os 306 k
gcc x86_64 7.3.0-20190804.35.p02.ky10 ks10-adv-os 12 M
gcc-c++ x86_64 7.3.0-20190804.35.p02.ky10 ks10-adv-os 8.1 M
glibc x86_64 2.28-49.p04.ky10 ks10-adv-updates 3.2 M
glibc-devel x86_64 2.28-49.p04.ky10 ks10-adv-updates 2.8 M
Installing dependencies:
Transaction Summary
==========================================================================================
Install 237 Packages
Total download size: 138 M
Installed size: 673 M
Downloading Packages:
(1/237): basesystem-12-2.ky10.noarch.rpm 1.3 kB/s | 6.7 kB 00:05
(2/237): attr-2.4.48-9.ky10.x86_64.rpm 11 kB/s | 56 kB 00:05
(3/237): bzip2-1.0.8-3.ky10.x86_64.rpm 672 kB/s | 67 kB 00:00
(4/237): bison-3.6.4-1.ky10.x86_64.rpm 888 kB/s | 334 kB 00:00
(5/237): chkconfig-1.14-1.ky10.x86_64.rpm 732 kB/s | 171 kB 00:00
(6/237): ca-certificates-2020.2.44-1.ky10.noarch.rpm 835 kB/s | 376 kB 00:00
(7/237): coreutils-8.32-5.p03.ky10.x86_64.rpm 1.0 MB/s | 2.6 MB 00:02
(8/237): crontabs-1.11-21.ky10.noarch.rpm 415 kB/s | 16 kB 00:00
(9/237): crypto-policies-20200619-1.git781bbd4.ky10.noarc 825 kB/s | 80 kB 00:00
(10/237): cyrus-sasl-lib-2.1.27-10.ky10.x86_64.rpm 792 kB/s | 74 kB 00:00
(11/237): e2fsprogs-1.45.6-1.ky10.x86_64.rpm 1.0 MB/s | 1.1 MB 00:01
(12/237): e2fsprogs-help-1.45.6-1.ky10.noarch.rpm 883 kB/s | 93 kB 00:00
(13/237): efi-srpm-macros-4-2.p01.ky10.noarch.rpm 536 kB/s | 21 kB 00:00
(14/237): elfutils-0.180-1.ky10.x86_64.rpm 1.0 MB/s | 747 kB 00:00
(15/237): file-5.39-1.ky10.x86_64.rpm 745 kB/s | 38 kB 00:00
(16/237): file-libs-5.39-1.ky10.x86_64.rpm 1.1 MB/s | 600 kB 00:00
(17/237): filesystem-3.14-1.ky10.x86_64.rpm 1.0 MB/s | 1.1 MB 00:01
(18/237): cpp-7.3.0-20190804.35.p02.ky10.x86_64.rpm 1.0 MB/s | 7.4 MB 00:07
(19/237): findutils-4.7.0-5.p01.ky10.x86_64.rpm 484 kB/s | 389 kB 00:00
(20/237): flex-2.6.4-2.ky10.x86_64.rpm 1.2 MB/s | 306 kB 00:00
(21/237): fuse-help-2.9.9-3.ky10.x86_64.rpm 537 kB/s | 20 kB 00:00
(22/237): gamin-0.1.10-37.ky10.x86_64.rpm 690 kB/s | 66 kB 00:00
(23/237): fuse-2.9.9-3.ky10.x86_64.rpm 467 kB/s | 139 kB 00:00
(24/237): gawk-5.0.1-3.ky10.x86_64.rpm 1.2 MB/s | 363 kB 00:00
(25/237): gcc-c++-7.3.0-20190804.35.p02.ky10.x86_64.rpm 1.0 MB/s | 8.1 MB 00:07
(26/237): gdbm-1.18.1-1.ky10.x86_64.rpm 869 kB/s | 142 kB 00:00
(27/237): gnupg2-2.2.21-1.ky10.x86_64.rpm 861 kB/s | 2.1 MB 00:02
(28/237): grep-3.4-0.1.ky10.x86_64.rpm 780 kB/s | 256 kB 00:00
(29/237): gcc-7.3.0-20190804.35.p02.ky10.x86_64.rpm 971 kB/s | 12 MB 00:13
(30/237): gzip-1.10-1.ky10.x86_64.rpm 709 kB/s | 101 kB 00:00
(31/237): ima-evm-utils-libs-1.3.1-4.ky10.x86_64.rpm 453 kB/s | 21 kB 00:00
(32/237): groff-1.22.4-4.ky10.x86_64.rpm 829 kB/s | 1.7 MB 00:02
(33/237): keyutils-libs-1.6.3-1.ky10.x86_64.rpm 541 kB/s | 24 kB 00:00
(34/237): kylin-gpg-keys-1.0-2.4.p11.ky10.x86_64.rpm 313 kB/s | 11 kB 00:00
(35/237): kylin-release-10-24.6.p41.ky10.x86_64.rpm 550 kB/s | 34 kB 00:00
(36/237): kylin-repos-1.0-2.4.p11.ky10.x86_64.rpm 239 kB/s | 9.5 kB 00:00
(37/237): info-6.7-2.ky10.x86_64.rpm 766 kB/s | 174 kB 00:00
(237/237): glibc-common-2.28-49.p04.ky10.x86_64.rpm 587 kB/s | 26 MB 00:45
------------------------------------------------------------------------------------------
Total 1.3 MB/s | 138 MB 01:50
warning: /var/cache/dnf/epel-a56bdfa2f5efdfb9/packages/brotli-1.0.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Extra Packages for Enterprise Linux 7 - x86_64 80 kB/s | 1.6 kB 00:00
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91E9 7D7C 4A5E 96F1 7F3E 888F 6A2F AEA2 352C 64E5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Key imported successfully
warning: /var/cache/dnf/ks10-adv-os-029d9cf182e8eb8b/packages/attr-2.4.48-9.ky10.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7a486d9f: NOKEY
Kylin Linux Advanced Server 10 - Os 143 kB/s | 1.7 kB 00:00
Importing GPG key 0x7A486D9F:
Userid : "NeoKylin (release key) <support@cs2c.com.cn>"
Fingerprint: B814 9E68 5286 4585 CE41 143B 41F8 AEBE 7A48 6D9F
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: filesystem-3.14-1.ky10.x86_64 1/1
Preparing : 1/1
Installing : libgcc-7.3.0-20190804.35.p02.ky10.x86_64 1/237
Installing : ncurses-base-6.2-2.ky10.noarch 2/237
Installing : kernel-headers-4.19.90-25.9.v2101.ky10.x86_64 3/237
Installing : glib2-help-2.62.5-7.ky10.noarch 4/237
warning: /etc/issue created as /etc/issue.rpmnew
warning: /etc/issue.net created as /etc/issue.net.rpmnew
Installing : setup-2.13.7-1.p01.ky10.noarch 14/237
warning: /etc/csh.login created as /etc/csh.login.rpmnew
warning: /etc/group created as /etc/group.rpmnew
warning: /etc/gshadow created as /etc/gshadow.rpmnew
warning: /etc/motd created as /etc/motd.rpmnew
warning: /etc/passwd created as /etc/passwd.rpmnew
warning: /etc/shadow created as /etc/shadow.rpmnew
warning: /etc/shells created as /etc/shells.rpmnew
warning: /etc/subgid created as /etc/subgid.rpmnew
warning: /etc/subuid created as /etc/subuid.rpmnew
Running scriptlet: setup-2.13.7-1.p01.ky10.noarch 14/237
Installing : filesystem-3.14-1.ky10.x86_64 15/237
Installing : basesystem-12-2.ky10.noarch 16/237
Installing : ncurses-libs-6.2-2.ky10.x86_64 17/237
Installing : libselinux-3.1-1.se.04.ky10.x86_64 18/237
Installing : readline-8.0-3.ky10.x86_64 19/237
Installing : bash-5.0-14.se.01.p01.ky10.x86_64 20/237
Installing : glibc-common-2.28-49.p04.ky10.x86_64 21/237
Running scriptlet: glibc-2.28-49.p04.ky10.x86_64 22/237
Installing : glibc-2.28-49.p04.ky10.x86_64 22/237
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
Running scriptlet: glibc-2.28-49.p04.ky10.x86_64 22/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
......
Installing : pcre2-10.35-1.ky10.x86_64 25/237
Running scriptlet: pcre2-10.35-1.ky10.x86_64 25/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
Installing : zlib-1.2.11-17.1.ky10.x86_64 26/237
Installing : libstdc++-7.3.0-20190804.35.p02.ky10.x86_64 27/237
Running scriptlet: libstdc++-7.3.0-20190804.35.p02.ky10.x86_64 27/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
Installing : info-6.7-2.ky10.x86_64 28/237
Installing : bzip2-1.0.8-3.ky10.x86_64 29/237
......
Installing : libmetalink-0.1.3-8.ky10.x86_64 70/237
Installing : cpp-7.3.0-20190804.35.p02.ky10.x86_64 71/237
Running scriptlet: cpp-7.3.0-20190804.35.p02.ky10.x86_64 71/237
Installing : libxcrypt-devel-4.4.16-1.ky10.x86_64 72/237
Running scriptlet: glibc-devel-2.28-49.p04.ky10.x86_64 73/237
Installing : glibc-devel-2.28-49.p04.ky10.x86_64 73/237
Running scriptlet: glibc-devel-2.28-49.p04.ky10.x86_64 73/237
Installing : file-5.39-1.ky10.x86_64 74/237
Installing : libassuan-2.5.3-1.ky10.x86_64 75/237
Running scriptlet: libksba-1.4.0-2.ky10.x86_64 76/237
Installing : libksba-1.4.0-2.ky10.x86_64 76/237
Running scriptlet: libksba-1.4.0-2.ky10.x86_64 76/237
Installing : python-pip-wheel-20.2.2-2.ky10.noarch 224/237
Installing : openssl-libs-1:1.1.1f-4.p04.ky10.x86_64 225/237
Running scriptlet: openssl-libs-1:1.1.1f-4.p04.ky10.x86_64 225/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
Installing : coreutils-8.32-5.p03.ky10.x86_64 226/237
Running scriptlet: coreutils-8.32-5.p03.ky10.x86_64 226/237
Installing : python3-3.7.9-6.ky10.x86_64 227/237
Installing : crypto-policies-20200619-1.git781bbd4.ky10.noarch 228/237
Running scriptlet: crypto-policies-20200619-1.git781bbd4.ky10.noarch 228/237
Installing : libblkid-2.35.2-8.p01.ky10.x86_64 229/237
Running scriptlet: libblkid-2.35.2-8.p01.ky10.x86_64 229/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
Installing : p11-kit-trust-0.23.20-2.ky10.x86_64 232/237
Running scriptlet: p11-kit-trust-0.23.20-2.ky10.x86_64 232/237
......
Installing : gcc-c++-7.3.0-20190804.35.p02.ky10.x86_64 235/237
Installing : flex-2.6.4-2.ky10.x86_64 236/237
Running scriptlet: flex-2.6.4-2.ky10.x86_64 236/237
Installing : bison-3.6.4-1.ky10.x86_64 237/237
Running scriptlet: filesystem-3.14-1.ky10.x86_64 237/237
Running scriptlet: glibc-common-2.28-49.p04.ky10.x86_64 237/237
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
Installed:
attr-2.4.48-9.ky10.x86_64
basesystem-12-2.ky10.noarch
bash-5.0-14.se.01.p01.ky10.x86_64
binutils-2.34-9.ky10.x86_64
bison-3.6.4-1.ky10.x86_64
brotli-1.0.7-5.el7.x86_64
bzip2-1.0.8-3.ky10.x86_64
ca-certificates-2020.2.44-1.ky10.noarch
chkconfig-1.14-1.ky10.x86_64
coreutils-8.32-5.p03.ky10.x86_64
cpp-7.3.0-20190804.35.p02.ky10.x86_64
unzip-6.0-45.ky10.x86_64
which-2.21-14.ky10.x86_64
xz-libs-5.2.5-1.ky10.x86_64
zip-3.0-26.ky10.x86_64
zlib-1.2.11-17.1.ky10.x86_64
zstd-1.4.5-1.ky10.x86_64
Complete!
三、安装社区版oceanbase
[root@yinh tmp]# rpm -ivh oceanbase-ce-3.1.1-4.el7.x86_64.rpm oceanbase-ce-libs-3.1.1-4.el7.x86_64.rpm oceanbase-ce-utils-3.1.1-4.el7.x86_64.rpm
warning: oceanbase-ce-3.1.1-4.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY
Verifying… ################################# [100%]
Preparing… ################################# [100%]
Updating / installing…
1:oceanbase-ce-libs-3.1.1-4.el7 ################################# [ 33%]
2:oceanbase-ce-3.1.1-4.el7 ################################# [ 67%]
3:oceanbase-ce-utils-3.1.1-4.el7 ################################# [100%]
/sbin/ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link
手动启动数据库
[admin@yinh oceanbase]$ bin/observer -i enp0s8 -p 2881 -P 2882 -z zone1 -d ~/oceanbase/store/obdemo -r ‘192.168.56.10:2882:2881’ -c 20220101 -n obdemo -o “memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=8,net_thread_count=4,datafile_size=10G,stack_size=1536K,config_additional_dir=/data/obdemo/etc3;/redo/obdemo/etc2”
bin/observer -i enp0s8 -p 2881 -P 2882 -z zone1 -d /home/admin/oceanbase/store/obdemo -r 192.168.56.10:2882:2881 -c 20220101 -n obdemo -o memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=8,net_thread_count=4,datafile_size=10G,stack_size=1536K,config_additional_dir=/data/obdemo/etc3;/redo/obdemo/etc2
devname: enp0s8
mysql port: 2881
rpc port: 2882
zone: zone1
data_dir: /home/admin/oceanbase/store/obdemo
rs list: 192.168.56.10:2882:2881
cluster id: 20220101
appname: obdemo
optstr: memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=8,net_thread_count=4,datafile_size=10G,stack_size=1536K,config_additional_dir=/data/obdemo/etc3;/redo/obdemo/etc2
验证oceanbase进程和所用端口
[admin@yinh oceanbase]$ ps -ef|grep obs
admin 15968 1 90 17:19 ? 00:00:03 bin/observer -i enp0s8 -p 2881 -P 2882 -z zone1 -d /home/admin/oceanbase/store/obdemo -r 192.168.56.10:2882:2881 -c 20220101 -n obdemo -o memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=8,net_thread_count=4,datafile_size=10G,stack_size=1536K,config_additional_dir=/data/obdemo/etc3;/redo/obdemo/etc2
admin 16556 14962 0 17:19 pts/0 00:00:00 grep obs
[admin@yinh oceanbase]$ ss -an|grep 288
tcp LISTEN 0 512 0.0.0.0:2881 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2881 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2881 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2881 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2882 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2882 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2882 0.0.0.0:*
tcp LISTEN 0 512 0.0.0.0:2882 0.0.0.0:*
tcp ESTAB 0 0 192.168.56.10:2882 192.168.56.10:51914
tcp ESTAB 0 0 192.168.56.10:51910 192.168.56.10:2882
tcp ESTAB 0 0 192.168.56.10:2882 192.168.56.10:51908
tcp ESTAB 0 0 192.168.56.10:51908 192.168.56.10:2882
tcp ESTAB 0 0 192.168.56.10:51912 192.168.56.10:2882
tcp ESTAB 0 0 192.168.56.10:2882 192.168.56.10:51912
tcp ESTAB 0 0 192.168.56.10:51914 192.168.56.10:2882
tcp ESTAB 0 0 192.168.56.10:2882 192.168.56.10:51910
安装obclient并连接数据库
[root@yinh ~]# rpm -ivh libobclient-2.0.0-2.el7.x86_64.rpm obclient-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
Verifying… ################################# [100%]
Preparing… ################################# [100%]
Updating / installing…
1:libobclient-2.0.0-2.el7 ################################# [ 50%]
2:obclient-2.0.0-2.el7 ################################# [100%]
[admin@yinh oceanbase]$ obclient -h 192.168.56.10 -P 2881 -uroot -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.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
集群bootstrap进行初始化
MySQL [(none)]> set session ob_query_timeout=1000000000;
Query OK, 0 rows affected (0.000 sec)
MySQL [(none)]> alter system bootstrap ZONE ‘zone1’ SERVER ‘192.168.56.10:2882’;
Query OK, 0 rows affected (19.405 sec)
MySQL [(none)]> \q
Bye
用系统租户连接数据库
[admin@yinh oceanbase]$ obclient -h 192.168.56.10 -P 2881 -uroot@sys -p -c -A oceanbase
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 3221487626
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
Copyright © 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 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 | 192.168.56.10 | 2882 | 1 | active |
±------±--------------±---------±----------------±-------+
1 row in set (0.001 sec)
修改系统租户root密码
MySQL [oceanbase]> alter user root identified by ‘password’;
Query OK, 0 rows affected (0.021 sec)
MySQL [oceanbase]> grant select on oceanbase.* to proxyro identified by ‘proxyro’;
Query OK, 0 rows affected (0.039 sec)
手动安装obproxy并启动
[root@yinh ~]# rpm -ivh obproxy-3.2.0-1.el7.x86_64.rpm
warning: obproxy-3.2.0-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY
Verifying… ################################# [100%]
Preparing… ################################# [100%]
Updating / installing…
1:obproxy-3.2.0-1.el7 ################################# [100%]
[admin@yinh obproxy-3.2.0]$ bin/obproxy -r “192.168.56.10:2881” -p 2883 -o “enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false” -c obdemo
bin/obproxy -r 192.168.56.10:2881 -p 2883 -o enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false -c obdemo
rs list: 192.168.56.10:2881
listen port: 2883
optstr: enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false
cluster_name: obdemo
[admin@yinh obproxy-3.2.0]$ ss -an|grep 2883
tcp LISTEN 0 512 0.0.0.0:2883 0.0.0.0:*
通过obporxy连接observer:
[admin@yinh obproxy-3.2.0]$ obclient -h 192.168.56.10 -P 2883 -u root@proxysys -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25
Copyright © 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 = ‘obproxy’;
Query OK, 0 rows affected (0.002 sec)
MySQL [(none)]> alter proxyconfig set observer_sys_password = ‘obproxy’;
Query OK, 0 rows affected (0.001 sec)
MySQL [(none)]>\q
安装完成。