OceanBase 快速上手

举报
snowofsummer 发表于 2021/12/04 09:05:05 2021/12/04
【摘要】 本文介绍通过OBD,自动化部署工具部署单节点OceanBase 数据库。#操作系统版本[root@db01 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) 1,软件下载,配置第三方yum,安装OBD工具sudo yum install -y yum-utilssudo yum-config-manager --...

本文介绍通过OBD,自动化部署工具部署单节点OceanBase 数据库。

#操作系统版本

[root@db01 ~]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core) 

1,软件下载,配置第三方yum,安装OBD工具

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install -y ob-deploy

2,编译配置文件

#模板地址:

https://github.com/oceanbase/obdeploy/blob/master/example/autodeploy/single-example.yaml

#参考模板:

## 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
    - 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: /home/admin/oceanbase-ce
    # The directory for data storage. The default value is $home_path/store.
    # data_dir: /data/1
    # The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
    redo_dir: /data/log1
    # 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.
    rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
    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
    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.
    datafile_size: 5G
    syslog_level: ERROR # 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: obce-single
    root_password: rootPWD123 # root user password, can be empty
    proxyro_password:  proxyROPWD123 # proxyro user pasword, consistent with obproxy's observer_sys_password, can be empty

3,运行自动部署:

#需要设置系统参数

[root@db01 ~]# tail -5 /etc/security/limits.conf 
#@student        -       maxlogins       4

# End of file
*		soft	nofile		99999
*		hard	nofile		99999

部署失败日志:
[root@db01 ~]# obd cluster autodeploy  test -c c.conf
Update OceanBase-community-stable-el7 ok
Update OceanBase-development-kit-el7 ok
Download oceanbase-ce-3.1.1-4.el7.x86_64.rpm (46.21 M): 100% [###################################################################################################################################################] Time: 0:00:12   3.94 MB/s
Package oceanbase-ce-3.1.1 is available.
install oceanbase-ce-3.1.1 for local ok
Cluster param config check ok
Open ssh connection ok
Generate observer configuration ok
oceanbase-ce-3.1.1 already installed.
+-----------------------------------------------------------------------------+
|                                   Packages                                  |
+--------------+---------+---------+------------------------------------------+
| Repository   | Version | Release | Md5                                      |
+--------------+---------+---------+------------------------------------------+
| oceanbase-ce | 3.1.1   | 4.el7   | f19f8bfb67723712175fb0dfd60579196b3168f1 |
+--------------+---------+---------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository install ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check !!
[WARN] 127.0.0.1 oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 require: libmariadb.so.3

Try to get lib-repository
Download oceanbase-ce-libs-3.1.1-4.el7.x86_64.rpm (155.15 K): 100% [#############################################################################################################################################] Time: 0:00:00 209.30 kB/s
Package oceanbase-ce-libs-3.1.1 is available.
install oceanbase-ce-libs-3.1.1 for local ok
Use oceanbase-ce-libs-3.1.1-58384f7ab4ee736e9d530f4bdd63c20ced0e7aba for oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1
Remote oceanbase-ce-libs-3.1.1-58384f7ab4ee736e9d530f4bdd63c20ced0e7aba repository install ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check ok
Cluster status check ok
Initializes observer work home ok
test deployed
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer x
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[ERROR] (127.0.0.1) open files number must not be less than 20000 (Current value: 1024)

#运行自动部署:

[root@db01 ~]# obd cluster autodeploy  test -c c.conf
oceanbase-ce-3.1.1 already installed.
Cluster param config check ok
Open ssh connection ok
Generate observer configuration ok
oceanbase-ce-3.1.1 already installed.
+-----------------------------------------------------------------------------+
|                                   Packages                                  |
+--------------+---------+---------+------------------------------------------+
| Repository   | Version | Release | Md5                                      |
+--------------+---------+---------+------------------------------------------+
| oceanbase-ce | 3.1.1   | 4.el7   | f19f8bfb67723712175fb0dfd60579196b3168f1 |
+--------------+---------+---------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository install ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check ok
Cluster status check ok
Initializes observer work home ok
test deployed
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] (127.0.0.1) The recommended number of open files is 655350 (Current value: 99999)

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 |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1   | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+

test running

#检查状态:

[root@db01 ~]# obd cluster display test
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 |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1   | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+

4,安装客户端,并连接数据库

sudo yum install -y obclient
连接数据库:
[root@db01 ~]# obclient -h127.0.0.1 -P 2881 -uroot -prootPWD123
Welcome to the OceanBase.  Commands end with ; or \g.
Your MySQL connection id is 3221487723
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)

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)]> 


MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.004 sec)

MySQL [(none)]> 

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。