OceanBase Docker体验

  1. 实验一:OceanBase Docker体验

通过 OceanBase Docker 容器,快速的体验 OceanBase 的 自动化部署过程,以及了解 OceanBase 集群安装成功后的目录特点和使用方法。

    1. Docker镜像
      1. 实验环境
        1. 实验环境说明

1台OCP 5台OBSERVER

aarch64 Kylin Linux Advanced Server release V10 (Sword)

CPU 16核

内存 64G

磁盘划分(lvm、fdisk)

用途 实验环境

/docker docker安装目录 200G

/home ob的安装目录 100G

/data/1 数据盘 110G

/data/log1 日志盘(事务日志) 200G

        1. 实验环境配置
  1. 设置chrony服务器

ocp:

sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'

local clock

server 127.127.1.0

fudge 127.127.1.0 stratum 10

启动时钟服务器 Systemctl start chronyc

更新最新时钟 chronyc sources

  1. 建立用户,挂载文件系统(略)
  2. 修改limits限制、内核参数、关闭防火墙
  3. 网卡配置

cd /etc/sysconfig/network-scripts

cat ifcfg-enp1s0

  1. 配置ssh免密

ocp-ob-obp-odc-antman_20220506_arm/common/ssh/

vi address.txt 编辑IP、用户名、密码、hostname

./step1_init.sh

./step2_testlogin.sh

./step3_sethostname.sh

./step4_obssh.sh

  1. 下载对应版本 t-oceanbase-antman和oceanbase-all-in-one
    1.
    1.
    1. 安装ocp

1、安装t-oceanbase-antman

2、创建admin用户

/root/t-oceanbase-antman/clonescripts/clone.sh -u

3、配置内核参数(/etc/sysctl.conf)

/root/t-oceanbase-antman/clonescripts/clone.sh -c -r ocp

4、安装依赖包

/root/t-oceanbase-antman/clonescripts/clone.sh -m -r ocp

5、安装docker

/root/t-oceanbase-antman/clonescripts/clone.sh -i

6、上传docker镜像

docker load -i ocp323.arm.tar.gz

7、配置obcluster.conf文件

/root/t-oceanbase-antman/init_obcluster_conf.sh 选1

8、安装部署前预检查

/root/t-oceanbase-antman/clonescripts/precheck.sh -m ocp

9、安装

sh install.sh -i 1-8

      1. Docker环境
        1. Docker环境
  1. 下载docker镜像

wget https://download.docker.com/linux/static/stable/aarch64/docker-24.0.6.tgz

  1. 解压下载好的压缩包

tar xf docker-24.0.6.tgz

  1. 移动解压文件到/usr/bin 目录中

mv docker/* /usr/bin/

  1. 启动docker

dockerd

        1. Docker安装
  1. 执行命令:docker pull oceanbase/obce-mini 下载所需镜像
  2. 启动docker命令:docker run -p 2881:2881 --name obce-mini -d -e OB_HOME_PATH="/root/obce/" -e OB_TENANT_NAME="obmysql" oceanbase/obce-mini
  3. 进入容器:docker exec -it obce-mini bash
    1. 使用 OBD 命令OceanBase 集群部署
      1. OBD安装
  1. 检查OBD安装包

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

  1. 安装obd

Rpm --ivh ob-deploy-2.3.0-4.el7.aarch64.rpm

  1. 将OceanBase rpm离线软件包加入本地镜像

obd mirror clone obproxy-ce-4.2.0.0-7.el7.aarch64.rpm obproxy-ce-4.2.0.0-7.el7.aarch64.rpm libobclient-2.2.2-3.el7.aarch64.rpm

      1. 集群配置文件

[root@ob1 obtools]# cat mini-distributed-with-obproxy-example.yaml

Only need to configure when remote login is required

user:

username: root <===========

password: root <===========

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: z1

Please don't use hostname, only IP can be supported

ip: 192.168.0.1 <===========

  • name: z2

ip: 192.168.0.2 <===========

  • name: z3

ip: 192.168.0.3 <===========

  • name: z4

ip: 192.168.0.4 <===========

  • name: z5

ip: 192.168.0.5 <===========

global:

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: ens192 <===========

cluster_id: 1

please set memory limit to a suitable value which is matching resource.

memory_limit: 8G

system_memory: 4G

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

syslog_level: INFO

enable_syslog_recycle: true

max_syslog_file_count: 4

observer cluster name, consistent with obproxy's cluster_name

appname: ob_cluster

root_password: 123456 <===========

proxyro_password: 123456 <===========

z1:

mysql_port: 2881

rpc_port: 2882

home_path: /root/observer

zone: zone1

z2:

mysql_port: 2881

rpc_port: 2882

home_path: /root/observer

zone: zone2

z3:

mysql_port: 2881

rpc_port: 2882

home_path: /root/observer

zone: zone3

z4:

mysql_port: 2881

rpc_port: 2882

home_path: /root/observer

zone: zone4

z5:

mysql_port: 2881

rpc_port: 2882

home_path: /root/observer

zone: zone5

obproxy:

servers:

  • 192.168.0.1 <===========

global:

listen_port: 2883

prometheus_listen_port: 2884

home_path: /root/obproxy

oceanbase root server list

format: ip:mysql_port,ip:mysql_port

rs_list: 192.168.0.1:2881;192.168.0.2:2881;192.168.0.3:2881;192.168.0.4:2881;192.168.0.5:2881 <===========

enable_cluster_checkout: false

observer cluster name, consistent with oceanbase-ce's appname

cluster_name: ob_cluster

obproxy_sys_password: 123456 <===========

observer_sys_password: 123456 <===========

      1. 安装集群

obd cluster deploy ob-cluster -c ./mini-distributed-with-obproxy-example.yaml

      1. 启动集群

obd cluster start ob-cluste

    1. 创建业务租户、业务数据库和表
  1. 创建unit规格

create resource unit mini max_cpu=5, min_cpu=5, max_memory='2G', min_memory='2G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='10G';

  1. 创建资源池

create resource pool mini_pool_t1 unit=mini ,unit_num=1;

create resource pool mini_pool_t2 unit=mini ,unit_num=1;

  1. 创建租户

create tenant test charset='utf8mb4', replica_num=1,

zone_list=('zone1,zone2,zone3,zone4,zone5'), primary_zone='zone1,zone2;zone3,zone4;zone5',

resource_pool_list=('mini_pool_t1') set ob_tcp_invited_nodes='%';

create tenant test2 charset='utf8mb4', replica_num=1,

zone_list=('zone1,zone2,zone3,zone4,zone5'), primary_zone='zone1,zone2;zone3,zone4'zone5',

resource_pool_list=('mini_pool_t2') set ob_tcp_invited_nodes='%',

ob_compatibility_mode='oracle';

  1. 登陆业务租户

obclient --h192.168.0.2 -P2883 -uroot@test#admin:1673835228 --p

创建数据库

创建表

相关推荐
胖毁青春,瘦解百病41 分钟前
Docker镜像源设置不生效问题排查
docker·容器
嘤嘤怪呆呆狗2 小时前
【开发问题记录】使用 Docker+Jenkins+Jenkins + gitee 实现自动化部署前端项目 CI/CD(centos7为例)
前端·vue.js·ci/cd·docker·gitee·自动化·jenkins
Carry_NJ3 小时前
docker-compose样例
运维·docker·容器
勇-子3 小时前
K8s 常用资源介绍
云原生·容器·kubernetes
大G哥3 小时前
k8s创建单例redis设置密码
数据库·redis·云原生·容器·kubernetes
勇-子5 小时前
K8s DaemonSet的介绍
云原生·容器·kubernetes
孟里啥都有.5 小时前
12.24 k8s yaml文件类型和介绍
云原生·容器·kubernetes
花晓木5 小时前
最新版本 - 二进制安装k8s1.29.2 集群
云原生·容器·kubernetes
休耕6 小时前
kubeadm搭建k8s集群
云原生·容器·kubernetes
梁萌8 小时前
Linux安装Docker
linux·运维·docker·helloworld·容器化部署