官方文档参考: https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001692940
1、安装包下载地址
下载路径:https://www.oceanbase.com/softwarecenter
所需软件:oceanbase-all-in-one-4.1.0.0-100120230523143820.el7.x86_64.tar.gz
2、安装路径(可自行选择)
软件路径:/data/myoceanbase
数据路径:/data/myoceanbase/oceanbase/store
日志路径:/data/myoceanbase/oceanbase/store
3、安装前准备
3.1、关闭透明大页
对于 Red Hat 操作系统,需要运行以下命令,手动关闭透明大页:
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
对于 CentOS 操作系统,需要运行以下命令,手动关闭透明大页:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
验证:cat /sys/kernel/mm/transparent_hugepage/enabled
3.2、校准时间
更改时区为CST时区
[root@localhost ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Ntp时间校准
Ntp安装:
https://blog.csdn.net/weixin_43675226/article/details/119953110
查看ntp是否安装
[root@localhost etc]# rpm -qa|grep -i ntp
python-ntplib-0.3.2-1.el7.noarch
fontpackages-filesystem-1.44-8.el7.noarch
ntpdate-4.2.6p5-29.el7.centos.2.x86_64
校准时间
[root@localhost etc]# ntpdate cn.pool.ntp.org
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Mon Oct 19 16:18:59 UTC 2020
验证时间
[root@localhost etc]# date
2023年 06月 21日 星期三 11:52:29 CST
[root@localhost etc]# ntpdate cn.pool.ntp.org
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Mon Oct 19 16:18:59 UTC 2020
3.3、配置limits.conf
执行以下命令,打开 /etc/security/limits.conf 配置文件:
vi /etc/security/limits.conf
在/etc/security/limits.conf 配置文件中添加以下内容:
root soft nofile 655350
root hard nofile 655350
* soft nofile 655350
* hard nofile 655350
* soft stack 20480
* hard stack 20480
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
退出当前会话,重新登录。执行以下命令,查看配置是否生效:
ulimit -a
3.4、关闭防火墙、关闭SELinux
依次执行以下命令,关闭防火墙:
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
执行以下命令,打开 /etc/selinux/config 配置文件:
vi /etc/selinux/config
在 /etc/selinux/config 配置文件中修改对应配置项为以下内容:
SELINUX=disabled
执行以下命令或重启服务器,使更改生效:
setenforce 0
执行以下命令,查看更改是否生效:
sestatus
4、解压、初始化
4.1、解压all-in-one压缩包
[admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
4.2、安装客户端:
[admin@test001 ~]$ cd oceanbase-all-in-one/bin/
[admin@test001 bin]$ ./install.sh
4.3、初始化:
[admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh
[admin@test001 ~]$ obd web
start OBD WEB in 0.0.0.0:8680
please open http://172.xx.xxx.233:8680
5、白屏部署
5.1、命令行执行 obd web 命令启动白屏界面
白屏界面默认使用 8680 端口,您可使用 obd web -p <PORT> 命令指定端口
[admin@test001 ~]$ obd web
start OBD WEB in 0.0.0.0:8680
please open http://172.xx.xxx.233:8680
5.2、部署配置
- 部署配置 界面可以配置集群名称,部署类型和部署组件。
- 集群名称 默认为 myoceanbase
- 部署类型 分为 完全部署 和 精简部署,选择完全部署
5.3、节点配置
节点配置界面可以配置数据库和组件节点,部署用户以及软件安装路径。
- 数据库节点配置:默认为一个 Zone,可通过单击尾部的删除图标新增或删除 Zone。
- OCP Express节点:配置本机IP。
- OBProxy节点:配置本机IP。
- 部署用户配置:用户名 默认为当前进程的启动用户,默认 SSH 端口为 22 端口,支持自定义用户和 SSH 端口。您需输入对应用户的密码,如各节点间已配置免密可免去输入密码。
- 软件路径:/data
5.4、集群配置
集群配置界面可对集群进行配置,包括系统租户的管理员用户(root@sys)密码、数据和日志目录、数据库及各组件的端口和参数配置等。
- datafile_size = memory_limit*3
- log_disk_size = memory_limit*3
- enable_syslog_recycle = False
- max_syslog_file_count = 4
- memory_limit = 26G
- system_memory = 6G
- cpu_count = 16
- proxy_mem_limited = 2G
- obproxy_sys_password(obproxy密码)
- logging_file_max_history = 30
5..5、预检查
在 预检查 页面查看所有配置信息,若发现问题可单击 上一步 进行修改;确认无误后,单击 预检查 进行检查。
若预检查报错,您可根据页面建议选择 自动修复 或者单击 了解更多方案 跳转至错误码文档,参考文档自行修改。所有报错修改后,可单击 重新检查 再次进行预检查。
6、部署、验证
- 连接OceanBase DataBase
[root@localhost ~]# obclient -h192.168.1.17 -P2881 -uroot -p'cx@123456' -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221487803
Server version: OceanBase_CE 4.1.0.0 (r101010022023051821-f7379b26f8cd11f026e06846043550f9e0d42ead) (Built May 18 2023 21:14:14)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]> Ctrl-C -- exit!
- OBProxy
[root@localhost ~]# obclient -h192.168.1.17 -P2883 -uroot -p'cx@123456' -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3407877
Server version: OceanBase_CE 4.1.0.0 (r101010022023051821-f7379b26f8cd11f026e06846043550f9e0d42ead) (Built May 18 2023 21:14:14)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]>
- OCP Express
本地访问:http://192.168.1.17:8180
查看部署状态
# 查看集群列表
[admin@test001 ~]$ obd cluster list
# 查看集群状态,以部署名为 myoceanbase 为例
[admin@test001 ~]$ obd cluster display myoceanbase
# 停止运行中的集群,以部署名为 myoceanbase 为例
[admin@test001 ~]$ obd cluster stop myoceanbase
# 销毁已部署的集群,以部署名为 myoceanbase 为例
[admin@test001 ~]$ obd cluster destroy myoceanbase