remove some docker environments

This commit is contained in:
hnwyllmm
2023-02-09 16:46:53 +00:00
committed by ob-robot
parent 229da88e8f
commit d840b21191
9 changed files with 50 additions and 69 deletions

View File

@ -12,8 +12,6 @@ RUN mkdir /root/pkg && \
cd /root/pkg && \
yum install --downloadonly --downloaddir=. oceanbase-ce-${VERSION}.el7 oceanbase-ce-libs-${VERSION}.el7 obagent && \
rm -rf /usr/obd/mirror/remote/* && \
obd mirror clone /root/pkg/*.rpm && obd mirror list local && \
rm -rf /root/pkg/* && \
yum clean all
COPY boot /root/boot/

View File

@ -1,6 +1,6 @@
# 如何使用Docker部署OceanBase
OceanBase 提供了一个独立部署的测试镜像[oceanbase-ce](https://hub.docker.com/r/oceanbase/oceanbase-ce)。默认情况下,这个镜像会在当前容器环境中部署一个占用最大资源的数据库实例。不过可以使用环境变量MINI_MODE来部署一个mini模式的数据库实例。
OceanBase 提供了一个独立部署的测试镜像[oceanbase-ce](https://hub.docker.com/r/oceanbase/oceanbase-ce)。默认情况下,这个镜像会部署一个MINI_MODE OceanBase 实例。
**注意**
@ -18,7 +18,7 @@ OceanBase 提供了一个独立部署的测试镜像[oceanbase-ce](https://hub.d
在部署 oceanbase-ce 镜像之前,您需要确认以下信息:
- 确保您的机器至少提供 2 核 10GB 以上的资源。
- 确保您的机器至少提供 2 核 8GB 以上的资源。
- 您的机器已经安装以下程序:
应用程序 | 推荐版本 | 参考文档
@ -31,11 +31,11 @@ OceanBase 提供了一个独立部署的测试镜像[oceanbase-ce](https://hub.d
运行以下命令,启动 OceanBase 的实例:
```bash
# 根据当前容器情况部署最规格实例
# 部署最规格实例
docker run -p 2881:2881 --name oceanbase-ce -d oceanbase/oceanbase-ce
# 部署最规格实例
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 MINI_MODE=0 -d oceanbase/oceanbase-ce
```
启动预计需要 2-5 分钟。执行以下命令,如果返回 `boot success!`,则启动成功。
@ -45,6 +45,8 @@ $ docker logs oceanbase-ce | tail -1
boot success!
```
启动成功后,容器中会启动一个oceanbase进程实例,可以使用root用户进行连接,不需要使用密码。
**注意:** 如果observer进程出现异常退出,容器不会自动退出。
## 连接 OceanBase 实例

View File

@ -45,6 +45,8 @@ $ docker logs oceanbase-ce | tail -1
boot success!
```
After started, there is an oceanbase instance. You can connect to the oceanbase by root user without password.
## Connect to an OceanBase instance
oceanbase-ce image contains obclient (OceanBase Database client) and the default connection script `ob-mysql`.

View File

@ -39,9 +39,12 @@ function exit_while_error() {
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'
start_check_files=('/root/.obd/plugins/oceanbase/3.1.0/start_check.py' '/root/.obd/plugins/oceanbase/4.0.0.0/start_check.py')
for start_check_file in ${start_check_files[@]}
do
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
done
}
# We should decide whether the observer's data exists and
@ -70,18 +73,19 @@ else # nothing here, bootstrap
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
sed -i "s|@OB_CLUSTER_NAME@|${OB_CLUSTER_NAME}|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
#obd mirror clone /root/pkg/*.rpm \
#&& obd mirror list local
obd mirror clone /root/pkg/*.rpm \
&& obd mirror list local
remove_disk_check_logic_in_obd
obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE \
obd devmode enable \
&& 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 ${OB_HOME_PATH}/boot.yaml \
@ -99,5 +103,5 @@ else
echo "Please check the log file ${OB_HOME_PATH}/log/observer.log"
fi
fi
exec /sbin/init
exec tail -f /dev/null

View File

@ -1,8 +1,7 @@
MINI_MODE=${MINI_MODE:-false}
MINI_MODE=${MINI_MODE:-true}
EXIT_WHILE_ERROR=${EXIT_WHILE_ERROR:-true}
OB_HOME_PATH=${OB_HOME_PATH:-"/root/ob"}
OB_MYSQL_PORT=${OB_MYSQL_PORT:-"2881"}
OB_RPC_PORT=${OB_RPC_PORT:-"2882"}
OB_ROOT_PASSWORD=${OB_ROOT_PASSWORD:-""}
OB_CLUSTER_NAME=${OB_CLUSTER_NAME:-"obcluster"}
OB_TENANT_NAME=${OB_TENANT_NAME:-"test"}
OB_HOME_PATH="/root/ob"
OB_MYSQL_PORT="2881"
OB_RPC_PORT="2882"
OB_CLUSTER_NAME="obcluster"
OB_TENANT_NAME="test"

View File

@ -1,43 +1,24 @@
oceanbase-ce:
servers:
# Please don't use hostname, only IP can be supported
- 127.0.0.1
global:
home_path: @OB_HOME_PATH@ # default: /root/ob
# 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@ # default: 2881
rpc_port: @OB_RPC_PORT@ # default: 2882
mysql_port: @OB_MYSQL_PORT@
rpc_port: @OB_RPC_PORT@
zone: zone1
cluster_id: 1
memory_limit: 6G
system_memory: 3G
stack_size: 512K
# please set memory limit to a suitable value which is matching resource.
memory_limit: 6G # The maximum running memory for an observer
system_memory: 1G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
datafile_size: 5G # Size of the data file.
log_disk_size: 5G # The size of disk space used by the clog files.
cpu_count: 16
cache_wash_threshold: 1G
__min_full_resource_pool_memory: 268435456
workers_per_cpu_quota: 10
schema_history_expire_time: 1d
net_thread_count: 4
sys_bkgd_migration_retry_num: 3
minor_freeze_times: 100
enable_separate_sys_clog: 0
enable_auto_leader_switch: FALSE
enable_one_phase_commit: FALSE
weak_read_version_refresh_interval: 5s
trace_log_slow_query_watermark: 1s
large_query_threshold: 1s
clog_sync_time_warn_threshold: 1s
syslog_io_bandwidth_limit: 10M
enable_sql_audit: FALSE
enable_perf_event: FALSE
clog_max_unconfirmed_log_count: 5000
autoinc_cache_refresh_interval: 86400s
cpu_quota_concurrency: 2
datafile_size: 5G
syslog_level: WARN
enable_syslog_recycle: TRUE
max_syslog_file_count: 2
enable_early_lock_release: false tenant=all
default_compress_func: lz4_1.0
root_password: @OB_ROOT_PASSWORD@
clog_disk_utilization_threshold: 95
clog_disk_usage_limit_percentage: 98
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@

View File

@ -2,10 +2,10 @@ oceanbase-ce:
servers:
- 127.0.0.1
global:
home_path: @OB_HOME_PATH@ # default: /root/ob
home_path: @OB_HOME_PATH@
devname: lo
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
mysql_port: @OB_MYSQL_PORT@
rpc_port: @OB_RPC_PORT@
datafile_size: 20G
log_disk_size: 20G
appname: @OB_CLUSTER_NAME@

View File

@ -3,15 +3,10 @@ CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
source _env
PASSCMD=""
case "$1" in
sys)
LOGIN_USER="root@sys"
DB="oceanbase"
if [[ "${OB_ROOT_PASSWORD}x" != "x" ]]; then
PASSCMD=-p${OB_ROOT_PASSWORD}
fi
;;
root)
DB="oceanbase"

View File

@ -48,7 +48,7 @@ obagent:
# The RPC port for observer. The default value is 2882. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the rpc_port in oceanbase-ce.
# rpc_port: 2882
# Cluster name for OceanBase Database. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the appname in oceanbase-ce.
# cluster_name: obcluster
cluster_name: @OB_CLUSTER_NAME@
# Cluster ID for OceanBase Database. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the cluster_id in oceanbase-ce.
# cluster_id: 1
# Zone name for your observer. The default value is zone1. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the zone name in oceanbase-ce.