diff --git "a/ARM\346\234\215\345\212\241\345\231\250\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" "b/ARM\346\234\215\345\212\241\345\231\250\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" new file mode 100644 index 0000000000000000000000000000000000000000..bacc15cb56258562ade82adfcb0b6dd01ebbafe6 --- /dev/null +++ "b/ARM\346\234\215\345\212\241\345\231\250\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" @@ -0,0 +1,429 @@ + + +# OceanBase初始化安装体验 + +> 作者:许玉冲 + + + +> 通过本次测试,可以了解到oceanbase已经可以完美支持Kunpeng ARM服务器的安装,简单通过yum命令即可完成了数据库的安装。 + + + +## 一、环境准备 + +本次安装测试采用Huawei Kunpeng 920 2.6GHz,系统版本为:CentOS Linux release 7.6。 + +``` +[root@ecs-29d7 ~]# cat /etc/redhat-release +CentOS Linux release 7.6.1810 (AltArch) +[root@ecs-29d7 ~]# cat /proc/cpuinfo +processor : 0 +BogoMIPS : 200.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop asimddp asimdfhm +CPU implementer : 0x48 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0xd01 +CPU revision : 0 + +``` + + + +![cpuinfo.png](media/kunpeng/cpuinfo.png) + + + +# 二,oceanbase软件安装 + +> 本次安装使用obd进行单节点安装和测试。 + + + +## 2.1 部署 OBD 软件 + +```bash +yum install -y yum-utils +yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo +yum install -y ob-deploy +``` + +安装日志: + +``` +[root@ecs-29d7 ~]# yum install -y ob-deploy +Loaded plugins: fastestmirror +Loading mirror speeds from cached hostfile +oceanbase.community.stable | 3.0 kB 00:00:00 +oceanbase.development-kit | 3.0 kB 00:00:00 +(1/2): oceanbase.community.stable/7/aarch64/primary_db | 13 kB 00:00:00 +(2/2): oceanbase.development-kit/7/aarch64/primary_db | 22 kB 00:00:00 +Resolving Dependencies +--> Running transaction check +---> Package ob-deploy.aarch64 0:1.3.3-11.el7 will be installed +--> Finished Dependency Resolution + +Dependencies Resolved + +============================================================================================================================================= + Package Arch Version Repository Size +============================================================================================================================================= +Installing: + ob-deploy aarch64 1.3.3-11.el7 oceanbase.community.stable 19 M + +Transaction Summary +============================================================================================================================================= +Install 1 Package + +Total download size: 19 M +Installed size: 28 M +Downloading packages: +warning: /var/cache/yum/aarch64/7/oceanbase.community.stable/packages/ob-deploy-1.3.3-11.el7.aarch64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY +Public key for ob-deploy-1.3.3-11.el7.aarch64.rpm is not installed +ob-deploy-1.3.3-11.el7.aarch64.rpm | 19 MB 00:02:32 +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 + Installing : ob-deploy-1.3.3-11.el7.aarch64 1/1 +Installation of obd finished successfully +Please source /etc/profile.d/obd.sh to enable it + Verifying : ob-deploy-1.3.3-11.el7.aarch64 1/1 + +Installed: + ob-deploy.aarch64 0:1.3.3-11.el7 + +Complete! + +``` + + + +## 2.2 编辑配置文件 + +> 配置文件下载地址: +> +> ``` +> https://github.com/oceanbase/obdeploy/tree/master/example +> https://open.oceanbase.com/docs/tutorials-cn/V1.0.0/10000000000012298 +> ``` + + + +**部署单节点 `observer` 进程:** + +> 主要配置ip地址,网卡名称,内存和磁盘大小。 + +``` +## Only need to configure when remote login is required +# user: +# username: your username +# password: your password if need +# key_file: your ssh-key file path if need +# port: your ssh port, default 22 +# timeout: ssh connection timeout (second), default 30 +oceanbase-ce: + servers: + # Please don't use hostname, only IP can be supported + - 192.168.0.174 + global: + # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. + home_path: /root/observer + # The directory for data storage. The default value is $home_path/store. + # data_dir: /data + # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. + # redo_dir: /redo + # Please set devname as the network adaptor's name whose ip is in the setting of severs. + # if set severs as "127.0.0.1", please set devname as "lo" + # if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0" + devname: eth0 + mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started. + rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started. + zone: zone1 + cluster_id: 1 + # please set memory limit to a suitable value which is matching resource. + memory_limit: 6G # The maximum running memory for an observer + system_memory: 3G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G. + stack_size: 512K + cpu_count: 16 + cache_wash_threshold: 1G + __min_full_resource_pool_memory: 268435456 + workers_per_cpu_quota: 10 + schema_history_expire_time: 1d + # The value of net_thread_count had better be same as cpu's core number. + net_thread_count: 4 + major_freeze_duty_time: Disable + minor_freeze_times: 10 + enable_separate_sys_clog: 0 + enable_merge_by_turn: FALSE + datafile_disk_percentage: 20 # The percentage of the data_dir space to the total disk space. This value takes effect only when datafile_size is 0. The default value is 90. + syslog_level: INFO # System log level. The default value is INFO. + enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true. + enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false. + max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0. + # observer cluster name, consistent with obproxy's cluster_name + appname: obcluster + # root_password: # root user password, can be empty +``` + + + +## 2.3软件部署 + +软件部署: + +> 部署之前主机ssh 需要配置免密钥登录: +> +> 参考:[2.4 如何初始化服务器环境 (oceanbase.com)](https://open.oceanbase.com/docs/tutorials-cn/V1.0.0/10000000000012296) + + + + + +``` +obd cluster deploy obtest -c ob.yaml +``` + +日志输出: + +``` +[root@ecs-29d7 ~]# obd cluster deploy obtest -c ob.yaml +Update OceanBase-community-stable-el7 ok +Update OceanBase-development-kit-el7 ok +Download oceanbase-ce-3.1.3-10100032022041510.el7.aarch64.rpm (36.59 M): 100% [###################################] Time: 0:03:59 160.51 kB/s +Package oceanbase-ce-3.1.3 is available. +install oceanbase-ce-3.1.3 for local ok ++-------------------------------------------------------------------------------------------+ +| Packages | ++--------------+---------+-----------------------+------------------------------------------+ +| Repository | Version | Release | Md5 | ++--------------+---------+-----------------------+------------------------------------------+ +| oceanbase-ce | 3.1.3 | 10100032022041510.el7 | 4ceb42d85806be52cbcf24425a34b22f810c9aad | ++--------------+---------+-----------------------+------------------------------------------+ +Repository integrity check ok +Parameter check ok +Open ssh connection ok +Remote oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad repository install ok +Remote oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad repository lib check !! +[WARN] 192.168.0.174 oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad require: libaio.so.1 +[WARN] 192.168.0.174 oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad require: libmariadb.so.3 +[WARN] 192.168.0.174 oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad require: libatomic.so.1 + +Try to get lib-repository +Download oceanbase-ce-libs-3.1.3-10100032022041510.el7.aarch64.rpm (144.66 K): 100% [########################################################] Time: 0:00:00 239.41 kB/s +Package oceanbase-ce-libs-3.1.3 is available. +install oceanbase-ce-libs-3.1.3 for local ok +Use oceanbase-ce-libs-3.1.3-f931a9f4a03af69fa946ee3cc3c90f24ed9d967a for oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad +Remote oceanbase-ce-libs-3.1.3-f931a9f4a03af69fa946ee3cc3c90f24ed9d967a repository install ok +Remote oceanbase-ce-3.1.3-4ceb42d85806be52cbcf24425a34b22f810c9aad repository lib check ok +Cluster status check ok +Initializes observer work home ok +obtest deployed +``` + + + +## 2.4 启动集群 + +``` +[root@ecs-29d7 ~]# obd cluster start obtest +Get local repositories and plugins ok +Open ssh connection ok +Load cluster param plugin ok +Check before start observer ok +[WARN] (192.168.0.174) The recommended number of open files is 655350 (Current value: 65535) +[WARN] (192.168.0.174) clog and data use the same disk (/) +Start observer ok +observer program health check ok +Connect to observer ok +Initialize cluster +Cluster bootstrap ok +Wait for observer init ok ++-------------------------------------------------+ +| observer | ++---------------+---------+------+-------+--------+ +| ip | version | port | zone | status | ++---------------+---------+------+-------+--------+ +| 192.168.0.174 | 3.1.3 | 2881 | zone1 | active | ++---------------+---------+------+-------+--------+ +obtest running +``` + + + +## 2.5 状态检查 + +``` +[root@ecs-29d7 ~]# obd cluster list ++------------------------------------------------------+ +| Cluster List | ++--------+---------------------------+-----------------+ +| Name | Configuration Path | Status (Cached) | ++--------+---------------------------+-----------------+ +| obtest | /root/.obd/cluster/obtest | running | ++--------+---------------------------+-----------------+ + +[root@ecs-29d7 ~]# obd cluster display obtest +Get local repositories and plugins ok +Open ssh connection ok +Cluster status check ok +Connect to observer ok +Wait for observer init ok ++-------------------------------------------------+ +| observer | ++---------------+---------+------+-------+--------+ +| ip | version | port | zone | status | ++---------------+---------+------+-------+--------+ +| 192.168.0.174 | 3.1.3 | 2881 | zone1 | active | ++---------------+---------+------+-------+--------+ + + +``` + + + +## 2.6 ob数据库连接 + +客户端软件安装: + +``` + yum install obclient -y + +#安装日志: +[root@ecs-29d7 ~]# yum install obclient -y +Loaded plugins: fastestmirror +Loading mirror speeds from cached hostfile +Resolving Dependencies +--> Running transaction check +---> Package obclient.aarch64 0:2.0.1-2.el7 will be installed +--> Processing Dependency: libobclient >= 2.0.0 for package: obclient-2.0.1-2.el7.aarch64 +--> Running transaction check +---> Package libobclient.aarch64 0:2.0.1-3.el7 will be installed +--> Finished Dependency Resolution + +Dependencies Resolved + +====================================================================================================================================================== + Package Arch Version Repository Size +====================================================================================================================================================== +Installing: + obclient aarch64 2.0.1-2.el7 oceanbase.community.stable 170 M +Installing for dependencies: + libobclient aarch64 2.0.1-3.el7 oceanbase.community.stable 839 k + +Transaction Summary +====================================================================================================================================================== +Install 1 Package (+1 Dependent package) + +Total download size: 170 M +Installed size: 721 M +Downloading packages: +(1/2): libobclient-2.0.1-3.el7.aarch64.rpm | 839 kB 00:00:05 +(2/2): obclient-2.0.1-2.el7.aarch64.rpm | 170 MB 00:13:52 +------------------------------------------------------------------------------------------------------------------------------------------------------ +Total 210 kB/s | 170 MB 00:13:52 +Running transaction check +Running transaction test +Transaction test succeeded +Running transaction + Installing : libobclient-2.0.1-3.el7.aarch64 1/2 + Installing : obclient-2.0.1-2.el7.aarch64 2/2 + Verifying : obclient-2.0.1-2.el7.aarch64 1/2 + Verifying : libobclient-2.0.1-3.el7.aarch64 2/2 + +Installed: + obclient.aarch64 0:2.0.1-2.el7 + +Dependency Installed: + libobclient.aarch64 0:2.0.1-3.el7 + +Complete! + +``` + + + +数据库连接: + +``` + obclient -h 127.0.0.1 -uroot@sys -P2881 -c -A oceanbase + +[root@ecs-29d7 ~]# obclient -h 127.0.0.1 -uroot@sys -P2881 -c -A oceanbase +Welcome to the OceanBase. Commands end with ; or \g. +Your MySQL connection id is 3221487826 +Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:17) + +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]> show databases; ++--------------------+ +| Database | ++--------------------+ +| oceanbase | +| information_schema | +| mysql | +| SYS | +| LBACSYS | +| ORAAUDITOR | +| test | ++--------------------+ +7 rows in set (0.002 sec) + +MySQL [oceanbase]> + +``` + +# 3,软件信息 +OBD版本信息: +[root@ecs-29d7 ~]# obd --version +OceanBase Deploy: 1.3.3 +REVISION: c20488ffee26b0c9dfe4b30374687349a427ab15 +BUILD_BRANCH: publish +BUILD_TIME: Apr 26 2022 03:39:17OURCE +Copyright (C) 2021 OceanBase +License GPLv3+: GNU GPL version 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + + + +[root@ecs-29d7 ~]# obclient --version +obclient Ver 15.1 Distrib 10.4.18-MariaDB, for Linux (aarch64) using readline 5.1 + + + +[root@ecs-29d7 ~]# obclient -h 127.0.0.1 -uroot@sys -P2881 -c -A oceanbase +Welcome to the OceanBase. Commands end with ; or \g. +Your MySQL connection id is 3221487988 +Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:17) + +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 version(); ++--------------------+ +| version() | ++--------------------+ +| 3.1.3-OceanBase CE | ++--------------------+ +1 row in set (0.001 sec) + + + +> 参考文章地址:[OceanBase 社区](https://open.oceanbase.com/docs) + + + + + + + diff --git a/media/kunpeng/cpuinfo.png b/media/kunpeng/cpuinfo.png new file mode 100644 index 0000000000000000000000000000000000000000..971a9b01d272a62dfff8fade40a1afe31d3edf97 Binary files /dev/null and b/media/kunpeng/cpuinfo.png differ diff --git "a/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ecs3.png" "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ecs3.png" new file mode 100644 index 0000000000000000000000000000000000000000..2f13386c6ed0b8415c81179dd2c7d6a9a1957d8a Binary files /dev/null and "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ecs3.png" differ diff --git "a/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc.jpg" "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..5372a4c9351c377e7be0823a8da2f33fb2193f8e Binary files /dev/null and "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc.jpg" differ diff --git "a/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc2.png" "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc2.png" new file mode 100644 index 0000000000000000000000000000000000000000..3c14087d1711c9f6b3b67ae18876bc1e5d4f13f4 Binary files /dev/null and "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/esc2.png" differ diff --git "a/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ip.png" "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ip.png" new file mode 100644 index 0000000000000000000000000000000000000000..07fd15297430a41012449bb15580663e3946c440 Binary files /dev/null and "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/ip.png" differ diff --git "a/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/os.png" "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/os.png" new file mode 100644 index 0000000000000000000000000000000000000000..3d95e2f171eade842ca864f0acb0eeed25fa933f Binary files /dev/null and "b/media/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase/os.png" differ diff --git "a/\345\237\272\344\272\216ECS\344\275\277\347\224\250docker\344\275\223\351\252\214OB.md" "b/\345\237\272\344\272\216ECS\344\275\277\347\224\250docker\344\275\223\351\252\214OB.md" new file mode 100644 index 0000000000000000000000000000000000000000..08ccfb98ef9d7c4c34f8d052b7e1f43c3d204764 --- /dev/null +++ "b/\345\237\272\344\272\216ECS\344\275\277\347\224\250docker\344\275\223\351\252\214OB.md" @@ -0,0 +1,279 @@ +# OceanBase初始化安装体验 + +> 作者:许玉冲 + + + +## 一、环境准备 + +OceanBase 数据库的目的不同,对资源的要求也不同。 + +保您机器的资源至少可以运行 2 核 8GB 以上的 Docker 容器。 + + + +本次测试使用了公有云ECS主机,使用docker搭建单机测试环境,快速使用 OceanBase 数据库。 + + + +## 1.1 云主机申请 + +申请esc云主机可以考虑使用抢占式实,价格实惠: + +![esc](media/快速体验OceanBase/esc.jpg) + +操作系统选择的 CentOS 8.8 64: + +![os](media/快速体验OceanBase/os.png) + + + +ECS创建成功: + +![esc2](media/快速体验OceanBase/esc2.png) + + + +查看ip地址信息: + +![ip](media/快速体验OceanBase/ip.png) + + + +远程客户端登录ESC服务器: + +![ecs3](media/快速体验OceanBase/ecs3.png) + + + +# 二,docker软件安装 + + + +> ECS默认已经配置yum源,直接安装docker即可。 + +## docker 软件安装 + +```bash + yum install docker -y +#启动 +systemctl start docker +#开机启动 +systemctl enable docker +#检查版本 + docker --version +Docker version 1.13.1, build 7d71120/1.13.1 + +``` + +安装日志: + +``` + +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# systemctl start docker +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# systemctl enable docker +Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# docker --version +Docker version 1.13.1, build 7d71120/1.13.1 + +``` + +# 三,oceanbase-ce下载和启动 + +## 3.1 oceanbase-ce 下载 + +``` +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# docker pull oceanbase/oceanbase-ce +Using default tag: latest +Trying to pull repository docker.io/oceanbase/oceanbase-ce ... +latest: Pulling from docker.io/oceanbase/oceanbase-ce +13add961a70d: Pull complete +f9dca81288fd: Pull complete +99fa5e5c9d14: Pull complete +029da26e30e3: Pull complete +4f4fb700ef54: Pull complete +Digest: sha256:1e1078af584ba48e8b008ae6e2dad67f4e3220a0d3522f3a54e00c05372b56cb +Status: Downloaded newer image for docker.io/oceanbase/oceanbase-ce:latest + +``` + + + +## 3.2启动 OceanBase 数据库的实例 + +``` + +#启动OB数据库 +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# docker run -p 2881:2881 --name obstandalone -d oceanbase/oceanbase-ce +01ec1b26f3e6f42c7fcb7bf7f713c40db9cea23ab4675810443269d3a6476e4b + +#检查启动日志: +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# docker logs obstandalone | tail -l +Open ssh connection ok +Connect to observer ok +Create tenant test ok +start ob cluster ... +Get local repositories and plugins ok +Open ssh connection ok +Load cluster param plugin ok +Cluster status check ok +Deploy "obcluster" is running +boot success! + +``` + + + +## 3.3 状态检查和数据库连接 + +``` +# 检查容器状态 +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +01ec1b26f3e6 oceanbase/oceanbase-ce "/bin/sh -c _boot" About a minute ago Up About a minute 0.0.0.0:2881->2881/tcp obstandalone + +``` + + + + + +## 3.4 连接数据库 + + + +### 3.4.1 docker 容器内置登录脚本 + +``` +docker exec -it obstandalone ob-mysql sys # 连接 sys 租户的 root 用户(root@sys) +docker exec -it obstandalone ob-mysql root # 连接 test 租户的 root 用户(root@test) +docker exec -it obstandalone ob-mysql test # 连接 test 租户的 test 用户 (test@test) + +``` + +ob-mysql脚本信息: + +``` +[root@01ec1b26f3e6 ~]# cat /root/boot/ob-mysql +#!/bin/bash +CWD=$(cd `dirname $0`;pwd) +cd "${CWD}" +source _env + +PASSCMD="" + +case "$1" in + sys) + LOGIN_USER="root@sys" + DB="oceanbase" + if [[ "${OB_ROOT_PASSWORD}x" != "x" ]]; then + PASSCMD=-p${OB_ROOT_PASSWORD} + fi + ;; + root) + DB="oceanbase" + LOGIN_USER="root@${OB_TENANT_NAME}" + ;; + *) + DB="test" + LOGIN_USER="test@${OB_TENANT_NAME}" + ;; +esac + +echo "login as ${LOGIN_USER}" +CMD="obclient -h127.1 -u${LOGIN_USER} -A -D${DB} -P${OB_MYSQL_PORT} ${PASSCMD}" +echo "Command is: ${CMD}" +${CMD} + +``` + +### 3.4.2 使用mysql客户端连接 + +mysql软件安装: + +``` +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# yum install mysql -y +Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager + +This system is not registered with an entitlement server. You can use subscription-manager to register. + +Loading mirror speeds from cached hostfile +Resolving Dependencies +--> Running transaction check +---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed +--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-5.5.68-1.el7.x86_64 +--> Running transaction check +---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be updated +---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be an update +--> Finished Dependency Resolution + +Dependencies Resolved + +============================================================================================================================================= + Package Arch Version Repository Size +============================================================================================================================================= +Installing: + mariadb x86_64 1:5.5.68-1.el7 base 8.8 M +Updating for dependencies: + mariadb-libs x86_64 1:5.5.68-1.el7 base 760 k + +Transaction Summary +============================================================================================================================================= +Install 1 Package +Upgrade ( 1 Dependent package) + +Total download size: 9.5 M +Downloading packages: +Delta RPMs disabled because /usr/bin/applydeltarpm not installed. +(1/2): mariadb-libs-5.5.68-1.el7.x86_64.rpm | 760 kB 00:00:00 +(2/2): mariadb-5.5.68-1.el7.x86_64.rpm | 8.8 MB 00:00:00 +--------------------------------------------------------------------------------------------------------------------------------------------- +Total 22 MB/s | 9.5 MB 00:00:00 +Running transaction check +Running transaction test +Transaction test succeeded +Running transaction + Updating : 1:mariadb-libs-5.5.68-1.el7.x86_64 1/3 + Installing : 1:mariadb-5.5.68-1.el7.x86_64 2/3 + Cleanup : 1:mariadb-libs-5.5.65-1.el7.x86_64 3/3 + Verifying : 1:mariadb-libs-5.5.68-1.el7.x86_64 1/3 + Verifying : 1:mariadb-5.5.68-1.el7.x86_64 2/3 + Verifying : 1:mariadb-libs-5.5.65-1.el7.x86_64 3/3 + +Installed: + mariadb.x86_64 1:5.5.68-1.el7 + +Dependency Updated: + mariadb-libs.x86_64 1:5.5.68-1.el7 + +Complete! + +``` + +mysql 客户端连接ob数据库: + +``` +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# mysql -h 172.26.202.84 -uroot@sys -A -Doceanbase -P2881 +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MySQL connection id is 3221487844 +Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22) + +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]> exit +Bye +[root@iZ2ze7vpmpjz4nvnc23cptZ ~]# mysql -h 172.26.202.84 -uroot@test -A -Doceanbase -P2881 +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MySQL connection id is 3221487847 +Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22) + +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]> + +``` + diff --git "a/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" "b/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" new file mode 100644 index 0000000000000000000000000000000000000000..f86cf015038c713e0813439779b38b67cdce2995 --- /dev/null +++ "b/\345\277\253\351\200\237\344\275\223\351\252\214OceanBase.md" @@ -0,0 +1,310 @@ +# OceanBase初始化安装体验 + +> 作者:许玉冲 + + + +## 一、环境准备 + +OceanBase 数据库的目的不同,对资源的要求也不同。 + +| 目的 | CPU(核数) | 可用内存 | 磁盘 | 备注 | +| -------- | ---------- | -------- | ------------- | :----------------------------------------------------------: | +| 功能学习 | 2 | 10G | 10G | 不初始化数据。 | +| 性能测试 | 24 | 128G | SSD 500G 以上 | 数据盘和日志盘要分开。 | +| 生产环境 | 32 | 256G | SSD 2T 以上 | 数据盘和日志盘要分开。日志盘大小是内存的 3-4 倍。如果数据量增长,数据盘大小也要增加。 | + + + +本次测试使用了公有云ECS主机,使用OBD工具搭建单机测试环境。 + + + +## 1.1 云主机申请 + +申请esc云主机可以考虑使用抢占式实,价格实惠: + +![esc](media/快速体验OceanBase/esc.jpg) + +操作系统选择的 CentOS 8.8 64: + +![os](media/快速体验OceanBase/os.png) + + + +ECS创建成功: + +![esc2](media/快速体验OceanBase/esc2.png) + + + +查看ip地址信息: + +![ip](media/快速体验OceanBase/ip.png) + + + +远程客户端登录ESC服务器: + +![ecs3](media/快速体验OceanBase/ecs3.png) + + + +# 二,oceanbase软件安装 + +> 本次安装使用obd进行单节点安装和测试。 + + + +## 2.1 部署 OBD 软件 + +```bash +yum install -y yum-utils +yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo +yum install -y ob-deploy +``` + + + +## 2.2 编辑配置文件 + +> 配置文件下载地址: +> +> ``` +> https://github.com/oceanbase/obdeploy/tree/master/example +> https://open.oceanbase.com/docs/tutorials-cn/V1.0.0/10000000000012298 +> ``` + + + +**部署单节点 `observer` 进程:** + +> 主要配置ip地址,网卡名称,内存和磁盘大小。 + +``` +## Only need to configure when remote login is required +# user: +# username: your username +# password: your password if need +# key_file: your ssh-key file path if need +# port: your ssh port, default 22 +# timeout: ssh connection timeout (second), default 30 +oceanbase-ce: + servers: + # Please don't use hostname, only IP can be supported + - 192.168.1.3 + global: + # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. + home_path: /root/observer + # The directory for data storage. The default value is $home_path/store. + # data_dir: /data + # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. + # redo_dir: /redo + # Please set devname as the network adaptor's name whose ip is in the setting of severs. + # if set severs as "127.0.0.1", please set devname as "lo" + # if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0" + devname: eth0 + mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started. + rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started. + zone: zone1 + cluster_id: 1 + # please set memory limit to a suitable value which is matching resource. + memory_limit: 6G # The maximum running memory for an observer + system_memory: 3G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G. + stack_size: 512K + cpu_count: 16 + cache_wash_threshold: 1G + __min_full_resource_pool_memory: 268435456 + workers_per_cpu_quota: 10 + schema_history_expire_time: 1d + # The value of net_thread_count had better be same as cpu's core number. + net_thread_count: 4 + major_freeze_duty_time: Disable + minor_freeze_times: 10 + enable_separate_sys_clog: 0 + enable_merge_by_turn: FALSE + datafile_disk_percentage: 20 # The percentage of the data_dir space to the total disk space. This value takes effect only when datafile_size is 0. The default value is 90. + syslog_level: INFO # System log level. The default value is INFO. + enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true. + enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false. + max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0. + # observer cluster name, consistent with obproxy's cluster_name + appname: obcluster + # root_password: # root user password, can be empty +``` + + + +## 2.3软件部署 + +软件部署: + +> 部署之前主机ssh 需要配置免密钥登录: +> +> 参考:[2.4 如何初始化服务器环境 (oceanbase.com)](https://open.oceanbase.com/docs/tutorials-cn/V1.0.0/10000000000012296) + + + + + +``` +obd cluster deploy obtest -c ob.yaml +``` + +日志输出: + +``` +[root@lbdocker ~]# obd cluster deploy obtest -c /root/ob.yaml +Update OceanBase-community-stable-el7 ok +Update OceanBase-development-kit-el7 ok +Download oceanbase-ce-3.1.3-10100032022041510.el7.x86_64.rpm (47.10 M): 100% [############] Time: 0:01:34 521.61 kB/s +Package oceanbase-ce-3.1.3 is available. +install oceanbase-ce-3.1.3 for local ok ++-------------------------------------------------------------------------------------------+ +| Packages | ++--------------+---------+-----------------------+------------------------------------------+ +| Repository | Version | Release | Md5 | ++--------------+---------+-----------------------+------------------------------------------+ +| oceanbase-ce | 3.1.3 | 10100032022041510.el7 | e96a23de85ba1d53862b9955926194a01d19d0d0 | ++--------------+---------+-----------------------+------------------------------------------+ +Repository integrity check ok +Parameter check ok +Open ssh connection ok +Remote oceanbase-ce-3.1.3-e96a23de85ba1d53862b9955926194a01d19d0d0 repository install ok +Remote oceanbase-ce-3.1.3-e96a23de85ba1d53862b9955926194a01d19d0d0 repository lib check !! +[WARN] 192.168.6.77 oceanbase-ce-3.1.3-e96a23de85ba1d53862b9955926194a01d19d0d0 require: libmariadb.so.3 + +Try to get lib-repository +Download oceanbase-ce-libs-3.1.3-10100032022041510.el7.x86_64.rpm (155.23 K): 100% [######] Time: 0:00:00 519.21 kB/s +Package oceanbase-ce-libs-3.1.3 is available. +install oceanbase-ce-libs-3.1.3 for local ok +Use oceanbase-ce-libs-3.1.3-de0682967eec87fe70eb5eea227d750f8beb38d5 for oceanbase-ce-3.1.3-e96a23de85ba1d53862b9955926194a01d19d0d0 +Remote oceanbase-ce-libs-3.1.3-de0682967eec87fe70eb5eea227d750f8beb38d5 repository install ok +Remote oceanbase-ce-3.1.3-e96a23de85ba1d53862b9955926194a01d19d0d0 repository lib check ok +Cluster status check ok +Initializes observer work home ok +obtest deployed +``` + + + +## 2.4 启动集群 + +``` +[root@lbdocker ~]# obd cluster start obtest +Get local repositories and plugins ok +Open ssh connection ok +Load cluster param plugin ok +Check before start observer ok +[WARN] (192.168.6.77) clog and data use the same disk (/) + +Start observer ok +observer program health check ok +Connect to observer ok +Initialize cluster +Cluster bootstrap ok +Wait for observer init ok ++------------------------------------------------+ +| observer | ++--------------+---------+------+-------+--------+ +| ip | version | port | zone | status | ++--------------+---------+------+-------+--------+ +| 192.168.6.77 | 3.1.3 | 2881 | zone1 | active | ++--------------+---------+------+-------+--------+ + +obtest running + +``` + + + +## 2.5 状态检查 + +``` +[root@lbdocker ~]# obd cluster list ++------------------------------------------------------+ +| Cluster List | ++--------+---------------------------+-----------------+ +| Name | Configuration Path | Status (Cached) | ++--------+---------------------------+-----------------+ +| obtest | /root/.obd/cluster/obtest | running | ++--------+---------------------------+-----------------+ +[root@lbdocker ~]# obd cluster display obtest +Get local repositories and plugins ok +Open ssh connection ok +Cluster status check ok +Connect to observer ok +Wait for observer init ok ++------------------------------------------------+ +| observer | ++--------------+---------+------+-------+--------+ +| ip | version | port | zone | status | ++--------------+---------+------+-------+--------+ +| 192.168.6.77 | 3.1.3 | 2881 | zone1 | active | ++--------------+---------+------+-------+--------+ + +[root@lbdocker ~]# + +``` + + + +## 2.6 ob数据库连接 + +客户端软件安装: + +``` + yum install obclient -y + + +``` + + + +数据库连接: + +``` + obclient -h 127.0.0.1 -uroot@sys -P2881 -c -A oceanbase + + +[root@lbdocker ~]# obclient -h 127.0.0.1 -uroot@sys -P2881 -c -A oceanbase +Welcome to the OceanBase. Commands end with ; or \g. +Your MySQL connection id is 3221487753 +Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22) + +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]> show databases; ++--------------------+ +| Database | ++--------------------+ +| oceanbase | +| information_schema | +| mysql | +| SYS | +| LBACSYS | +| ORAAUDITOR | +| test | ++--------------------+ +7 rows in set (0.005 sec) + +MySQL [oceanbase]> + + +``` + + + + + +> 参考文章地址:[OceanBase 社区](https://open.oceanbase.com/docs) + + + + + + +