Docker optimization
This commit is contained in:
parent
17ceeb8c92
commit
7fd5d83390
@ -89,7 +89,7 @@ obd demo
|
||||
|
||||
```shell
|
||||
# Deploy a mini standalone instance.
|
||||
docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=1 -d oceanbase/oceanbase-ce
|
||||
docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d oceanbase/oceanbase-ce
|
||||
```
|
||||
|
||||
2. Connect to the OceanBase Database instance:
|
||||
|
@ -88,7 +88,7 @@ obd demo
|
||||
|
||||
```shell
|
||||
# 部署一个mini模式实例
|
||||
docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=1 -d oceanbase/oceanbase-ce
|
||||
docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d oceanbase/oceanbase-ce
|
||||
```
|
||||
|
||||
2. 连接 OceanBase
|
||||
|
@ -6,13 +6,22 @@ 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 ob-deploy obclient ob-sysbench libaio && \
|
||||
yum install -y ob-deploy obclient ob-sysbench libaio bc libselinux-utils zip && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
yum clean all
|
||||
|
||||
RUN mkdir -p /root/pkg && \
|
||||
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 && \
|
||||
cd /root/pkg && \
|
||||
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${VERSION}.el7 oceanbase-ce-libs-${VERSION}.el7 obagent && \
|
||||
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${OBVersion}.el7 oceanbase-ce-libs-${OBVersion}.el7 obagent ob-configserver && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
yum clean all
|
||||
|
||||
|
@ -123,3 +123,12 @@ docker -v 参数的详细说明可以参考 [docker volumn](https://docs.docker.
|
||||
- `./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;
|
||||
```
|
||||
|
@ -118,4 +118,13 @@ 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`
|
||||
|
||||
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.
|
||||
|
||||
## 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;
|
||||
```
|
||||
|
@ -2,6 +2,7 @@
|
||||
CWD=$(cd `dirname $0`;pwd)
|
||||
cd "${CWD}"
|
||||
source _env
|
||||
export HOST_IP_MODE=1
|
||||
|
||||
STAMP="$(date +%s)"
|
||||
STEP=1
|
||||
@ -142,6 +143,11 @@ else # nothing here, bootstrap
|
||||
cat obagent.yaml >> $TMPFILE
|
||||
fi
|
||||
|
||||
if [ "x${MODE}" != "xMINI" ] && [ "x${MODE}" != "xSTANDALONE" ]; 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
|
||||
@ -225,6 +231,8 @@ fi
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "boot success!"
|
||||
# close the enable_rich_error_msg
|
||||
obclient -h127.1 -uroot@sys -A -P${OB_MYSQL_PORT} -e "alter system set enable_rich_error_msg = false;"
|
||||
else
|
||||
echo "boot failed!"
|
||||
if exit_while_error
|
||||
|
@ -1,6 +1,7 @@
|
||||
$MODE=${MODE:-MINI}
|
||||
MODE=${MODE:-MINI}
|
||||
EXIT_WHILE_ERROR=${EXIT_WHILE_ERROR:-true}
|
||||
OB_HOME_PATH="/root/ob"
|
||||
OB_SERVER_IP=$(hostname -i)
|
||||
OB_MYSQL_PORT="2881"
|
||||
OB_RPC_PORT="2882"
|
||||
OB_CLUSTER_NAME=${OB_CLUSTER_NAME:-obcluster}
|
||||
|
@ -1,11 +1,12 @@
|
||||
oceanbase-ce:
|
||||
depends:
|
||||
- ob-configserver
|
||||
servers:
|
||||
# Please don't use hostname, only IP can be supported
|
||||
- 127.0.0.1
|
||||
- @OB_SERVER_IP@
|
||||
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
|
||||
@ -23,3 +24,4 @@ oceanbase-ce:
|
||||
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,12 +1,14 @@
|
||||
oceanbase-ce:
|
||||
depends:
|
||||
- ob-configserver
|
||||
servers:
|
||||
- 127.0.0.1
|
||||
- @OB_SERVER_IP@
|
||||
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
|
||||
appname: @OB_CLUSTER_NAME@
|
||||
root_password: @OB_ROOT_PASSWORD@
|
||||
enable_rich_error_msg: true
|
||||
|
7
tools/docker/standalone/boot/ob-configserver.yaml
Normal file
7
tools/docker/standalone/boot/ob-configserver.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
ob-configserver:
|
||||
servers:
|
||||
- @OB_SERVER_IP@
|
||||
global:
|
||||
listen_port: 8080
|
||||
server_ip: 0.0.0.0
|
||||
home_path: /home/admin/obconfigserver
|
@ -1,7 +1,7 @@
|
||||
obagent:
|
||||
# The list of servers to be monitored. This list is consistent with the servers in oceanbase-ce.
|
||||
servers:
|
||||
- 127.0.0.1
|
||||
- @OB_SERVER_IP@
|
||||
# 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:
|
||||
|
@ -9,9 +9,18 @@ RUN yum install -y yum-utils && \
|
||||
yum install -y libaio mysql && \
|
||||
yum clean all
|
||||
|
||||
RUN mkdir -p /root/pkg && mkdir -p /root/store && mkdir -p /root/dest && \
|
||||
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-${VERSION}.el7 oceanbase-ce-libs-${VERSION}.el7 && \
|
||||
yum install -y --downloadonly --downloaddir=. oceanbase-ce-${OBVersion}.el7 oceanbase-ce-libs-${OBVersion}.el7 && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
yum clean all
|
||||
|
||||
@ -21,4 +30,6 @@ ENV PATH /root/boot:$PATH
|
||||
ENV LD_LIBRARY_PATH /home/admin/oceanbase/lib:/root/ob/lib:$LD_LIBRARY_PATH
|
||||
|
||||
WORKDIR /root
|
||||
CMD _boot
|
||||
CMD _boot
|
||||
|
||||
EXPOSE 2881
|
Loading…
x
Reference in New Issue
Block a user