离线使用OBD本地部署单节点OceanBase

文章目录

    • 实验环境
    • 下载安装包
    • 准备配置文件
    • 部署observer
    • 启动集群
    • 验证
    • 停止集群
    • 销毁集群

实验环境

操作系统 内存 硬盘
Fedora release 35 (Thirty Five) 12G 60G

下载安装包

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

  1. 部署单机单节点只需要以下三个包

离线使用OBD本地部署单节点OceanBase_第1张图片

  1. 安装包
[root@fedora rpm]# ll
总用量 80252
-rw-rw-r-- 1 frank frank 33305696  227 15:01 ob-deploy-1.2.1-9.el7.x86_64.rpm
-rw-rw-r-- 1 frank frank 48708456  227 15:01 oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm
-rw-rw-r-- 1 frank frank   158948  227 15:01 oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm
  1. 安装obd
[root@fedora rpm]# rpm -ivh ob-deploy-1.2.1-9.el7.x86_64.rpm
警告:ob-deploy-1.2.1-9.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 9f29218d: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:ob-deploy-1.2.1-9.el7            ################################# [100%]
Installation of obd finished successfully
Please source /etc/profile.d/obd.sh to enable it
  1. 设置环境变量
[root@fedora rpm]#  source /etc/profile.d/obd.sh
  1. 构建本地源
[root@fedora rpm]# obd mirror clone /home/frank/rpm/*.rpm
name: ob-deploy
version: 1.2.1
release:9.el7
arch: x86_64
md5: 219823e1119d37f59ce2c906b44e45605acfd3f3
add /home/frank/rpm/ob-deploy-1.2.1-9.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 3.1.2
release:10000392021123010.el7
arch: x86_64
md5: 7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed
add /home/frank/rpm/oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 3.1.2
release:10000392021123010.el7
arch: x86_64
md5: 94fff0ab31de053051dba66039e3185fa390cad5
add /home/frank/rpm/oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm to local mirror
  1. 删除远程源
[root@fedora rpm]# rm -rf ~/.obd/mirror/remote/
  1. 查看本地源

离线使用OBD本地部署单节点OceanBase_第2张图片

准备配置文件

这个demo使用本地单节点进行演示,所以选择了官方提供的mini-local-example.yaml配置文件。
获取方式:https://github.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml
内容如下:

oceanbase-ce:
  servers:
    # Please don't use hostname, only IP can be supported
    - 127.0.0.1
  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: lo
    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: 8G # The maximum running memory for an observer
    system_memory: 4G # 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
    sys_bkgd_migration_retry_num: 3
    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.
    # root_password: # root user password, can be empty

注意事项:

  1. servers:只能使用ip,不能使用主机名(hostname)。
  2. cpu_count:CPU数量可以大于物理CPU的数量。

部署observer

  1. 部署
[root@fedora rpm]# obd cluster deploy myob -c mini-local-example.yaml
[WARN] Use centos 7 remote mirror repository for fedora 35
Package oceanbase-ce-3.1.2 is available.
install oceanbase-ce-3.1.2 for local ok
+-------------------------------------------------------------------------------------------+
|                                          Packages                                         |
+--------------+---------+-----------------------+------------------------------------------+
| Repository   | Version | Release               | Md5                                      |
+--------------+---------+-----------------------+------------------------------------------+
| oceanbase-ce | 3.1.2   | 10000392021123010.el7 | 7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed |
+--------------+---------+-----------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository install ok
Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository lib check !!
[WARN] 127.0.0.1 oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed require: libmariadb.so.3

Try to get lib-repository
[WARN] Use centos 7 remote mirror repository for fedora 35
Package oceanbase-ce-libs-3.1.2 is available.
install oceanbase-ce-libs-3.1.2 for local ok
Use oceanbase-ce-libs-3.1.2-94fff0ab31de053051dba66039e3185fa390cad5 for oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed
Remote oceanbase-ce-libs-3.1.2-94fff0ab31de053051dba66039e3185fa390cad5 repository install ok
Remote oceanbase-ce-3.1.2-7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed repository lib check ok
Cluster status check ok
Initializes observer work home ok
myob deployed
  1. 查看部署结果

离线使用OBD本地部署单节点OceanBase_第3张图片

  1. 参数设置
[root@fedora rpm]# echo fs.aio-max-nr = 131072 >> /etc/sysctl.conf
[root@fedora rpm]# sysctl -p
[root@fedora rpm]# ulimit -n
1024
[root@fedora rpm]# ulimit -n 65535
[root@fedora rpm]# ulimit -n
65535

启动集群

obd cluster start myob

离线使用OBD本地部署单节点OceanBase_第4张图片

验证

[root@fedora log]# mycli -h127.0.0.1 -P2881 -uroot
MySQL
mycli 1.24.3
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Thanks to the contributor - Roland Walker
MySQL [email protected]:(none)> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set
Time: 0.015s
MySQL [email protected]:(none)>

停止集群

[root@fedora rpm]# obd cluster stop myob
Get local repositories and plugins ok
Open ssh connection ok
Stop observer ok
myob stopped

销毁集群

[root@fedora rpm]# obd cluster destroy myob
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
observer work dir cleaning ok
myob destroyed

你可能感兴趣的:(信创,OceanBase,database,信创,OceanBase,运维)