Initial commit
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
---
|
||||
|
||||
slug: /deploy-by-docker
|
||||
---
|
||||
|
||||
# Deploy seekdb in a container environment
|
||||
|
||||
This topic describes how to deploy seekdb through Docker containers.
|
||||
|
||||
## Overview
|
||||
|
||||
The `seekdb` Docker image is available from [dockerhub](https://hub.docker.com/r/oceanbase/seekdb), [quay.io](https://quay.io/repository/oceanbase/seekdb), and [ghcr.io](https://ghcr.io/oceanbase/seekdb), and is designed to help users quickly set up a seekdb environment for testing.
|
||||
|
||||
:::tip
|
||||
<ul><li>When running this image on macOS with Intel chips, there is a known issue if the Docker version is higher than 4.9.0. You can download the required version of <a href="https://desktop.docker.com/mac/main/amd64/81317/Docker.dmg?_gl=17jelfd_gcl_auOTk5Nzk0MDUwLjE3MTE4ODMyNzM._gaNDQyMjE1MDE5LjE3MTE4ODMyNzQ._ga_XJWPQMJYHQ*MTcxOTIxOTEwMy4xMS4xLjE3MTkyMjEwMTAuNjAuMC4w">Docker</a> here.</li>
|
||||
<li>This image is for testing only; do not use it in production environments.</li></ul>
|
||||
:::
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before deploying `seekdb`, ensure that the following requirements are met:
|
||||
|
||||
* Docker is installed and the Docker service is started. For details, see [Docker documentation](https://docs.docker.com/get-docker/).
|
||||
|
||||
* Your machine has at least 1 physical core and 2 GB of memory.
|
||||
|
||||
## Start a seekdb instance
|
||||
|
||||
To start a seekdb instance, use the following command:
|
||||
|
||||
```shell
|
||||
docker run -d -p 2881:2881 oceanbase/seekdb
|
||||
```
|
||||
|
||||
:::info
|
||||
<ul>
|
||||
<li>
|
||||
If pulling the Docker image fails, you can also pull the image from the quay.io or ghcr.io repository by replacing <code>oceanbase/seekdb</code> in the above command with <code>quay.io/oceanbase/seekdb</code> or <code>ghcr.io/oceanbase/seekdb</code>, for example, run <code>sudo docker run -d -p 2881:2881 quay.io/oceanbase/seekdb</code> to pull the image from quay.io.
|
||||
</li>
|
||||
<li>
|
||||
The above command pulls the latest version by default. You can select a version from <a href="https://hub.docker.com/r/oceanbase/seekdb">dockerhub</a>, <a href="https://quay.io/repository/oceanbase/seekdb">quay.io</a>, or <a href="https://ghcr.io/oceanbase/seekdb">ghcr.io</a> according to your actual needs.
|
||||
</li>
|
||||
</ul>
|
||||
:::
|
||||
|
||||
If you want to execute initialization SQL scripts after startup, you need to mount a directory containing initialization scripts and then specify the mounted directory in the container through the environment variable `INIT_SCRIPTS_PATH`. Example command:
|
||||
|
||||
```shell
|
||||
docker run -d -p 2881:2881 -v {init_sql_folder_path}:/root/boot/init.d -e INIT_SCRIPTS_PATH=/root/boot/init.d oceanbase/seekdb
|
||||
```
|
||||
In the command, `{init_sql_folder_path}` is the path to the initialization SQL scripts on the host machine.
|
||||
|
||||
:::tip
|
||||
Do not change the root user password in SQL scripts. If you want to change the root user password, use the environment variable <code>ROOT_PASSWORD</code>, for example: <code>docker run -d -p 2881:2881 -e ROOT_PASSWORD="******" oceanbase/seekdb</code>.
|
||||
:::
|
||||
|
||||
The supported environment variables are as follows:
|
||||
|
||||
| Variable name | Description | Default value |
|
||||
|-----------|--------------------|----------|
|
||||
| ROOT_PASSWORD | Password for the root user. | Empty by default |
|
||||
| CPU_COUNT | Value of cpu_count.| 4 |
|
||||
| MEMORY_LIMIT | Value of memory_limit.| 2G |
|
||||
| LOG_DISK_SIZE | Value of log_disk_size.| 2G |
|
||||
| DATAFILE_SIZE | Value of datafile_size.| 2G |
|
||||
| DATAFILE_NEXT | Value of datafile_next.| 2G |
|
||||
| DATAFILE_MAXSIZE | Value of datafile_maxsize.| 50G |
|
||||
| INIT_SCRIPTS_PATH | Path to initialization scripts in the container.| \ |
|
||||
|
||||
|
||||
If you want to modify more seekdb parameters, you can deploy seekdb using a configuration file.
|
||||
|
||||
You can mount the configuration file to `/etc/oceanbase/seekdb.cnf` in the container.
|
||||
|
||||
1. Create a configuration file on the host server. The default configuration file is as follows:
|
||||
|
||||
```shell
|
||||
datafile_size=2G
|
||||
datafile_next=2G
|
||||
datafile_maxsize=50G
|
||||
cpu_count=4
|
||||
memory_limit=8G
|
||||
log_disk_size=2G
|
||||
# config the parameter in the following format
|
||||
# key=value
|
||||
```
|
||||
|
||||
2. Start seekdb.
|
||||
|
||||
```shell
|
||||
docker run -d -p 2881:2881 -v {config_file}:/etc/oceanbase/seekdb.cnf oceanbase/seekdb
|
||||
```
|
||||
|
||||
In the command, `{config_file}` is the path to the configuration file on the host machine.
|
||||
|
||||
:::tip
|
||||
If you decide to use a configuration file, do not specify resource-related environment variables.
|
||||
:::
|
||||
|
||||
|
||||
## Data persistence
|
||||
|
||||
seekdb is deployed in the `/var/lib/oceanbase` directory. If you want to persist data to the host server, mount an empty directory on the host server to this path.
|
||||
|
||||
```shell
|
||||
mkdir -p seekdb
|
||||
docker run -d -p 2881:2881 -v $PWD/seekdb:/var/lib/oceanbase --name seekdb oceanbase/seekdb
|
||||
```
|
||||
|
||||
## Connect to a seekdb instance
|
||||
|
||||
You can use the OBClient or MySQL client on the host to connect to the seekdb instance.
|
||||
|
||||
```shell
|
||||
[admin@test001 ~]$ mysql -uroot -h127.0.0.1 -P2881 -p
|
||||
```
|
||||
|
||||
:::info
|
||||
If the password is not configured through environment variables when starting the seekdb instance, users created in the instance use empty passwords by default.
|
||||
:::
|
||||
|
||||
After a successful connection, the terminal displays the following content:
|
||||
|
||||
```shell
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MySQL connection id is 3221628904
|
||||
Server version: 5.7.25 OceanBase 4.3.5.3 seekdb (r1.0.0.0) (Built 102025110516-83ac0ad994286047a3e713e82e9541383f6df531 Nov 5 2025)
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MySQL [(none)]>
|
||||
```
|
||||
|
||||
## Access the obshell dashboard
|
||||
|
||||
The container also starts obshell, which provides a user-friendly web interface. If you want to access the obshell dashboard, you can also map the obshell dashboard port.
|
||||
|
||||
```shell
|
||||
# 2886 is the port for the obshell dashboard
|
||||
docker run -d -p 2881:2881 -p 2886:2886 oceanbase/seekdb
|
||||
```
|
||||
|
||||
You can access `http://${server_ip}:2886` through a browser. The login password is the same as the root user password. If `ROOT_PASSWORD` is not set, leave the password field empty.
|
||||
Reference in New Issue
Block a user