standalone (#853)

This commit is contained in:
Rongfeng Fu
2022-03-31 15:39:17 +08:00
committed by GitHub
parent 3d79cacb37
commit b6b7da6b55
11 changed files with 325 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#!/bin/bash
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
source _env
STAMP="$(date +%s)"
[[ -f boot.yaml ]] && echo "find boot.yaml, skip configuring..." || {
echo "generate boot.yaml ..."
TMPFILE="boot.${STAMP}.yaml"
if ${MINI_MODE}
then
cp -f boot-mini-tmp.yaml $TMPFILE
else
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}
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
}
[[ -f boot.yaml ]] && {
echo "start ob cluster ..."
obd cluster start $OB_CLUSTER_NAME
} && echo "boot success!" && exec /sbin/init

View File

@ -0,0 +1,7 @@
MINI_MODE=${MINI_MODE:-false}
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"}

View File

@ -0,0 +1,44 @@
oceanbase-ce:
servers:
- 127.0.0.1
global:
home_path: @OB_HOME_PATH@ # default: /root/ob
devname: lo
mysql_port: @OB_MYSQL_PORT@ # default: 2881
rpc_port: @OB_RPC_PORT@ # default: 2882
zone: zone1
cluster_id: 1
memory_limit: 8G
system_memory: 4G
stack_size: 512K
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_merge_by_turn: FALSE
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

View File

@ -0,0 +1,9 @@
oceanbase-ce:
servers:
- 127.0.0.1
global:
home_path: @OB_HOME_PATH@ # default: /root/ob
devname: lo
mysql_port: @OB_MYSQL_PORT@ # default: 2881
rpc_port: @OB_RPC_PORT@ # default: 2882
root_password: @OB_ROOT_PASSWORD@ # default: null

View File

@ -0,0 +1,2 @@
CREATE USER 'test'@'%';
GRANT ALL ON test.* TO 'test'@'%';

View File

@ -0,0 +1,29 @@
#!/bin/bash
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"
LOGIN_USER="root@${OB_TENANT_NAME}"
;;
*)
DB="test"
LOGIN_USER="test@${OB_TENANT_NAME}"
;;
esac
echo "login as ${LOGIN_USER}"
CMD="obclient -h127.1 -u${LOGIN_USER} -A -D${DB} -P${OB_MYSQL_PORT} ${PASSCMD}"
echo "Command is: ${CMD}"
${CMD}