请问docker启动Oceanbase,如何持久化存储数据?
镜像版本oceanbase/oceanbase-ce:3.1.4
尝试挂载容器内/root/ob目录,第二次启动后会报错,报错提示如下:
OBD-1002: Fail to init 127.0.0.1 home path: /root/ob is not empty.
请问docker启动Oceanbase,如何持久化存储数据?
镜像版本oceanbase/oceanbase-ce:3.1.4
尝试挂载容器内/root/ob目录,第二次启动后会报错,报错提示如下:
OBD-1002: Fail to init 127.0.0.1 home path: /root/ob is not empty.
目前ob3.1.4也不建议使用了 建议部署更高的版本 检查一下docker的版本 发一下docker的启动命令
操作系统 Debian GNU/Linux 12 (bookworm)
docker version 28.0.4
docker compose v2.34.0
docker-compose.yml:
services:
oceanbase:
image: oceanbase/oceanbase-ce:3.1.4
env_file:
- ./conf/.env
volumes:
- ./oceanbase/ob:/root/ob
ports:
- “2881:2881”
ulimits:
nofile:
soft: 65536
hard: 65536
restart: unless-stopped
启动命令 docker compose up -d
尝试使用最新镜像,启动命令:docker run -d
–name oceanbase
-p 2881:2881
–ulimit nofile=65536:65536
-e OB_ROOT_PASSWORD=xxxx1234
-e MINI_MODE=1
-e OB_MEMORY_LIMIT=8G
-e OB_SYSTEM_MEMORY=4G
-v ./ob_dir:/data/ob
–restart unless-stopped
oceanbase/oceanbase-ce 出现错误码:[ERROR] OBD-2002,我看此条错误码信息是因为内存不够提示的。但是我已提高内存信息
最新的镜像环境变量请参考这个文档地址,https://github.com/oceanbase/docker-images/tree/main/oceanbase-ce
看起来 OB_SYSTEM_MEMORY 这个设置的比较大,这部分是预留的内存,不需要设置太大的。
另外 -v ./ob_dir:/data/ob 这个在容器中的路径应该使用 /root/ob
启动3.1.4版本命令如下:
docker run -p 2881:2881 --ulimit nofile=65536:65536 -e OB_ROOT_PASSWORD=‘xxx@xxx810!’ -name
obstandalone -e MINI_MODE=0 -d -v ./obase/ob_new:/root/ob -v ./obase/obd/cluster_new:/root/.obd/cluster oceanbase/oceanbase-ce:3.1.4
source xxx.sql 完成
docker rm -f obstandalone
再次使用相同命令启动 则报错:
find obd deploy information, skip configuring…
start ob cluster …
Get local repositories and plugins x
[ERROR] Local repository oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 is empty.
boot failed!
建议部署最新版ob,且这边不建议docker部署ob进行长期服务