赞
踩
组件 | 备注 |
---|---|
all-in-one | 从 V4.0.0 开始,OceanBase 提供统一的安装包 all-in-one package。您可以通过这个统一的安装包一次性完成 OBD、OceanBase 数据库、OBProxy、obagent、Grafana 和 Prometheus 的安装;您可以根据实际需求选择部分组件安装或者指定组件的版本 |
参考官方文档:部署环境检查项
# 检查内存,至少需要8G
free -h
# 检查磁盘,不低于配置文件内指定size
df -h
配置 /etc/security/limits.conf
,退出当前会话,重新登录。
执行sysctl -p
,查看配置是否生效
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
/etc/sysctl.conf
echo 'fs.aio-max-nr=1048576' | sudo tee /etc/sysctl.conf
检查并关闭防火墙
systemctl status firewalld
systemctl stop firewalld
检查并关闭SELinux
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g'/etc/selinux/config
# 创建用户
useradd -U admin -d /home/admin -s /bin/bash
# 创建用户空间
mkdir -p /home/admin
# 授权用户空间
sudo chown -R admin:admin /home/admin
# 修改密码。密码设为admin123,后续步骤会用到
passwd admin
# 加入wheel组(可使用sudo)
usermod -G wheel user1
# 验证
id admin
参考官方文档:OceanBase安装部署
下载并安装all-in-one package。
一键安装OBD、OceanBase 数据库、OBProxy、obagent、Grafana 和 Prometheus 的安装;
您可以根据实际需求选择部分组件安装或者指定组件的版本
# 下载
wget https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/7/x86_64/oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
# 解压
tar -xzf oceanbase-all-in-one-4.xx.xx-xxx.tar.gz
# 一键安装
cd oceanbase-all-in-one/bin/
./install.sh
# 验证
which obd
/root/.oceanbase-all-in-one/obd/usr/bin/obd
which obclient
/root/.oceanbase-all-in-one/obclient/u01/obclient/bin/obclient
三台服务器依次执行
# 创建目录
sudo mkdir -p /u02/admin/oceanbase/observer/ccsit-2/home
sudo mkdir -p /u02/admin/oceanbase/observer/ccsit-2/data
sudo mkdir -p /u02/admin/oceanbase/observer/ccsit-2/redo
sudo mkdir -p /u02/admin/oceanbase/observer/ccsit-2/obproxy-sit
# 授权
sudo chown -R admin:admin /u02/admin
obcluster-sit.yaml
ip address
查看服务器网卡名称devname
## Only need to configure when remote login is required user: username: admin password: admin123 #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: - name: server1 ip: 10.95.34.37 - name: server2 ip: 10.95.34.38 - name: server3 ip: 10.95.34.39 global: # 网卡名称 devname: ens32 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. datafile_size: 20G # Size of the data file. log_disk_size: 24G # The size of disk space used by the clog files. cpu_count: 8 production_mode: true 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: ccsit-2 root_password: NbrcgBRHfL server1: 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. # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. home_path: /u02/admin/oceanbase/observer/ccsit-2/home # The directory for data storage. The default value is $home_path/store. data_dir: /u02/admin/oceanbase/observer/ccsit-2/data # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. redo_dir: /u02/admin/oceanbase/observer/ccsit-2/redo zone: zone1 devname: ens32 system_memory: 4G cpu_count: 16 datafile_size: 41G log_disk_size: 24G production_mode: false server2: 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. # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. home_path: /u02/admin/oceanbase/observer/ccsit-2/home # The directory for data storage. The default value is $home_path/store. data_dir: /u02/admin/oceanbase/observer/ccsit-2/data # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. redo_dir: /u02/admin/oceanbase/observer/ccsit-2/redo zone: zone2 devname: ens32 system_memory: 4G cpu_count: 16 datafile_size: 41G log_disk_size: 24G production_mode: false server3: 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. # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. home_path: /u02/admin/oceanbase/observer/ccsit-2/home # The directory for data storage. The default value is $home_path/store. data_dir: /u02/admin/oceanbase/observer/ccsit-2/data # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. redo_dir: /u02/admin/oceanbase/observer/ccsit-2/redo zone: zone3 devname: ens32 system_memory: 4G cpu_count: 16 datafile_size: 41G log_disk_size: 24G production_mode: false obproxy-ce: depends: - oceanbase-ce servers: - 10.95.34.39 global: # The working directory for obproxy. Obproxy is started under this directory. This is a required field. listen_port: 2883 prometheus_listen_port: 2884 rs_list: 10.95.34.37:2881;10.95.34.38:2881;10.95.34.39:2881 enable_cluster_checkout: false cluster_name: ccsit-2 skip_proxy_sys_private_check: true home_path: /u02/admin/oceanbase/observer/ccsit-2/obproxy-sit enable_strict_kernel_release: false enable_cluster_checkout: false
加上-v可以输出部署日志
obd cluster autodeploy ccsit-2-c obcluster-sit.yaml -v
## 日志文件
tail -200f /u02/admin/oceanbase/observer/ccsit-2/home/log/observer.log
如果需要修改配置项,需要修改obd已经加载的配置。这个时候修改obcluster-sit.yaml
是无效的
## 查看 & 修改配置信息(和vim一样用)
obd cluster edit-config ccsit-2 -v
## 停止集群
obd cluster stop ccsit-2 -v
## 重新安装集群
obd cluster redeploy ccsit-2 -v
使用连接工具(navicat、dbeaver等)登录root账号,密码在配置项中,如果没有填写,默认是空
用户名:root
密码:无
创建资源规格 unit config
参考官方文档:创建unit config
CREATE RESOURCE UNIT unit1 MAX_CPU 4, MEMORY_SIZE '2G', MAX_IOPS 1280,LOG_DISK_SIZE '10G', MIN_IOPS=1024;
CREATE RESOURCE UNIT unit2 MAX_CPU 4, MEMORY_SIZE '2G', MAX_IOPS 1280,LOG_DISK_SIZE '10G', MIN_IOPS=1024;
## 验证
SELECT * FROM oceanbase.__all_unit_config;
## 修改配置项(需要时再执行)
ALTER RESOURCE UNIT unit2 MEMORY_SIZE '2G'
关联 unit config
参考官方文档:创建pool
CREATE RESOURCE POOL pool1 UNIT='unit1',UNIT_NUM=1,ZONE_LIST=('zone1','zone2','zone3');
## 验证
SELECT * FROM oceanbase.__all_resource_pool;
根据创建的 resource pool 创建租户
参考官方文档:创建租户
CREATE TENANT IF NOT EXISTS tenant1 CHARSET='utf8mb4', ZONE_LIST=('zone1','zone2','zone3'), PRIMARY_ZONE='zone1,zone2,zone3', RESOURCE_POOL_LIST=('pool1') SET ob_tcp_invited_nodes='%';
## 验证
SELECT * FROM DBA_OB_TENANTS;
参考官方文档:创建用户 & 授权
用户名:root@tenant1#ccsit-2
密码:无
# 创建用户
CREATE USER 'sqluser01' IDENTIFIED BY '123456';
# 授权
GRANT ALL PRIVILEGES ON *.* TO sqluser01 WITH GRANT OPTION;
用户名格式:用户名@租户名#集群名
用户名格式:
1、用户名@租户名#集群名
2、集群名:租户名:用户名
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。