diff --git a/bin/build_image.sh b/bin/build_image.sh index 0cecd9d..fb5fe96 100644 --- a/bin/build_image.sh +++ b/bin/build_image.sh @@ -55,13 +55,15 @@ function build_image() if [[ "${MO_CONTAINER_DEPIMAGE_REPLACE_REPO}" == "yes" ]]; then add_log "D" "Repace repo for some images" - add_log "D" "s#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile" + add_log "D" "sed -i 's#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile" sed -i 's#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile - add_log "D" "s#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile" + add_log "D" "sed -i 's#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile" sed -i 's#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile fi + + add_log "D" "Cmd: docker build -f optools/images/Dockerfile -t ${image_name}:${branch}_${commitid_less} . --build-arg GOPROXY=\"${GOPROXY}\"" if docker build -f optools/images/Dockerfile -t ${image_name}:${branch}_${commitid_less} . --build-arg GOPROXY="${GOPROXY}" ; then : else diff --git a/bin/start.sh b/bin/start.sh index 98a23ac..201873c 100644 --- a/bin/start.sh +++ b/bin/start.sh @@ -107,11 +107,23 @@ function start() cmd_params="${cmd_params} --privileged=true" fi + debug_option="" + if [[ "${MO_CONTAINER_DEBUG_PORT}" != "" ]]; then + debug_option="-debug-http :${MO_CONTAINER_DEBUG_PORT}" + fi + + pprof_option="" + if [[ "${PPROF_INTERVAL}" != "" ]]; then + pprof_option="-profile-interval ${PPROF_INTERVAL}s" + fi + # if conf path exists if [[ -d ${MO_CONTAINER_CONF_HOST_PATH} ]]; then - docker_init_cmd="docker run ${cmd_params} -v ${MO_CONTAINER_CONF_HOST_PATH}:/etc:rw --entrypoint /mo-service ${MO_CONTAINER_IMAGE} -debug-http :${MO_CONTAINER_DEBUG_PORT} -launch ${MO_CONTAINER_CONF_CON_FILE}" + docker_init_cmd="docker run ${cmd_params} -v ${MO_CONTAINER_CONF_HOST_PATH}:/etc:rw --entrypoint /mo-service ${MO_CONTAINER_IMAGE} ${debug_option} ${pprof_option} -launch ${MO_CONTAINER_CONF_CON_FILE}" else - docker_init_cmd="docker run ${cmd_params} ${MO_CONTAINER_IMAGE}" + #docker_init_cmd="docker run ${cmd_params} ${MO_CONTAINER_IMAGE}" + docker_init_cmd="docker run ${cmd_params} --entrypoint /mo-service ${MO_CONTAINER_IMAGE} ${debug_option} ${pprof_option} -launch ${MO_CONTAINER_CONF_CON_FILE}" + fi @@ -140,14 +152,25 @@ function start() exit 1 fi + debug_option="" + if [[ "${MO_CONTAINER_DEBUG_PORT}" != "" ]]; then + debug_option="-debug-http :${MO_CONTAINER_DEBUG_PORT}" + fi + + pprof_option="" + if [[ "${PPROF_INTERVAL}" != "" ]]; then + pprof_option="-profile-interval ${PPROF_INTERVAL}s" + fi + + if [[ "${go_mem_limit}" == "" ]]; then add_log "W" "GO memory limit seems to be empty, thus will not set this limit" - add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log" - cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log + add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log" + cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log else add_log "D" "Start command will add GOMEMLIMIT=${go_mem_limit}MiB" - add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log" - cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log + add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log" + cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log fi add_log "I" "Wait for ${START_INTERVAL} seconds" diff --git a/conf/env.sh b/conf/env.sh index 60cb857..5ac8eff 100644 --- a/conf/env.sh +++ b/conf/env.sh @@ -112,6 +112,9 @@ MO_DEBUG_PORT="9876" MO_CONF_FILE="${MO_PATH}/matrixone/etc/launch/launch.toml" # GO memory limit ratio, x%. By default, 90% is recommended GO_MEM_LIMIT_RATIO=90 +# time interval (in seconds) of auto profile collecting. Empty by default, meaning will not turn on auto profile collecting +PPROF_INTERVAL="" + # for restart # interval between stop and start, unit: seconds @@ -223,7 +226,7 @@ BACKUP_S3_IS_MINIO="no" # 2. logical backups # mo-dump BACKUP_MODUMP_PATH="/data/tools/mo_dump/mo-dump" -# backup databases, seperated by ',' for each database. Note: 'all' and 'all_no_system' are special settings +# backup databases, seperated by ',' for each database. Note: 'all' and 'all_no_sysdb' are special settings # all: all databases, including all system and user databases # all_no_sysdb: (default) all databases, including all user databases, but no system databases # other settings by user, e.g. db1,db2,db3