一、ODB
1. 什么是OBD?
OBD 全称为 OceanBase Deployer,是 OceanBase 开源软件的安装部署工具。OBD 同时也是包管理器,可以用来管理 OceanBase 所有的开源软件。
二、安装OBD
1. 安装yum-utils
[root@oceanbase1 ~]# sudo yum install -y yum-utils Loaded plugins: fastestmirror, langpacks adding repo from: https://mirrors.aliyun.com/oceanbase/OceanBase.repo grabbing file https://mirrors.aliyun.com/oceanbase/OceanBase.repo to /etc/yum.re pos.d/OceanBase.repo repo saved to /etc/yum.repos.d/OceanBase.repo [root@oceanbase1 ~]# sudo yum install -y ob-deploy Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn oceanbase.community.stable | 3.0 kB 00:00 oceanbase.development-kit | 3.0 kB 00:00 (1/2): oceanbase.development-kit/7/x86_64/primary_db | 33 kB 00:00 (2/2): oceanbase.community.stable/7/x86_64/primary_db | 39 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package ob-deploy.x86_64 0:1.5.0-12.el7 will be installed --> Finished Dependency Resolution ... ... Running transaction Updating : yum-utils-1.1.31-54.el7_8.noarch 1/2 Cleanup : yum-utils-1.1.31-50.el7.noarch 2/2 Verifying : yum-utils-1.1.31-54.el7_8.noarch 1/2 Verifying : yum-utils-1.1.31-50.el7.noarch 2/2 Updated: yum-utils.noarch 0:1.1.31-54.el7_8 Complete!
复制
2. 下载repo
[root@oceanbase1 ~]# sudo yum-config-manager --add-repo https://mirrors.aliyun.c om/oceanbase/OceanBase.repo Loaded plugins: fastestmirror, langpacks adding repo from: https://mirrors.aliyun.com/oceanbase/OceanBase.repo grabbing file https://mirrors.aliyun.com/oceanbase/OceanBase.repo to /etc/yum.re pos.d/OceanBase.repo repo saved to /etc/yum.repos.d/OceanBase.repo [root@oceanbase1 ~]# cat /etc/yum.repos.d/OceanBase.repo # OceanBase.repo [oceanbase.community.stable] name=OceanBase-community-stable-el$releasever baseurl=http://mirrors.aliyun.com/oceanbase/community/stable/el/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase [oceanbase.development-kit] name=OceanBase-development-kit-el$releasever baseurl=http://mirrors.aliyun.com/oceanbase/development-kit/el/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase
复制
毕竟是阿里出来的,必然依托阿里云
3. 安装ob-deploy
- rpm 安装
[root@oceanbase1 ~]# sudo yum install -y ob-deploy Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn oceanbase.community.stable Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn oceanbase.communit ... ... Running transaction Installing : ob-deploy-1.5.0-12.el7.x86_64 1/1 Installation of obd finished successfully Please source /etc/profile.d/obd.sh to enable it Verifying : ob-deploy-1.5.0-12.el7.x86_64 1/1 Installed: ob-deploy.x86_64 0:1.5.0-12.el7 Complete!
复制
4. obd.sh
[root@oceanbase1 ~]# source /etc/profile.d/obd.sh [root@oceanbase1 ~]# cat /etc/profile.d/obd.sh #!/bin/bash if [ -n "$BASH_VERSION" ]; then complete -F _obd_complete_func obd fi function _obd_reply_current_files() { filename=${cur##*/} dirname=${cur%*$filename} res=`ls -a -p $dirname 2>/dev/null | sed "s#^#$dirname#"` compopt -o nospace COMPREPLY=( $(compgen -o filenames -W "${res}" -- ${cur}) ) } function _obd_reply_deploy_names() { res=`ls -p $obd_home/.obd/cluster 2>/dev/null | sed "s#/##"` COMPREPLY=( $(compgen -o filenames -W "${res}" -- ${cur}) ) } function _obd_reply_tool_commands() { cmd_yaml=$obd_home/.obd/plugins/commands/0.1/command_template.yaml sections=`grep -En '^[0-9a-zA-Z]:' $cmd_yaml` for line in sections do num=`echo $line | awk -F ':' '{print $1}'` section=`echo $line | awk -F ':' '{print $2}'` if [[ "$section" == "commands" ]];then start_num=num elif [[ "$start_num" != "" ]];then end_num=num fi done if [[ "$end_num" == "" ]]; then end_num=`cat $cmd_yaml | wc -l` fi total_num=$((end_num - start_num)) res=`grep -E '^commands:' $cmd_yaml -A $total_num | grep name | awk -F 'name:' '{print $2}' | sort -u | tr '\n' ' '` COMPREPLY=( $(compgen -o filenames -W "${res}" -- ${cur}) ) } function _obd_complete_func { local all_cmds declare -A all_cmds COMPREPLY=() obd_home=${OBD_HOME:-~} env_file=${obd_home}/.obd/.obd_environ cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" all_cmds["obd"]="mirror cluster test update repo" all_cmds["obd cluster"]="autodeploy tenant start deploy redeploy restart reload destroy stop edit-config list display upgrade chst check4ocp reinstall" all_cmds["obd cluster *"]="_obd_reply_deploy_names" all_cmds["obd cluster tenant"]="create drop" all_cmds["obd cluster tenant *"]="_obd_reply_deploy_names" all_cmds["obd mirror"]="clone create list update enable disable" all_cmds["obd mirror clone"]="_obd_reply_current_files" all_cmds["obd repo"]="list" all_cmds["obd test"]="mysqltest sysbench tpch tpcc" all_cmds["obd test *"]="_obd_reply_deploy_names" if [ -f "$env_file" ] && [ "$(grep '"OBD_DEV_MODE": "1"' "$env_file")" != "" ]; then all_cmds["obd"]="${all_cmds[obd]} devmode env tool" all_cmds["obd devmode"]="enable disable" all_cmds["obd tool"]="command db_connect" all_cmds["obd tool db_connect"]="_obd_reply_deploy_names" all_cmds["obd tool command"]="_obd_reply_deploy_names" all_cmds["obd tool command *"]="_obd_reply_tool_commands" all_cmds["obd env"]="set unset show clear" fi case $prev in list) return 0 ;; -p|--path);& -c|--config) _obd_reply_current_files ;; *) valid_len=$COMP_CWORD words=( ${COMP_WORDS[@]::valid_len} ) index=valid_len while (( index >= 1 )); do target="${words[*]}" cmd=${all_cmds[$target]} if [[ "$cmd" != "" ]] then if [[ $cmd =~ ^_obd_reply.* ]] then $cmd break else COMPREPLY=( $(compgen -W "${cmd}" -- ${cur}) ) break fi fi index=$(( index - 1)) tmp=${words[*]::index} [[ "$tmp" != "" ]] && parent_cmd=${all_cmds[$tmp]} if [[ "$parent_cmd" =~ ^_obd_reply.* || " $parent_cmd " =~ " ${words[index]} " ]]; then words[index]='*' else break fi done ;; esac }
复制
5. ob-deploy
看看ob-deploy都有什么
[root@oceanbase1 obd]# rpm -ql ob-deploy|head /etc/profile.d/obd.sh /usr/bin/obd /usr/obd/config_parser /usr/obd/config_parser/oceanbase /usr/obd/config_parser/oceanbase-ce /usr/obd/config_parser/oceanbase/cluster_config_parser.py /usr/obd/example /usr/obd/example/autodeploy /usr/obd/example/autodeploy/distributed-example.yaml /usr/obd/example/autodeploy/distributed-with-obproxy-and-obagent-example.yaml [root@oceanbase1 obd]# pwd /usr/obd [root@oceanbase1 obd]# tree -L 2 . . ├── config_parser │ ├── oceanbase │ └── oceanbase-ce -> oceanbase ├── example │ ├── autodeploy │ ├── distributed-example.yaml │ ├── distributed-with-obproxy-example.yaml │ ├── local-example.yaml │ ├── mini-distributed-example.yaml │ ├── mini-distributed-with-obproxy-example.yaml │ ├── mini-local-example.yaml │ ├── mini-single-example.yaml │ ├── mini-single-with-obproxy-example.yaml │ ├── obagent │ ├── obproxy │ ├── single-example.yaml │ └── single-with-obproxy-example.yaml ├── lib │ ├── executer │ └── site-packages ├── mirror │ └── remote └── plugins ├── commands ├── general ├── mysqltest ├── obagent ├── ob-deploy ├── obproxy-ce ├── oceanbase ├── oceanbase-ce -> oceanbase ├── oceanbase-ce-libs ├── sysbench ├── tpcc ├── tpcds └── tpch 26 directories, 10 files
复制
从文件内容可以推测出一些支持或待支持的功能
- sysbench,tpcc,tpcds,tpch测试
- yaml是各种配置文件
- mirror存放的是repo文件
- mysqltest mysql的一些测试
三、快速启动OceanBase数据库
1. mini-local-example.yaml
[root@oceanbase1 obd]# obd cluster deploy c1 -c ./example/mini-local-example.yaml Update OceanBase-community-stable-el7 ok Update OceanBase-development-kit-el7 ok Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 0% [] ETA: --:--:- Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 0% [] ETA: 0:10:56 Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 0% [] ETA: 0:10:04 ... ... Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 75% [] ETA: 0:01:43Download oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm (47.30 M): 100% [############### Package oceanbase-ce-3.1.4-10000092022071511.el7 is available. install oceanbase-ce-3.1.4 for local ok +-------------------------------------------------------------------------------------------+ | Packages | +--------------+---------+-----------------------+------------------------------------------+ | Repository | Version | Release | Md5 | +--------------+---------+-----------------------+------------------------------------------+ | oceanbase-ce | 3.1.4 | 10000092022071511.el7 | c5cd94f4f190317b6a883c58a26460a506205ce6 | +--------------+---------+-----------------------+------------------------------------------+ Repository integrity check ok Parameter check ok Open ssh connection ok Cluster status check ok Initializes observer work home ok Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repo Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repo Try to get lib-repository Download oceanbase-ce-libs-3.1.4-10000092022071511.el7.x86_64.rpm (155.26 K): 100% [######### Package oceanbase-ce-libs-3.1.4-10000092022071511.el7 is available. install oceanbase-ce-libs-3.1.4 for local ok Remote oceanbase-ce-libs-3.1.4-10000092022071511.el7-6d5437b0cad486b55963f89b8ef3769af7995350 Remote oceanbase-ce-3.1.4-10000092022071511.el7-c5cd94f4f190317b6a883c58a26460a506205ce6 repo c1 deployed
复制
2. 启动
[root@oceanbase1 obd]# obd cluster start c1 Get local repositories ok Search plugins ok Open ssh connection ok Load cluster param plugin ok Check before start observer x [ERROR] OBD-1007: (127.0.0.1) open files must not be less than 20000 (Current value: 1024) [ERROR] OBD-2000: (127.0.0.1) not enough memory. (Free: 6.4G, Need: 8.0G) [WARN] (127.0.0.1) clog and data use the same disk (/)
复制
- 增大内存,8G默认不行
- 加大openfiles
[root@oceanbase1 obd]# echo "* hard nofile 655350" >> /etc/security/limits.conf [root@oceanbase1 obd]# echo "* soft nofile 655350" >> /etc/security/limits.conf
复制
记得重新登录窗口
[root@oceanbase1 ~]# obd cluster start c1 Get local repositories ok Search plugins ok Open ssh connection ok Load cluster param plugin ok Check before start observer ok Start observer ok observer program health check ok Connect to observer ok Wait for observer init ok +---------------------------------------------+ | observer | +-----------+---------+------+-------+--------+ | ip | version | port | zone | status | +-----------+---------+------+-------+--------+ | 127.0.0.1 | 3.1.4 | 2881 | zone1 | active | +-----------+---------+------+-------+--------+ c1 running
复制
3. 安装客户端
居然没有自带客户端
[root@oceanbase1 ~]# yum install mysql Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn 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.60-1.el7_5 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 size: 9.5 M Total download size: 8.8 M Is this ok [y/d/N]: y Downloading packages: mariadb-5.5.68-1.el7.x86_64.rpm | 8.8 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. 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.60-1.el7_5.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.60-1.el7_5.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!
复制
4. 连接测试
[root@oceanbase1 ~]# mysql -h 127.0.0.1 -uroot -P2883 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [root@oceanbase1 ~]# ps -ef|grep observer root 67449 1 99 18:16 ? 01:56:45 /root/observer/bin/observer -r 127.0.0.1:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /root/observer/store -i lo -l INFO -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_disk_percentage=20,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 root 70168 68227 0 18:45 pts/1 00:00:00 grep --color=auto observer [root@oceanbase1 ~]# ps -ef|grep observer|grep -v grep root 67449 1 99 18:16 ? 01:57:14 /root/observer/bin/observer -r 127.0.0.1:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /root/observer/store -i lo -l INFO -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_disk_percentage=20,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 [root@oceanbase1 ~]# mysql -h 127.0.0.1 -uroot -P2883 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [root@oceanbase1 ~]# ps -ef|grep observer|grep -v grep root 67449 1 99 18:16 ? 01:57:31 /root/observer/bin/observer -r 127.0.0.1:2882:2881 -p 2881 -P 2882 -z zone1 -c 1 -d /root/observer/store -i lo -l INFO -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_disk_percentage=20,enable_syslog_wf=False,enable_syslog_recycle=True,max_syslog_file_count=4 [root@oceanbase1 ~]# grep port /usr/obd/example/mini-local-example.yaml # Please don't use hostname, only IP can be supported 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. [root@oceanbase1 ~]# mysql -h 127.0.0.1 -uroot -P2881 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221487971 Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45: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)]> select version(); +--------------------+ | version() | +--------------------+ | 3.1.4-OceanBase CE | +--------------------+ 1 row in set (0.01 sec) MySQL [(none)]>
复制
- 这里不知道为什么官方文档给的端口是2883,实际是2881
四、总结
- 虽然文档有一些小出入,但是整体安装来看还算顺畅,坑不多。
- 居然没有自带客户端,有懂的麻烦帮忙解答一下。
- 从obd文件内容看是封装了不少东西的,期待后续的测试。
最后修改时间:2022-10-28 11:08:38
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论

2年前

评论
👍🏻
2年前

评论
相关阅读
2025年4月中国数据库流行度排行榜:OB高分复登顶,崖山稳驭撼十强
墨天轮编辑部
2297次阅读
2025-04-09 15:33:27
2025年4月国产数据库中标情况一览:4个千万元级项目,GaussDB与OceanBase大放异彩!
通讯员
412次阅读
2025-04-30 15:24:06
2025年4月国产数据库大事记:4个千万级中标项目诞生!2024年达梦净利3.6亿、金仓净利8006.6万……
墨天轮编辑部
360次阅读
2025-04-30 17:39:54
AI关键场景得到全面支持!OceanBase入选Forrester报告三大领域代表厂商
OceanBase数据库
252次阅读
2025-04-19 22:27:54
数据库管理-第313期 分布式挑战单机,OceanBase单机版试玩(20250411)
胖头鱼的鱼缸
235次阅读
2025-04-10 22:41:56
OceanBase单机版产品解读
多明戈教你玩狼人杀
196次阅读
2025-04-11 15:28:33
1364万!2024年中国联通软研院OceanBase扩容单一来源采购公示
通讯员
175次阅读
2025-04-21 15:55:59
OceanBase单机版保姆级安装
薛晓刚
162次阅读
2025-04-10 17:30:42
Oceanbase单机版上手示例
潇湘秦
143次阅读
2025-04-18 13:40:24
919万!南航信息中心采购OceanBase数据库软件许可及服务
通讯员
142次阅读
2025-04-29 16:13:34