do not force to make sure there is enough disk space for observer in docker any more
This commit is contained in:
@ -1,15 +1,25 @@
|
||||
FROM oceanbase/centos7:latest
|
||||
|
||||
ARG VERSION=3.1.3-10100032022041510
|
||||
|
||||
RUN yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo && \
|
||||
yum install -y ob-deploy obclient ob-sysbench wget libaio && \
|
||||
mkdir /root/pkg && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
rm -rf /u01/mysql /u01/obclient/bin/mysqld* /u01/obclient/bin/aria* /u01/obclient/bin/maria* && \
|
||||
yum clean all
|
||||
|
||||
RUN mkdir /root/pkg && \
|
||||
cd /root/pkg && \
|
||||
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm -q && \
|
||||
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/oceanbase-ce-libs-3.1.2-10000392021123010.el7.x86_64.rpm -q && \
|
||||
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/oceanbase-ce-${VERSION}.el7.x86_64.rpm -q && \
|
||||
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/oceanbase-ce-libs-${VERSION}.el7.x86_64.rpm -q && \
|
||||
rm -rf /usr/obd/mirror/remote/* && \
|
||||
obd mirror clone *.rpm && \
|
||||
obd mirror list local && \
|
||||
rm -rf /root/base /root/pkg && \
|
||||
yum clean all
|
||||
|
||||
COPY boot /root/boot/
|
||||
ENV PATH /root/boot:$PATH
|
||||
|
||||
WORKDIR /root
|
||||
CMD _boot
|
||||
|
||||
@ -5,29 +5,57 @@ source _env
|
||||
|
||||
STAMP="$(date +%s)"
|
||||
|
||||
# return 0 if mini_mode is nil or 'no'/'false'/0
|
||||
# 0 means true and 1 for false in bash
|
||||
function is_mini_mode() {
|
||||
if test -z ${MINI_MODE}
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# convert MINI_MODE to upper case string(can work in bash 4.x)
|
||||
mini_mode=${MINI_MODE^^}
|
||||
if [ "x${mini_mode}" == "xNO" ] || [ "x${mini_mode}" == "xFALSE" ] || [ "x${mini_mode}" == "x0" ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function remove_disk_check_logic_in_obd() {
|
||||
# make sure obd copy the plugin code
|
||||
obd cluster list
|
||||
start_check_file='/root/.obd/plugins/oceanbase/3.1.0/start_check.py'
|
||||
sed -i "s/critical('(%s) %s not enough disk space\. (Avail/alert('(%s) %s not enough disk space\. (Avail/g" $start_check_file
|
||||
sed -i "s/critical(EC_OBSERVER_NOT_ENOUGH_DISK_4_CLOG/alert(EC_OBSERVER_NOT_ENOUGH_DISK_4_CLOG/g" $start_check_file
|
||||
}
|
||||
|
||||
[[ -f boot.yaml ]] && echo "find boot.yaml, skip configuring..." || {
|
||||
echo "generate boot.yaml ..."
|
||||
TMPFILE="boot.${STAMP}.yaml"
|
||||
if [[ $MINI_MODE == 1 ]]
|
||||
|
||||
if is_mini_mode
|
||||
then
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
echo "oceanbase-ce docker in mini mode"
|
||||
cp -f boot-mini-tmp.yaml $TMPFILE
|
||||
else
|
||||
cp -f boot-tmp.yaml $TMPFILE
|
||||
cp -f boot-tmp.yaml $TMPFILE
|
||||
fi
|
||||
|
||||
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
|
||||
sed -i "s|@OB_ROOT_PASSWORD@|${OB_ROOT_PASSWORD}|g" $TMPFILE
|
||||
|
||||
[ "${OB_DATA_DIR}" ] && echo " data_dir: ${OB_DATA_DIR}" >> $TMPFILE
|
||||
[ "${OB_REDO_DIR}" ] && echo " redo_dir: ${OB_REDO_DIR}" >> $TMPFILE
|
||||
echo "create boot dirs and deploy ob cluster ..."
|
||||
mkdir -p $OB_HOME_PATH
|
||||
if [[ $MINI_MODE == 1 ]]
|
||||
then
|
||||
obd cluster deploy "${OB_CLUSTER_NAME}" -c $TMPFILE && obd cluster tenant create "${OB_CLUSTER_NAME}" -n ${OB_TENANT_NAME} && obd cluster start "${OB_CLUSTER_NAME}" && obclient -h127.1 -uroot@${OB_TENANT_NAME} -A -P${OB_MYSQL_PORT} < init_tenant_user.sql && mv -f $TMPFILE boot.yaml
|
||||
else
|
||||
obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE && obd cluster tenant create "${OB_CLUSTER_NAME}" -n ${OB_TENANT_NAME} && obclient -h127.1 -uroot@${OB_TENANT_NAME} -A -P${OB_MYSQL_PORT} < init_tenant_user.sql && mv -f $TMPFILE boot.yaml
|
||||
fi
|
||||
|
||||
remove_disk_check_logic_in_obd
|
||||
obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE \
|
||||
&& obd cluster tenant create "${OB_CLUSTER_NAME}" -n ${OB_TENANT_NAME} \
|
||||
&& obclient -h127.1 -uroot@${OB_TENANT_NAME} -A -P${OB_MYSQL_PORT} < init_tenant_user.sql \
|
||||
&& mv -f $TMPFILE boot.yaml
|
||||
}
|
||||
|
||||
[[ -f boot.yaml ]] && {
|
||||
|
||||
@ -8,8 +8,8 @@ oceanbase-ce:
|
||||
rpc_port: @OB_RPC_PORT@ # default: 2882
|
||||
zone: zone1
|
||||
cluster_id: 1
|
||||
memory_limit: 8G
|
||||
system_memory: 4G
|
||||
memory_limit: 6G
|
||||
system_memory: 3G
|
||||
stack_size: 512K
|
||||
cpu_count: 16
|
||||
cache_wash_threshold: 1G
|
||||
|
||||
@ -7,3 +7,5 @@ oceanbase-ce:
|
||||
mysql_port: @OB_MYSQL_PORT@ # default: 2881
|
||||
rpc_port: @OB_RPC_PORT@ # default: 2882
|
||||
root_password: @OB_ROOT_PASSWORD@ # default: null
|
||||
datafile_size: 10G
|
||||
clog_disk_usage_limit_percentage: 98 # default: 80
|
||||
|
||||
Reference in New Issue
Block a user