centos7.2以docker方式安装oceanbase 1.修改服务器相关配置 #关闭系统防火墙 [root@oceanbase log]# systemctl disable --now firewalld.service #关闭selinux [root@oceanbase ~]# vim /etc/selinux/config SELINUX=disabled #修改主机名 [root@localhost ~]# hostnamectl set-hostname oceanbase #服务器DNS [root@oceanbase ~]# echo "nameserver 8.8.8.8" >> /etc/resolv.conf #修改linux内核参数/etc/sysctl.conf fs.file-max = 65536 net.ipv4.tcp_fin_timeout= 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_max_tw_buckets = 360000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 2 net.ipv4.tcp_synack_retries = 1 net.core.somaxconn = 32768 net.core.netdev_max_backlog = 32768 net.ipv4.tcp_max_orphans = 327680 net.ipv4.tcp_syncookies = 1 net.nf_conntrack_max = 102400 net.netfilter.nf_conntrack_max = 102400 #net.ipv4.tcp_tw_recycle = 1 [root@oceanbase ~]# sysctl -p 2.docker环境安装 #安装docker环境依赖 [root@oceanbase ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2 wget #下载repo文件 [root@oceanbase ~]# wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo [root@oceanbase yum.repos.d]# vim docker-ce.repo #修改: :%s/$releasever/7/g #开始安装docker [root@oceanbase ~]# sudo yum makecache fast [root@oceanbase ~]# sudo yum -y install docker-ce #查看docker版本 [root@oceanbase ~]# docker version #启动docker并设置为开机自启动 [root@oceanbase log]# systemctl start docker [root@oceanbase ~]# systemctl enable docker.service [root@oceanbase ~]# docker version Client: Docker Engine - Community Version: 25.0.3 API version: 1.44 Go version: go1.21.6 Git commit: 4debf41 Built: Tue Feb 6 21:17:10 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.3 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: f417435 Built: Tue Feb 6 21:16:08 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0 3.oceanbase使用docker部署 #查看当前oceanbase可部署的docker版本 [root@oceanbase ~]# docker search oceanbase NAME DESCRIPTION STARS OFFICIAL oceanbasedev/ob-operator test repository for [ob-operator](https://gi… 0 oceanbase/oceanbase-ce OceanBase is an open-source, distributed HTA… 24 oceanbasedev/oceanbase-cn 0 oceanbasedev/obagent 0 oceanbase/obce-mini obce-mini is a mini standalone test image fo… 5 oceanbase/oceanbase-xe OceanBase Database 2.2 Express Edition 4 oceanbase/ob-operator 0 oceanbase/miniob miniob database competition 2 oceanbase/obce-operator obce-operator 1 oceanbase/obagent 0 oceanbasedev/oceanbase-chart 0 oceanbase/oceanbase-cloud-native 0 oceanbase/obproxy-ce 0 oceanbasedev/obproxy-ce 0 oceanbasedev/sealer-ob 0 oceanbase/ocp-ce OceanBase Cloud Platform (OCP) Community Edi… 0 oceanbase/centos7 0 oceanbase/odc ODC is an open-source, enterprise-grade data… 0 obpilot/oceanbase-ce 3 steps to run an OceanBase-CE docker in you… 4 oceanbase/kube-rbac-proxy 0 apecloud/oceanbase 0 oceanbase/cert-manager-webhook 0 oceanbase/cert-manager-cainjector 0 oceanbase/cert-manager-controller 0 oceanbase/ob-configserver 0 #拉取 OceanBase 数据库最新镜像 [root@oceanbase ~]# docker pull obpilot/oceanbase-ce 4.启动 OceanBase 数据库实例 #部署 mini 的独立实例 usermod -g admin -G docker admin [admin@oceanbase ~]$ docker run -itd -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d obpilot/oceanbase-ce #登录ob数据库: [root@oceanbase ~]# docker exec -it obstandalone bash #关闭集群 [admin@fa84be3ae7ed ~]$ obd cluster stop obdemo #开启集群 [admin@fa84be3ae7ed ~]$ obd cluster start obdemo [admin@fa84be3ae7ed ~]$ obd cluster display obdemo 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 | 4.0.0.0 | 2881 | zone1 | ACTIVE | +-----------+---------+------+-------+--------+ obclient -h127.0.0.1 -P2881 -uroot -prootPWD123 -Doceanbase Connect to obproxy ok +---------------------------------------------+ | obproxy | +-----------+------+-----------------+--------+ | ip | port | prometheus_port | status | +-----------+------+-----------------+--------+ | 127.0.0.1 | 2883 | 2884 | active | +-----------+------+-----------------+--------+ obclient -h127.0.0.1 -P2883 -uroot -prootPWD123 -Doceanbase 5.创建基础数据信息 [admin@fa84be3ae7ed ~]$ obclient -h127.0.0.1 -P2881 -uroot -prootPWD123 -Doceanbase 注:先创建unti在创建资源池,基于资源池创建用户 #创建用户 obclient [oceanbase]> alter resource unit sys_unit_config min_cpu=1; #创建用户 MySQL [(none)]> alter resource unit sys_unit_config min_cpu=5; Query OK, 0 rows affected (0.010 sec) MySQL [(none)]> CREATE resource unit S4C1G max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G'; Query OK, 0 rows affected (0.005 sec)