From ada43139a354fdd4e4718106b5e5bb3c71273839 Mon Sep 17 00:00:00 2001 From: yagagagaga Date: Tue, 24 Dec 2024 20:38:22 +0800 Subject: [PATCH 1/2] [chore](bash) optimize doris_cloud bootstrap information --- cloud/script/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/script/start.sh b/cloud/script/start.sh index ecb5a3b2bed1e6..a56b1dc2bdf7f0 100644 --- a/cloud/script/start.sh +++ b/cloud/script/start.sh @@ -141,7 +141,7 @@ if [[ "${RUN_DAEMON}" -eq 1 ]]; then echo "${process} may not start successfully please check process log for more details" exit 1 fi - echo "${process} start successfully" + tail -n10 "${out_file}" | grep -E '(recycler|meta-service) started' exit 0 elif [[ "${RUN_CONSOLE}" -eq 1 ]]; then export DORIS_LOG_TO_STDERR=1 From 2d7dda139ef9f2c92d33f9316ddea1cff875b043 Mon Sep 17 00:00:00 2001 From: yagagagaga Date: Thu, 26 Dec 2024 15:28:46 +0800 Subject: [PATCH 2/2] update --- cloud/script/start.sh | 31 +++++++++++++++++++++---------- cloud/src/main.cpp | 10 +++++----- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/cloud/script/start.sh b/cloud/script/start.sh index a56b1dc2bdf7f0..3b59e1b492a67e 100644 --- a/cloud/script/start.sh +++ b/cloud/script/start.sh @@ -35,6 +35,8 @@ fi RUN_DAEMON=0 RUN_VERSION=0 RUN_CONSOLE=0 +RUN_METASERVICE=0 +RUN_RECYCLYER=0 for arg; do shift [[ "${arg}" = "--daemonized" ]] && RUN_DAEMON=1 && continue @@ -42,6 +44,8 @@ for arg; do [[ "${arg}" = "--daemon" ]] && RUN_DAEMON=1 && continue [[ "${arg}" = "--version" ]] && RUN_VERSION=1 && continue [[ "${arg}" = "--console" ]] && RUN_CONSOLE=1 && continue + [[ "${arg}" = "--meta-service" ]] && RUN_METASERVICE=1 && continue + [[ "${arg}" = "--recycler" ]] && RUN_RECYCLYER=1 && continue set -- "$@" "${arg}" done # echo "$@" "daemonized=${daemonized}"} @@ -60,13 +64,23 @@ while read -r line; do fi done <"${DORIS_HOME}/conf/doris_cloud.conf" +role='' +if [[ ${RUN_METASERVICE} -eq 0 ]] && [[ ${RUN_RECYCLYER} -eq 0 ]]; then + role='MetaService and Recycler' +elif [[ ${RUN_METASERVICE} -eq 1 ]] && [[ ${RUN_RECYCLYER} -eq 0 ]]; then + role='MetaService' +elif [[ ${RUN_METASERVICE} -eq 0 ]] && [[ ${RUN_RECYCLYER} -eq 1 ]]; then + role='Recycler' +elif [[ ${RUN_METASERVICE} -eq 1 ]] && [[ ${RUN_RECYCLYER} -eq 1 ]]; then + role='MetaService and Recycler' +fi process=doris_cloud if [[ ${RUN_VERSION} -eq 0 ]] && [[ -f "${DORIS_HOME}/bin/${process}.pid" ]]; then pid=$(cat "${DORIS_HOME}/bin/${process}.pid") if [[ "${pid}" != "" ]]; then if kill -0 "$(cat "${DORIS_HOME}/bin/${process}.pid")" >/dev/null 2>&1; then - echo "pid file existed, ${process} have already started, pid=${pid}" + echo "pid file existed, ${role} have already started, pid=${pid}" exit 1 fi fi @@ -113,7 +127,7 @@ if [[ -f "${DORIS_HOME}/conf/hdfs-site.xml" ]]; then export LIBHDFS3_CONF="${DORIS_HOME}/conf/hdfs-site.xml" fi -echo "LIBHDFS3_CONF=${LIBHDFS3_CONF}" +# echo "LIBHDFS3_CONF=${LIBHDFS3_CONF}" # to enable dump jeprof heap stats prodigally, change `prof_active:false` to `prof_active:true` or curl http://be_host:be_webport/jeheap/prof/true # to control the dump interval change `lg_prof_interval` to a specific value, it is pow/exponent of 2 in size of bytes, default 34 means 2 ** 34 = 16GB @@ -126,22 +140,19 @@ if [[ "${RUN_VERSION}" -ne 0 ]]; then fi mkdir -p "${DORIS_HOME}/log" -echo "starts ${process} with args: $*" out_file=${DORIS_HOME}/log/${process}.out +printf "\n\n\n\n\n\n\n\n\n\n" >>"${out_file}" +echo "$(date +'%F %T') start with args: $*" >>"${out_file}" if [[ "${RUN_DAEMON}" -eq 1 ]]; then # append 10 blank lines to ensure the following tail -n10 works correctly - printf "\n\n\n\n\n\n\n\n\n\n" >>"${out_file}" - echo "$(date +'%F %T') try to start ${process}" >>"${out_file}" nohup "${bin}" "$@" >>"${out_file}" 2>&1 & - echo "wait and check ${process} start successfully" + echo "wait and check ${role} start successfully" >>"${out_file}" sleep 3 - tail -n10 "${out_file}" | grep 'successfully started brpc' - ret=$? if [[ ${ret} -ne 0 ]]; then - echo "${process} may not start successfully please check process log for more details" + echo "${role} may not start successfully please check process log for more details" exit 1 fi - tail -n10 "${out_file}" | grep -E '(recycler|meta-service) started' + tail -n12 "${out_file}" exit 0 elif [[ "${RUN_CONSOLE}" -eq 1 ]]; then export DORIS_LOG_TO_STDERR=1 diff --git a/cloud/src/main.cpp b/cloud/src/main.cpp index 26033cdaad2a07..72e87e75aa0c3c 100644 --- a/cloud/src/main.cpp +++ b/cloud/src/main.cpp @@ -214,7 +214,7 @@ int main(int argc, char** argv) { // We can invoke glog from now on std::string msg; - LOG(INFO) << "try to start doris_cloud"; + LOG(INFO) << "try to start " << process_name; LOG(INFO) << build_info(); std::cout << build_info() << std::endl; @@ -223,7 +223,7 @@ int main(int argc, char** argv) { std::get<0>(args.args()[ARG_RECYCLER]) = true; LOG(INFO) << "meta_service and recycler are both not specified, " "run doris_cloud as meta_service and recycler by default"; - std::cout << "run doris_cloud as meta_service and recycler by default" << std::endl; + std::cout << "try to start meta_service, recycler" << std::endl; } brpc::Server server; @@ -275,7 +275,7 @@ int main(int argc, char** argv) { std::cerr << msg << std::endl; return ret; } - msg = "meta-service started"; + msg = "MetaService has been started successfully"; LOG(INFO) << msg; std::cout << msg << std::endl; } @@ -288,7 +288,7 @@ int main(int argc, char** argv) { std::cerr << msg << std::endl; return ret; } - msg = "recycler started"; + msg = "Recycler has been started successfully"; LOG(INFO) << msg; std::cout << msg << std::endl; auto periodiccally_log = [&]() { @@ -317,7 +317,7 @@ int main(int argc, char** argv) { return -1; } end = steady_clock::now(); - msg = "successfully started brpc listening on port=" + std::to_string(port) + + msg = "successfully started service listening on port=" + std::to_string(port) + " time_elapsed_ms=" + std::to_string(duration_cast(end - start).count()); LOG(INFO) << msg; std::cout << msg << std::endl;