Combine docker modes

This commit is contained in:
LINxiansheng
2024-02-08 13:00:32 +00:00
committed by ob-robot
parent b4767c46d6
commit ae4e49c03d
18 changed files with 131 additions and 124 deletions

2
.gitignore vendored
View File

@ -287,6 +287,8 @@ tools/deploy/distributed.yaml
tools/deploy/obd_profile.sh tools/deploy/obd_profile.sh
tools/deploy/single-with-proxy.yaml tools/deploy/single-with-proxy.yaml
tools/deploy/single.yaml tools/deploy/single.yaml
tools/docker/standalone/boot
tools/docker/standalone/init_store_for_fast_start.py
############# unittest ############# ############# unittest #############
unittest/**/test_* unittest/**/test_*

View File

@ -2,6 +2,7 @@ FROM openanolis/anolisos
# docker build --build-arg VERSION={VERSION} . # docker build --build-arg VERSION={VERSION} .
ARG VERSION ARG VERSION
ARG STEP
RUN yum install -y yum-utils && \ RUN yum install -y yum-utils && \
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo && \ yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo && \
@ -10,6 +11,11 @@ RUN yum install -y yum-utils && \
rm -rf /usr/obd/mirror/remote/* && \ rm -rf /usr/obd/mirror/remote/* && \
yum clean all yum clean all
ENV STEP=$STEP
RUN if [ "$STEP" == 1 ]; then \
yum install -y mysql; \
fi
ENV OBVersion=$VERSION ENV OBVersion=$VERSION
RUN if [ -z "${OBVersion}" ]; then \ RUN if [ -z "${OBVersion}" ]; then \
echo "VERSION is empty, then build the docker with latest rpm"; \ echo "VERSION is empty, then build the docker with latest rpm"; \
@ -19,15 +25,16 @@ RUN if [ -z "${OBVersion}" ]; then \
else \ else \
echo "build the docker with VERSION ${OBVersion}"; \ echo "build the docker with VERSION ${OBVersion}"; \
fi && \ fi && \
mkdir -p /root/pkg && \ mkdir -p /root/pkg && mkdir -p /root/store && mkdir -p /root/dest && \
cd /root/pkg && \ cd /root/pkg && \
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${OBVersion}.el7 oceanbase-ce-libs-${OBVersion}.el7 obagent ob-configserver && \ yum install -y --downloadonly --downloaddir=. oceanbase-ce-${OBVersion}.el7 oceanbase-ce-libs-${OBVersion}.el7 obagent ob-configserver && \
rm -rf /usr/obd/mirror/remote/* && \ rm -rf /usr/obd/mirror/remote/* && \
yum clean all yum clean all
COPY boot /root/boot/ COPY boot /root/boot/
COPY init_store_for_fast_start.py /root/boot/
ENV PATH /root/boot:$PATH ENV PATH /root/boot:$PATH
ENV LD_LIBRARY_PATH /root/ob/lib:$LD_LIBRARY_PATH ENV LD_LIBRARY_PATH /home/admin/oceanbase/lib:/root/ob/lib:$LD_LIBRARY_PATH
WORKDIR /root WORKDIR /root
CMD _boot CMD _boot

View File

@ -39,6 +39,9 @@ docker run -p 2881:2881 --name oceanbase-ce -e MODE=slim -e OB_MEMORY_LIMIT=5G -
# 根据当前容器情况部署最大规格的实例 # 根据当前容器情况部署最大规格的实例
docker run -p 2881:2881 --name oceanbase-ce -e MODE=normal -d oceanbase/oceanbase-ce docker run -p 2881:2881 --name oceanbase-ce -e MODE=normal -d oceanbase/oceanbase-ce
# 部署一个快速启动镜像,mode可以为任意模式
docker run -p 2881:2881 --name oceanbase-ce -e FASTBOOT=true -d oceanbase/oceanbase-ce
``` ```
启动预计需要 2-5 分钟。执行以下命令,如果返回 `boot success!`,则启动成功。 启动预计需要 2-5 分钟。执行以下命令,如果返回 `boot success!`,则启动成功。
@ -75,6 +78,7 @@ mysql -uroot -h127.1 -P2881
| 变量名称 | 默认值 | 描述 | | 变量名称 | 默认值 | 描述 |
| ---------------- | ------------- | ------------------------------------------------------------ | | ---------------- | ------------- | ------------------------------------------------------------ |
| MODE | {mini, slim, normal} | mini或者不赋值变量表示使用mini模式部署OceanBase数据库实例,仅用来研究学习使用。不适合用于生产或性能测试。slim适用于更小的自定义配置,移除obagent,支持自定义的初始化脚本在绑定目录/root/boot/init.d,如果不绑定该目录,docker不会执行该租户的初始化sql。| | MODE | {mini, slim, normal} | mini或者不赋值变量表示使用mini模式部署OceanBase数据库实例,仅用来研究学习使用。不适合用于生产或性能测试。slim适用于更小的自定义配置,移除obagent,支持自定义的初始化脚本在绑定目录/root/boot/init.d,如果不绑定该目录,docker不会执行该租户的初始化sql。|
| FASTBOOT | false | true表示镜像会以快速启动的方式运行。 |
| EXIT_WHILE_ERROR | true | OceanBase 如果启动失败,是否退出容器。比如初次run镜像失败,或start容器失败,可以将此参数设置为false,那么OB启动失败,也可以进入容器,查看OceanBase的运行日志,然后进行排查。 | | EXIT_WHILE_ERROR | true | OceanBase 如果启动失败,是否退出容器。比如初次run镜像失败,或start容器失败,可以将此参数设置为false,那么OB启动失败,也可以进入容器,查看OceanBase的运行日志,然后进行排查。 |
| OB_CLUSTER_NAME | obcluster | oceanbase集群名 | | OB_CLUSTER_NAME | obcluster | oceanbase集群名 |
| OB_TENANT_NAME | test | oceanbase mysql租户名| | OB_TENANT_NAME | test | oceanbase mysql租户名|
@ -113,14 +117,14 @@ docker run -d -p 2881:2881 -v $PWD/ob:/root/ob -v $PWD/obd:/root/.obd --name oce
docker -v 参数的详细说明可以参考 [docker volumn](https://docs.docker.com/storage/volumes/)。 docker -v 参数的详细说明可以参考 [docker volumn](https://docs.docker.com/storage/volumes/)。
## 快速单机启动镜像构建 ## 快速单机启动镜像构建
`tools/docker/standalone`目录下提供`fast_boot_docker_build.sh`脚本,通过该脚本可以构建快速启动镜像。在运行脚本之前,请首先修改`tools/docker/standalone/boot/_env`环境配置脚本: `tools/docker/standalone`目录下提供`docker_build.sh`脚本,通过该脚本可以构建快速启动镜像。在运行脚本之前,请首先修改`tools/docker/standalone/boot/_env`环境配置脚本:
- 必须:将`MODE`配置项修改为`STANDALONE`
- 可选:修改其余配置项 - 可选:修改其余配置项
修改完毕后,执行镜像构建脚本: 修改完毕后,执行镜像构建脚本:
- `./fast_boot_docker_build.sh <oceanbase_rpm_version>` 例如:`./fast_boot_docker_build.sh 4.2.1.0-100000102023092807` - 构建最新版镜像 `./docker_build.sh`
- 构建某个特别版本的oceanbase镜像 `./docker_build.sh <oceanbase_rpm_version>` 例如:`./docker_build.sh 4.2.1.0-100000102023092807`
等待构建完毕后,可使用前述相同的方式启动、测试实例。 等待构建完毕后,可使用前述相同的方式启动、测试实例。

View File

@ -39,6 +39,9 @@ docker run -p 2881:2881 --name oceanbase-ce -e MODE=slim -e OB_MEMORY_LIMIT=5G -
# deploy an instance of the largest size according to the current container # deploy an instance of the largest size according to the current container
docker run -p 2881:2881 --name oceanbase-ce -e MODE=normal -d oceanbase/oceanbase-ce docker run -p 2881:2881 --name oceanbase-ce -e MODE=normal -d oceanbase/oceanbase-ce
# deploy a quick-start instance in any mode as desired to the current container
docker run -p 2881:2881 --name oceanbase-ce -e FASTBOOT=true -d oceanbase/oceanbase-ce
``` ```
Two to five minutes are necessary for the boot procedure. To make sure that the boot procedure is successful, run this command: Two to five minutes are necessary for the boot procedure. To make sure that the boot procedure is successful, run this command:
@ -73,6 +76,7 @@ This table shows the supported environment variables of the current oceanbase-ce
| Variable name | Default value | Description | | Variable name | Default value | Description |
| ---------------- | ------------- | ------------------------------------------------------------ | | ---------------- | ------------- | ------------------------------------------------------------ |
| MODE | {mini, slim, normal} | If it is mini, then the docker use mini mode to deploy OceanBase Database instance, it should be used only for research/study/evaluation. DO NOT use it for production or performance testing. If it is slim, then the docker can run in a smaller instance. It remove the obagent and can run a self tenant initial sql by yourself in the mount volume /root/boot/init.d. If you do not mount the volume path the docker does not init the tenant sql. | | MODE | {mini, slim, normal} | If it is mini, then the docker use mini mode to deploy OceanBase Database instance, it should be used only for research/study/evaluation. DO NOT use it for production or performance testing. If it is slim, then the docker can run in a smaller instance. It remove the obagent and can run a self tenant initial sql by yourself in the mount volume /root/boot/init.d. If you do not mount the volume path the docker does not init the tenant sql. |
| FASTBOOT | false | The container can run in a quick-start mode when FASTBOOT=true. |
| EXIT_WHILE_ERROR | true | Whether quit the container while start observer failed. If start observer failed, you can not explore the logs as the container will exit. But if you set the EXIT_WHILE_ERROR=false, the container will not exit while observer starting fail and you can use docker exec to debug. | | EXIT_WHILE_ERROR | true | Whether quit the container while start observer failed. If start observer failed, you can not explore the logs as the container will exit. But if you set the EXIT_WHILE_ERROR=false, the container will not exit while observer starting fail and you can use docker exec to debug. |
| OB_CLUSTER_NAME | obcluster | The oceanbase cluster name | | OB_CLUSTER_NAME | obcluster | The oceanbase cluster name |
| OB_TENANT_NAME | test | The oceanbase mysql tenant name | | OB_TENANT_NAME | test | The oceanbase mysql tenant name |
@ -109,14 +113,14 @@ The docker image `oceanbase-ce` saves the data to /root/ob directory default. Yo
You can view more information about `docker -v` at [docker volume](https://docs.docker.com/storage/volumes/). You can view more information about `docker -v` at [docker volume](https://docs.docker.com/storage/volumes/).
## Fast boot image building for a standalone node ## Fast boot image building for a standalone node
The `fast_boot_docker_build.sh` script is provided in the `tools/docker/standalone` directory, through which the fast boot image can be built. Before running the script, please first modify the `tools/docker/standalone/boot/_env` environment configuration script: The `docker_build.sh` script is provided in the `tools/docker/standalone` directory, through which the fast boot image can be built. Before running the script, please first modify the `tools/docker/standalone/boot/_env` environment configuration script:
- Required: Modify the `MODE` configuration item to `STANDALONE`
- Optional: Modify the remaining configuration items - Optional: Modify the remaining configuration items
After the modification is completed, execute the image build script: After the modification is completed, execute the image build script:
- `./fast_boot_docker_build.sh <oceanbase_rpm_version>`. For example `./fast_boot_docker_build.sh 4.2.1.0-100000102023092807` - build the image with latest oceanbase version `./docker_build.sh`
- build the image with specific oceanbase version `./docker_build.sh <oceanbase_rpm_version>`. For example `./docker_build.sh 4.2.1.0-100000102023092807`
After waiting for the build to be completed, you can start and test the instance in the same way as mentioned above. After waiting for the build to be completed, you can start and test the instance in the same way as mentioned above.

View File

@ -0,0 +1,73 @@
#!/bin/bash
if [ "$#" -gt 1 ]; then
exit 1
elif [ "$#" -gt 1 ]; then
BUILD_ARG="--build-arg VERSION=$1"
else
BUILD_ARG=""
fi
TMP_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.tmp.py"
ACTUAL_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.py"
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
function fast_boot_docker_build() {
rm -rf boot
cp -r step_1_boot boot
docker build $BUILD_ARG --build-arg STEP=1 -t raw_observer .
if [ $? == 0 ]; then
echo "================== build prepare docker ok ==============="
else
echo "================== build prepare docker failed ==============="
exit -1
fi
rm -rf boot
cd "${CWD}" && mkdir -p ${CWD}/boot/etc
docker run -it -v ${CWD}/boot:/root/dest raw_observer
if [ $? == 0 ]; then
echo "================== prepare docker run ok ==============="
else
echo "================== prepare docker run failed ==============="
rm -rf ${CWD}/boot/etc
rm -rf ${CWD}/boot/store.tar.gz
exit -1
fi
cd "${CWD}"
cp -r step_2_boot/* boot
docker build $BUILD_ARG --build-arg STEP=2 -t oceanbase-ce .
if [ $? == 0 ]; then
echo "================== docker build ok ==============="
else
echo "================== docker build failed ==============="
exit -1
fi
}
source ./step_2_boot/_env
OS=`uname`
cp ${TMP_INIT_STORE_PY_SCRIPT} ${ACTUAL_INIT_STORE_PY_SCRIPT}
if [ "$OS" == 'Darwin' ]; then
sed -i '' -e "s/@OB_SERVER_IP@/${OB_SERVER_IP}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i '' -e "s/@OB_MYSQL_PORT@/${OB_MYSQL_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i '' -e "s/@OB_RPC_PORT@/${OB_RPC_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i '' -e "s/@OB_TENANT_NAME@/${OB_TENANT_NAME}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i '' -e "s/@OB_TENANT_LOWER_CASE_TABLE_NAMES@/${OB_TENANT_LOWER_CASE_TABLE_NAMES}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
else
sed -i'' -e "s/@OB_SERVER_IP@/${OB_SERVER_IP}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i'' -e "s/@OB_MYSQL_PORT@/${OB_MYSQL_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i'' -e "s/@OB_RPC_PORT@/${OB_RPC_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i'' -e "s/@OB_TENANT_NAME@/${OB_TENANT_NAME}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sed -i'' -e "s/@OB_TENANT_LOWER_CASE_TABLE_NAMES@/${OB_TENANT_LOWER_CASE_TABLE_NAMES}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
fi
fast_boot_docker_build
if [ $? != 0 ]; then
echo "use local rpm build docker failed"
exit -1
fi

View File

@ -1,64 +0,0 @@
#!/bin/bash
RPM_VERSION=$1
TMP_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.tmp.py"
ACTUAL_INIT_STORE_PY_SCRIPT="./fast_boot_docker_build_prepare/init_store_for_fast_start.py"
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
function fast_boot_docker_build() {
cd fast_boot_docker_build_prepare && \
docker build --build-arg VERSION="${RPM_VERSION}" -t raw_observer .
if [ $? == 0 ]; then
echo "================== build prepare docker ok ==============="
else
echo "================== build prepare docker failed ==============="
exit -1
fi
cd "${CWD}" && mkdir -p ${CWD}/boot/etc
docker run -it -v ${CWD}/boot:/root/dest raw_observer
if [ $? == 0 ]; then
echo "================== prepare docker run ok ==============="
else
echo "================== prepare docker run failed ==============="
rm -rf ${CWD}/boot/etc
rm -rf ${CWD}/boot/store.tar.gz
exit -1
fi
cd "${CWD}"
docker build --build-arg VERSION="${RPM_VERSION}" -t oceanbase-ce .
if [ $? == 0 ]; then
echo "================== fast boot docker build ok ==============="
else
echo "================== fast boot docker build failed ==============="
exit -1
fi
}
source ./boot/_env
if [ "x${MODE}" != "xSTANDALONE" ]; then
echo "please set MODE to STANDALONE for building fast boot docker"
exit -1
fi
OS=`uname`
cp ${TMP_INIT_STORE_PY_SCRIPT} ${ACTUAL_INIT_STORE_PY_SCRIPT}
if [ "$OS" == 'Darwin' ]; then
alias sedi="sed -i '' -e"
else
alias sedi="sed -i'' -e"
fi
sedi "s/@OB_MYSQL_PORT@/${OB_MYSQL_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sedi "s/@OB_RPC_PORT@/${OB_RPC_PORT}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sedi "s/@OB_TENANT_NAME@/${OB_TENANT_NAME}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
sedi "s/@OB_TENANT_LOWER_CASE_TABLE_NAMES@/${OB_TENANT_LOWER_CASE_TABLE_NAMES}/g" ${ACTUAL_INIT_STORE_PY_SCRIPT}
fast_boot_docker_build
if [ $? != 0 ]; then
echo "use local rpm build docker failed"
exit -1
fi

View File

@ -1,35 +0,0 @@
FROM openanolis/anolisos
# docker build --build-arg VERSION={VERSION} .
ARG VERSION
RUN yum install -y yum-utils && \
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo && \
sed -i 's/$releasever/7/' /etc/yum.repos.d/OceanBase.repo && \
yum install -y libaio mysql && \
yum clean all
ENV OBVersion=$VERSION
RUN if [ -z "${OBVersion}" ]; then \
echo "VERSION is empty, then build the docker with latest rpm"; \
VersionPre=`yum info oceanbase-ce | grep Version | awk '{print $3}'`; \
Release=`yum info oceanbase-ce | grep Release | awk '{print $3}' | awk -F. '{print $1}'`; \
OBVersion="${VersionPre}-${Release}"; \
else \
echo "build the docker with VERSION ${OBVersion}"; \
fi && \
mkdir -p /root/pkg && mkdir -p /root/store && mkdir -p /root/dest && \
cd /root/pkg && \
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${OBVersion}.el7 oceanbase-ce-libs-${OBVersion}.el7 && \
rm -rf /usr/obd/mirror/remote/* && \
yum clean all
COPY boot /root/boot/
COPY init_store_for_fast_start.py /root/boot/
ENV PATH /root/boot:$PATH
ENV LD_LIBRARY_PATH /home/admin/oceanbase/lib:/root/ob/lib:$LD_LIBRARY_PATH
WORKDIR /root
CMD _boot
EXPOSE 2881

View File

@ -25,6 +25,7 @@ def check_file_or_path_exist(bin_abs_path, home_abs_path, store_tar_file_path, e
logging.warn("invalid store tar file path") logging.warn("invalid store tar file path")
return False return False
if not os.path.isdir(etc_dest_dir): if not os.path.isdir(etc_dest_dir):
logging.warn(etc_dest_dir)
logging.warn("invalid etc dest dir") logging.warn("invalid etc dest dir")
return False return False
return True return True
@ -46,16 +47,15 @@ if __name__ == "__main__":
parser.add_argument("-z", dest="zone", type=str, default="zone1") parser.add_argument("-z", dest="zone", type=str, default="zone1")
parser.add_argument("-c", dest="cluster_id", type=str, default="1") parser.add_argument("-c", dest="cluster_id", type=str, default="1")
parser.add_argument("-d", dest="data_path", type=str, default="/data/store") parser.add_argument("-d", dest="data_path", type=str, default="/data/store")
parser.add_argument("-i", dest="devname", type=str, default="lo") parser.add_argument("-r", dest="rootservice", type=str, default="@OB_SERVER_IP@:@OB_RPC_PORT@")
parser.add_argument("-r", dest="rootservice", type=str, default="127.0.0.1:@OB_RPC_PORT@") parser.add_argument("-I", dest="ip", type=str, default="@OB_SERVER_IP@")
parser.add_argument("-I", dest="ip", type=str, default="127.0.0.1")
parser.add_argument("-l", dest="log_level", type=str, default="INFO") parser.add_argument("-l", dest="log_level", type=str, default="INFO")
parser.add_argument("-o", dest="opt_str", type=str, default="__min_full_resource_pool_memory=2147483648,memory_limit=6G,system_memory=1G,datafile_size=256M,log_disk_size=5G,cpu_count=16") parser.add_argument("-o", dest="opt_str", type=str, default="__min_full_resource_pool_memory=2147483648,memory_limit=6G,system_memory=1G,datafile_size=256M,log_disk_size=5G,cpu_count=16")
parser.add_argument("-N", dest="daemon", type=str, default="1") parser.add_argument("-N", dest="daemon", type=str, default="1")
parser.add_argument("--tenant_name", type=str, default="@OB_TENANT_NAME@") parser.add_argument("--tenant_name", type=str, default="@OB_TENANT_NAME@")
parser.add_argument("--tenant_lower_case_table_names", type=int, default="@OB_TENANT_LOWER_CASE_TABLE_NAMES@") parser.add_argument("--tenant_lower_case_table_names", type=int, default="@OB_TENANT_LOWER_CASE_TABLE_NAMES@")
parser.add_argument("--max_cpu", type=float, default=14.0) parser.add_argument("--max_cpu", type=float, default=7.0)
parser.add_argument("--min_cpu", type=float, default=14.0) parser.add_argument("--min_cpu", type=float, default=7.0)
parser.add_argument("--memory_size", type=int, default=3221225472) parser.add_argument("--memory_size", type=int, default=3221225472)
parser.add_argument("--log_disk_size", type=int, default=3221225472) parser.add_argument("--log_disk_size", type=int, default=3221225472)
args = parser.parse_args() args = parser.parse_args()
@ -83,8 +83,8 @@ if __name__ == "__main__":
# prepare observer start parameters # prepare observer start parameters
daemon_option = "-N" if args.daemon=="1" else "" daemon_option = "-N" if args.daemon=="1" else ""
observer_args = "-p %s -P %s -z %s -c %s -d %s -i %s -r %s -I %s -l %s -o %s %s" % (args.mysql_port, args.rpc_port, args.zone, \ observer_args = "-p %s -P %s -z %s -c %s -d %s -r %s -I %s -l %s -o %s %s" % (args.mysql_port, args.rpc_port, args.zone, \
args.cluster_id, data_abs_path, args.devname, \ args.cluster_id, data_abs_path, \
args.rootservice, args.ip, args.log_level, args.opt_str, \ args.rootservice, args.ip, args.log_level, args.opt_str, \
daemon_option) daemon_option)
os.chdir(home_abs_path) os.chdir(home_abs_path)

View File

@ -56,7 +56,6 @@ function get_mode() {
MODE=${MODE^^} MODE=${MODE^^}
} }
function exit_while_error() { function exit_while_error() {
if test -z ${EXIT_WHILE_ERROR} if test -z ${EXIT_WHILE_ERROR}
then then
@ -66,6 +65,15 @@ function exit_while_error() {
return `is_true ${EXIT_WHILE_ERROR}` return `is_true ${EXIT_WHILE_ERROR}`
} }
function fastboot() {
if test -z ${FASTBOOT}
then
return 0
fi
return `is_true ${FASTBOOT}`
}
function remove_disk_check_logic_in_obd() { function remove_disk_check_logic_in_obd() {
# make sure obd copy the plugin code # make sure obd copy the plugin code
obd cluster list obd cluster list
@ -126,9 +134,9 @@ else # nothing here, bootstrap
TMPFILE="boot.${STAMP}.yaml" TMPFILE="boot.${STAMP}.yaml"
get_mode get_mode
if [ "x${MODE}" == "xSTANDALONE" ]; then if [ "x${MODE}" == "xNORMAL" ]; then
echo "oceanbase-ce docker in standalone mode" echo "oceanbase-ce docker in normal mode"
cp -f boot-mini-tmp.yaml $TMPFILE cp -f boot-tmp.yaml $TMPFILE
elif [ "x${MODE}" == "xMINI" ]; then elif [ "x${MODE}" == "xMINI" ]; then
echo "oceanbase-ce docker in mini mode" echo "oceanbase-ce docker in mini mode"
cp -f boot-mini-tmp.yaml $TMPFILE cp -f boot-mini-tmp.yaml $TMPFILE
@ -136,14 +144,14 @@ else # nothing here, bootstrap
echo "oceanbase-ce docker in slim mode" echo "oceanbase-ce docker in slim mode"
cp -f boot-mini-tmp.yaml $TMPFILE cp -f boot-mini-tmp.yaml $TMPFILE
else else
cp -f boot-tmp.yaml $TMPFILE cp -f boot-mini-tmp.yaml $TMPFILE
fi fi
if [ "x${MODE}" != "xSLIM" ]; then if [ "x${MODE}" != "xSLIM" ]; then
cat obagent.yaml >> $TMPFILE cat obagent.yaml >> $TMPFILE
fi fi
if [ "x${MODE}" != "xMINI" ] && [ "x${MODE}" != "xSTANDALONE" ]; then if [ "x${MODE}" == "xSLIM" ]; then
cat ob-configserver.yaml >> $TMPFILE cat ob-configserver.yaml >> $TMPFILE
fi fi
@ -171,7 +179,7 @@ else # nothing here, bootstrap
print_start_phase "Ob-deploy deploy" print_start_phase "Ob-deploy deploy"
remove_disk_check_logic_in_obd remove_disk_check_logic_in_obd
if [ "x${MODE}" == "xSTANDALONE" ]; then if fastboot; then
obd devmode enable && obd cluster deploy "${OB_CLUSTER_NAME}" -c $TMPFILE; obd devmode enable && obd cluster deploy "${OB_CLUSTER_NAME}" -c $TMPFILE;
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
deploy_failed deploy_failed
@ -195,6 +203,11 @@ else # nothing here, bootstrap
print_start_phase "Ob-deploy start" print_start_phase "Ob-deploy start"
obd cluster start ${OB_CLUSTER_NAME} obd cluster start ${OB_CLUSTER_NAME}
print_end_phase print_end_phase
if [ "x${MODE}" == "xSLIM" ]; then
run_custom_scripts /root/boot/init.d
fi
else else
print_start_phase "Ob-deploy autodeploy" print_start_phase "Ob-deploy autodeploy"
obd devmode enable && obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE; obd devmode enable && obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE;
@ -223,6 +236,7 @@ else # nothing here, bootstrap
fi fi
print_end_phase print_end_phase
fi fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
deploy_failed deploy_failed
fi fi

View File

@ -1,7 +1,8 @@
MODE=${MODE:-MINI} MODE=${MODE:-MINI}
FASTBOOT=${FASTBOOT:-false}
EXIT_WHILE_ERROR=${EXIT_WHILE_ERROR:-true} EXIT_WHILE_ERROR=${EXIT_WHILE_ERROR:-true}
OB_HOME_PATH="/root/ob" OB_HOME_PATH="/root/ob"
OB_SERVER_IP=$(hostname -i) OB_SERVER_IP="127.0.0.1"
OB_MYSQL_PORT="2881" OB_MYSQL_PORT="2881"
OB_RPC_PORT="2882" OB_RPC_PORT="2882"
OB_CLUSTER_NAME=${OB_CLUSTER_NAME:-obcluster} OB_CLUSTER_NAME=${OB_CLUSTER_NAME:-obcluster}

View File

@ -17,7 +17,7 @@ oceanbase-ce:
datafile_size: @OB_DATAFILE_SIZE@ # Size of the data file. datafile_size: @OB_DATAFILE_SIZE@ # Size of the data file.
log_disk_size: @OB_LOG_DISK_SIZE@ # The size of disk space used by the clog files. log_disk_size: @OB_LOG_DISK_SIZE@ # The size of disk space used by the clog files.
cpu_count: 16 cpu_count: 16
production_mode: true production_mode: false
syslog_level: INFO # System log level. The default value is INFO. 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_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. enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.

View File

@ -9,6 +9,7 @@ oceanbase-ce:
rpc_port: @OB_RPC_PORT@ rpc_port: @OB_RPC_PORT@
datafile_size: 20G datafile_size: 20G
log_disk_size: 20G log_disk_size: 20G
production_mode: false
appname: @OB_CLUSTER_NAME@ appname: @OB_CLUSTER_NAME@
root_password: @OB_ROOT_PASSWORD@ root_password: @OB_ROOT_PASSWORD@
enable_rich_error_msg: true enable_rich_error_msg: true