Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -2,39 +2,23 @@ FROM openanolis/anolisos
|
||||
|
||||
# docker build --build-arg VERSION={VERSION} .
|
||||
ARG VERSION
|
||||
ARG STEP
|
||||
|
||||
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 ob-deploy obclient ob-sysbench libaio bc libselinux-utils zip && \
|
||||
yum install -y ob-deploy obclient ob-sysbench libaio && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
yum clean all
|
||||
|
||||
ENV STEP=$STEP
|
||||
RUN if [ "$STEP" == 1 ]; then \
|
||||
yum install -y mysql; \
|
||||
fi
|
||||
|
||||
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 && \
|
||||
RUN mkdir -p /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-${VERSION}.el7 oceanbase-ce-libs-${VERSION}.el7 obagent && \
|
||||
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
|
||||
ENV LD_LIBRARY_PATH /root/ob/lib:$LD_LIBRARY_PATH
|
||||
|
||||
WORKDIR /root
|
||||
CMD _boot
|
||||
|
||||
@ -39,9 +39,6 @@ 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
|
||||
|
||||
# 部署一个快速启动镜像,mode可以为任意模式
|
||||
docker run -p 2881:2881 --name oceanbase-ce -e FASTBOOT=true -d oceanbase/oceanbase-ce
|
||||
```
|
||||
|
||||
启动预计需要 2-5 分钟。执行以下命令,如果返回 `boot success!`,则启动成功。
|
||||
@ -78,8 +75,7 @@ mysql -uroot -h127.1 -P2881
|
||||
| 变量名称 | 默认值 | 描述 |
|
||||
| ---------------- | ------------- | ------------------------------------------------------------ |
|
||||
| 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_TENANT_NAME | test | oceanbase mysql租户名|
|
||||
| OB_MEMORY_LIMIT | 6G | oceanbase启动memory_limit参数配置 |
|
||||
@ -90,7 +86,6 @@ mysql -uroot -h127.1 -P2881
|
||||
| OB_TENANT_MINI_CPU | | oceanbase租户mini_cpu参数配置 |
|
||||
| OB_TENANT_MEMORY_SIZE | | oceanbase租户memory_size参数配置 |
|
||||
| OB_TENANT_LOG_DISK_SIZE | | oceanbase租户log_disk_size参数配置 |
|
||||
| OB_TENANT_LOWER_CASE_TABLE_NAMES | 1 | oceanbase 租户 表名是否区分大小写 |
|
||||
|
||||
## 运行 Sysbench 脚本
|
||||
|
||||
@ -117,22 +112,13 @@ 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/)。
|
||||
|
||||
## 快速单机启动镜像构建
|
||||
在`tools/docker/standalone`目录下提供`docker_build.sh`脚本,通过该脚本可以构建快速启动镜像。在运行脚本之前,请首先修改`tools/docker/standalone/boot/_env`环境配置脚本:
|
||||
在`tools/docker/standalone`目录下提供`fast_boot_docker_build.sh`脚本,通过该脚本可以构建快速启动镜像。在运行脚本之前,请首先修改`tools/docker/standalone/boot/_env`环境配置脚本:
|
||||
|
||||
- 必须:将`MODE`配置项修改为`STANDALONE`
|
||||
- 可选:修改其余配置项
|
||||
|
||||
修改完毕后,执行镜像构建脚本:
|
||||
|
||||
- 构建最新版镜像 `./docker_build.sh`
|
||||
- 构建某个特别版本的oceanbase镜像 `./docker_build.sh <oceanbase_rpm_version>` 例如:`./docker_build.sh 4.2.1.0-100000102023092807`
|
||||
- `./fast_boot_docker_build.sh <oceanbase_rpm_version>` 例如:`./fast_boot_docker_build.sh 4.2.1.0-100000102023092807`
|
||||
|
||||
等待构建完毕后,可使用前述相同的方式启动、测试实例。
|
||||
|
||||
## 故障诊断
|
||||
提供了一系列诊断方法用来诊断docker中的出错情况
|
||||
### 支持‘enable_rich_error_msg’参数
|
||||
- 首先在docker启动的过程中会默认开启‘enable_rich_error_msg’参数,如果在启动过程中发生错误,可以trace指令拿到更多的报错信息,启动成功后,docker会将该参数设置为关闭转态。
|
||||
- 用户可以通过打开该参数拿到更多运行阶段的sql语句的报错信息,打开方法为使用系统租户连接上docker中的oceanbase,然后执行
|
||||
```bash
|
||||
alter system set enable_rich_error_msg = true;
|
||||
```
|
||||
等待构建完毕后,可使用前述相同的方式启动、测试实例。
|
||||
@ -39,9 +39,6 @@ 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
|
||||
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:
|
||||
@ -76,7 +73,6 @@ This table shows the supported environment variables of the current oceanbase-ce
|
||||
| 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. |
|
||||
| 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. |
|
||||
| OB_CLUSTER_NAME | obcluster | The oceanbase cluster name |
|
||||
| OB_TENANT_NAME | test | The oceanbase mysql tenant name |
|
||||
@ -113,22 +109,13 @@ 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/).
|
||||
|
||||
## Fast boot image building for a standalone node
|
||||
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:
|
||||
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:
|
||||
|
||||
- Required: Modify the `MODE` configuration item to `STANDALONE`
|
||||
- Optional: Modify the remaining configuration items
|
||||
|
||||
After the modification is completed, execute the image build script:
|
||||
|
||||
- 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`
|
||||
- `./fast_boot_docker_build.sh <oceanbase_rpm_version>`. For example `./fast_boot_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.
|
||||
|
||||
## Fault Diagnosis
|
||||
A series of diagnostic methods are provided to diagnose errors in Docker.
|
||||
### Support for 'enable_rich_error_msg' parameter
|
||||
- Initially, the 'enable_rich_error_msg' parameter is enabled by default during the Docker startup process. If an error occurs during the startup process, more error information can be obtained using the trace command. After a successful startup, Docker sets this parameter to the false state.
|
||||
- Users can open this parameter to obtain more error information about SQL statements during the runtime phase. The method to open it is to connect to Docker's oceanbase using the system tenant, and then execute the following command:
|
||||
```bash
|
||||
alter system set enable_rich_error_msg = true;
|
||||
```
|
||||
After waiting for the build to be completed, you can start and test the instance in the same way as mentioned above.
|
||||
@ -2,7 +2,6 @@
|
||||
CWD=$(cd `dirname $0`;pwd)
|
||||
cd "${CWD}"
|
||||
source _env
|
||||
export HOST_IP_MODE=1
|
||||
|
||||
STAMP="$(date +%s)"
|
||||
STEP=1
|
||||
@ -56,6 +55,7 @@ function get_mode() {
|
||||
MODE=${MODE^^}
|
||||
}
|
||||
|
||||
|
||||
function exit_while_error() {
|
||||
if test -z ${EXIT_WHILE_ERROR}
|
||||
then
|
||||
@ -65,15 +65,6 @@ function 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() {
|
||||
# make sure obd copy the plugin code
|
||||
obd cluster list
|
||||
@ -134,9 +125,9 @@ else # nothing here, bootstrap
|
||||
TMPFILE="boot.${STAMP}.yaml"
|
||||
|
||||
get_mode
|
||||
if [ "x${MODE}" == "xNORMAL" ]; then
|
||||
echo "oceanbase-ce docker in normal mode"
|
||||
cp -f boot-tmp.yaml $TMPFILE
|
||||
if [ "x${MODE}" == "xSTANDALONE" ]; then
|
||||
echo "oceanbase-ce docker in standalone mode"
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
elif [ "x${MODE}" == "xMINI" ]; then
|
||||
echo "oceanbase-ce docker in mini mode"
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
@ -144,18 +135,13 @@ else # nothing here, bootstrap
|
||||
echo "oceanbase-ce docker in slim mode"
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
else
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
cp -f boot-tmp.yaml $TMPFILE
|
||||
fi
|
||||
|
||||
if [ "x${MODE}" != "xSLIM" ]; then
|
||||
cat obagent.yaml >> $TMPFILE
|
||||
fi
|
||||
|
||||
if [ "x${MODE}" == "xSLIM" ]; then
|
||||
cat ob-configserver.yaml >> $TMPFILE
|
||||
fi
|
||||
|
||||
sed -i "s|@OB_SERVER_IP@|${OB_SERVER_IP}|g" $TMPFILE
|
||||
sed -i "s|@OB_HOME_PATH@|${OB_HOME_PATH}|g" $TMPFILE
|
||||
sed -i "s|@OB_MYSQL_PORT@|${OB_MYSQL_PORT}|g" $TMPFILE
|
||||
sed -i "s|@OB_RPC_PORT@|${OB_RPC_PORT}|g" $TMPFILE
|
||||
@ -179,7 +165,7 @@ else # nothing here, bootstrap
|
||||
print_start_phase "Ob-deploy deploy"
|
||||
remove_disk_check_logic_in_obd
|
||||
|
||||
if fastboot; then
|
||||
if [ "x${MODE}" == "xSTANDALONE" ]; then
|
||||
obd devmode enable && obd cluster deploy "${OB_CLUSTER_NAME}" -c $TMPFILE;
|
||||
if [ $? -ne 0 ]; then
|
||||
deploy_failed
|
||||
@ -203,11 +189,6 @@ else # nothing here, bootstrap
|
||||
print_start_phase "Ob-deploy start"
|
||||
obd cluster start ${OB_CLUSTER_NAME}
|
||||
print_end_phase
|
||||
|
||||
if [ "x${MODE}" == "xSLIM" ]; then
|
||||
run_custom_scripts /root/boot/init.d
|
||||
fi
|
||||
|
||||
else
|
||||
print_start_phase "Ob-deploy autodeploy"
|
||||
obd devmode enable && obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE;
|
||||
@ -236,7 +217,6 @@ else # nothing here, bootstrap
|
||||
fi
|
||||
print_end_phase
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
deploy_failed
|
||||
fi
|
||||
@ -245,12 +225,6 @@ fi
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "boot success!"
|
||||
# close the enable_rich_error_msg
|
||||
PASSWORD_ARG=""
|
||||
if [ "${OB_ROOT_PASSWORD}" != "" ]; then
|
||||
PASSWORD_ARG="-p${OB_ROOT_PASSWORD}"
|
||||
fi
|
||||
obclient -h127.1 -uroot@sys -A -P${OB_MYSQL_PORT} ${PASSWORD_ARG} -e "alter system set enable_rich_error_msg = false;"
|
||||
else
|
||||
echo "boot failed!"
|
||||
if exit_while_error
|
||||
@ -1,8 +1,6 @@
|
||||
MODE=${MODE:-MINI}
|
||||
FASTBOOT=${FASTBOOT:-false}
|
||||
EXIT_WHILE_ERROR=${EXIT_WHILE_ERROR:-true}
|
||||
OB_HOME_PATH="/root/ob"
|
||||
OB_SERVER_IP="127.0.0.1"
|
||||
OB_MYSQL_PORT="2881"
|
||||
OB_RPC_PORT="2882"
|
||||
OB_CLUSTER_NAME=${OB_CLUSTER_NAME:-obcluster}
|
||||
@ -11,5 +9,4 @@ OB_MEMORY_LIMIT=${OB_MEMORY_LIMIT:-6G}
|
||||
OB_DATAFILE_SIZE=${OB_DATAFILE_SIZE:-5G}
|
||||
OB_LOG_DISK_SIZE=${OB_LOG_DISK_SIZE:-5G}
|
||||
OB_ROOT_PASSWORD=${OB_ROOT_PASSWORD:-}
|
||||
OB_SYSTEM_MEMORY=${OB_SYSTEM_MEMORY:-1G}
|
||||
OB_TENANT_LOWER_CASE_TABLE_NAMES=${OB_TENANT_LOWER_CASE_TABLE_NAMES:-1}
|
||||
OB_SYSTEM_MEMORY=${OB_SYSTEM_MEMORY:-1G}
|
||||
@ -1,12 +1,11 @@
|
||||
oceanbase-ce:
|
||||
depends:
|
||||
- ob-configserver
|
||||
servers:
|
||||
# Please don't use hostname, only IP can be supported
|
||||
- @OB_SERVER_IP@
|
||||
- 127.0.0.1
|
||||
global:
|
||||
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
|
||||
home_path: @OB_HOME_PATH@
|
||||
devname: lo
|
||||
mysql_port: @OB_MYSQL_PORT@
|
||||
rpc_port: @OB_RPC_PORT@
|
||||
zone: zone1
|
||||
@ -17,11 +16,10 @@ oceanbase-ce:
|
||||
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.
|
||||
cpu_count: 16
|
||||
production_mode: false
|
||||
production_mode: true
|
||||
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_recycle: true # Enable auto system log recycling or not. The default value is false.
|
||||
max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
|
||||
appname: @OB_CLUSTER_NAME@
|
||||
root_password: @OB_ROOT_PASSWORD@
|
||||
enable_rich_error_msg: true
|
||||
@ -1,15 +1,12 @@
|
||||
oceanbase-ce:
|
||||
depends:
|
||||
- ob-configserver
|
||||
servers:
|
||||
- @OB_SERVER_IP@
|
||||
- 127.0.0.1
|
||||
global:
|
||||
home_path: @OB_HOME_PATH@
|
||||
devname: lo
|
||||
mysql_port: @OB_MYSQL_PORT@
|
||||
rpc_port: @OB_RPC_PORT@
|
||||
datafile_size: 20G
|
||||
log_disk_size: 20G
|
||||
production_mode: false
|
||||
appname: @OB_CLUSTER_NAME@
|
||||
root_password: @OB_ROOT_PASSWORD@
|
||||
enable_rich_error_msg: true
|
||||
@ -1,7 +1,7 @@
|
||||
obagent:
|
||||
# The list of servers to be monitored. This list is consistent with the servers in oceanbase-ce.
|
||||
servers:
|
||||
- @OB_SERVER_IP@
|
||||
- 127.0.0.1
|
||||
# Set dependent components for the component.
|
||||
# When the associated configurations are not done, OBD will automatically get the these configurations from the dependent components.
|
||||
depends:
|
||||
37
tools/docker/standalone/docker_build.sh → tools/docker/standalone/fast_boot_docker_build.sh
Executable file → Normal file
37
tools/docker/standalone/docker_build.sh → tools/docker/standalone/fast_boot_docker_build.sh
Executable file → Normal file
@ -1,30 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -gt 1 ]; then
|
||||
exit 1
|
||||
elif [ "$#" -eq 1 ]; then
|
||||
BUILD_ARG="--build-arg VERSION=$1"
|
||||
else
|
||||
BUILD_ARG=""
|
||||
fi
|
||||
RPM_VERSION=$1
|
||||
|
||||
TMP_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.tmp.py"
|
||||
ACTUAL_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.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() {
|
||||
rm -rf boot
|
||||
cp -r step_1_boot boot
|
||||
docker build $BUILD_ARG --build-arg STEP=1 -t raw_observer .
|
||||
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
|
||||
rm -rf boot
|
||||
|
||||
cd "${CWD}" && mkdir -p ${CWD}/boot/etc
|
||||
docker run -it -v ${CWD}/boot:/root/dest raw_observer
|
||||
@ -38,36 +29,34 @@ function fast_boot_docker_build() {
|
||||
fi
|
||||
|
||||
cd "${CWD}"
|
||||
cp -r step_2_boot/* boot
|
||||
docker build $BUILD_ARG --build-arg STEP=2 -t oceanbase-ce .
|
||||
docker build --build-arg VERSION="${RPM_VERSION}" -t oceanbase-ce .
|
||||
if [ $? == 0 ]; then
|
||||
echo "================== docker build ok ==============="
|
||||
echo "================== fast boot docker build ok ==============="
|
||||
else
|
||||
echo "================== docker build failed ==============="
|
||||
echo "================== fast boot docker build failed ==============="
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
source ./step_2_boot/_env
|
||||
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
|
||||
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
|
||||
fi
|
||||
@ -0,0 +1,24 @@
|
||||
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
|
||||
|
||||
RUN mkdir -p /root/pkg && mkdir -p /root/store && mkdir -p /root/dest && \
|
||||
cd /root/pkg && \
|
||||
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${VERSION}.el7 oceanbase-ce-libs-${VERSION}.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
|
||||
0
tools/docker/standalone/step_1_boot/_boot → tools/docker/standalone/fast_boot_docker_build_prepare/boot/_boot
Executable file → Normal file
0
tools/docker/standalone/step_1_boot/_boot → tools/docker/standalone/fast_boot_docker_build_prepare/boot/_boot
Executable file → Normal file
0
tools/docker/standalone/step_1_boot/env.sh → tools/docker/standalone/fast_boot_docker_build_prepare/boot/env.sh
Executable file → Normal file
0
tools/docker/standalone/step_1_boot/env.sh → tools/docker/standalone/fast_boot_docker_build_prepare/boot/env.sh
Executable file → Normal file
@ -25,7 +25,6 @@ def check_file_or_path_exist(bin_abs_path, home_abs_path, store_tar_file_path, e
|
||||
logging.warn("invalid store tar file path")
|
||||
return False
|
||||
if not os.path.isdir(etc_dest_dir):
|
||||
logging.warn(etc_dest_dir)
|
||||
logging.warn("invalid etc dest dir")
|
||||
return False
|
||||
return True
|
||||
@ -47,15 +46,15 @@ if __name__ == "__main__":
|
||||
parser.add_argument("-z", dest="zone", type=str, default="zone1")
|
||||
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("-r", dest="rootservice", type=str, default="@OB_SERVER_IP@:@OB_RPC_PORT@")
|
||||
parser.add_argument("-I", dest="ip", type=str, default="@OB_SERVER_IP@")
|
||||
parser.add_argument("-i", dest="devname", type=str, default="lo")
|
||||
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="127.0.0.1")
|
||||
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("-N", dest="daemon", type=str, default="1")
|
||||
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("--max_cpu", type=float, default=7.0)
|
||||
parser.add_argument("--min_cpu", type=float, default=7.0)
|
||||
parser.add_argument("--max_cpu", type=float, default=14.0)
|
||||
parser.add_argument("--min_cpu", type=float, default=14.0)
|
||||
parser.add_argument("--memory_size", type=int, default=3221225472)
|
||||
parser.add_argument("--log_disk_size", type=int, default=3221225472)
|
||||
args = parser.parse_args()
|
||||
@ -83,8 +82,8 @@ if __name__ == "__main__":
|
||||
|
||||
# prepare observer start parameters
|
||||
daemon_option = "-N" if args.daemon=="1" else ""
|
||||
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, \
|
||||
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, \
|
||||
args.cluster_id, data_abs_path, args.devname, \
|
||||
args.rootservice, args.ip, args.log_level, args.opt_str, \
|
||||
daemon_option)
|
||||
os.chdir(home_abs_path)
|
||||
@ -117,29 +116,20 @@ if __name__ == "__main__":
|
||||
args.tenant_name, args.tenant_name, args.zone))
|
||||
logging.info("waiting for create tenant...")
|
||||
create_tenant_begin = datetime.datetime.now()
|
||||
cursor.execute("create tenant %s replica_num=1,zone_list=('%s'),primary_zone='RANDOM',resource_pool_list=('%s_pool') set ob_tcp_invited_nodes='%%', ob_compatibility_mode = 'mysql', lower_case_table_names=%d" % ( \
|
||||
args.tenant_name, args.zone, args.tenant_name, args.tenant_lower_case_table_names))
|
||||
cursor.execute("create tenant %s replica_num=1,zone_list=('%s'),primary_zone='RANDOM',resource_pool_list=('%s_pool') set ob_tcp_invited_nodes='%%', ob_compatibility_mode = 'mysql'" % ( \
|
||||
args.tenant_name, args.zone, args.tenant_name))
|
||||
create_tenant_end = datetime.datetime.now()
|
||||
logging.info('create tenant success: %s ms' % ((create_tenant_end - create_tenant_begin).total_seconds() * 1000))
|
||||
# grant privilege
|
||||
cursor.execute("CREATE USER '%s'@'%%'" % (args.tenant_name))
|
||||
cursor.execute("GRANT ALL ON *.* TO '%s'@'%%'" % (args.tenant_name))
|
||||
logging.info("grant privilege success")
|
||||
db.close()
|
||||
except mysql.err.Error as e:
|
||||
logging.warn("deploy observer failed")
|
||||
kill_server()
|
||||
exit(-1)
|
||||
|
||||
# grant privilege
|
||||
try:
|
||||
db = mysql.connect(host=args.ip, user="root@%s" % (args.tenant_name), port=int(args.mysql_port), passwd="")
|
||||
cursor = db.cursor(cursor=mysql.cursors.DictCursor)
|
||||
logging.info('connect by common tenant success!')
|
||||
cursor.execute("CREATE USER '%s'@'%%'" % (args.tenant_name))
|
||||
cursor.execute("GRANT ALL ON *.* TO '%s'@'%%'" % (args.tenant_name))
|
||||
logging.info("grant privilege success!")
|
||||
except mysql.err.Error as e:
|
||||
logging.warn("grant privilege for common tenant failed")
|
||||
kill_server()
|
||||
exit(-1)
|
||||
|
||||
# stop observer
|
||||
kill_server()
|
||||
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
ob-configserver:
|
||||
servers:
|
||||
- @OB_SERVER_IP@
|
||||
global:
|
||||
listen_port: 8080
|
||||
server_ip: 0.0.0.0
|
||||
home_path: /home/admin/obconfigserver
|
||||
Reference in New Issue
Block a user