Skip to content

Commit

Permalink
add be entrypoint enable workload group
Browse files Browse the repository at this point in the history
  • Loading branch information
catpineapple committed Nov 12, 2024
1 parent 980dc41 commit a5cd399
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion docker/runtime/be/resource/be_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,24 @@ DB_ADMIN_USER=${USER:-"root"}

DB_ADMIN_PASSWD=$PASSWD

ENABLE_WORKLOAD_GROUP=${ENABLE_WORKLOAD_GROUP:-false}
WORKLOAD_GROUP_PATH="/sys/fs/cgroup/cpu/doris"

log_stderr()
{
echo "[`date`] $@" >&2
}

function add_cluster_info_to_conf()
{
if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
echo "doris_cgroup_cpu_path=$WORKLOAD_GROUP_PATH" >> ${DORIS_HOME}/conf/be.conf
fi
}

update_conf_from_configmap()
{
add_cluster_info_to_conf
if [[ "x$CONFIGMAP_MOUNT_PATH" == "x" ]] ; then
log_stderr '[info] Empty $CONFIGMAP_MOUNT_PATH env var, skip it!'
return 0
Expand All @@ -65,6 +76,11 @@ update_conf_from_configmap()
# make a backup
mv -f $tgt ${tgt}.bak
fi
if [[ "$conffile" == "be.conf" ]]; then
cp $CONFIGMAP_MOUNT_PATH/$conffile $DORIS_HOME/conf/$file
add_cluster_info_to_conf
continue
fi
ln -sfT $CONFIGMAP_MOUNT_PATH/$conffile $tgt
done
}
Expand Down Expand Up @@ -223,13 +239,37 @@ function check_and_register()
fi
}

function work_load_group_for_cgroup_path() {
output=$(cat /proc/filesystems | grep cgroup)
if [ -z "$output" ]; then
log_stderr "[error] The host machine does not have cgroup installed, so the workload group function will be limited."
exit 1
fi

mkdir -p /sys/fs/cgroup/cpu/doris
chmod 770 /sys/fs/cgroup/cpu/doris
chown -R root:root /sys/fs/cgroup/cpu/doris

if [[ -f "/sys/fs/cgroup/cgroup.controllers" ]]; then
log_stderr "[info] The host machine cgroup version: v2."
chmod a+w /sys/fs/cgroup/cgroup.procs
else
log_stderr "[info] The host machine cgroup version: v1."
fi
}

fe_addrs=$1
if [[ "x$fe_addrs" == "x" ]]; then
echo "need fe address as paramter!"
echo " Example $0 <fe_addr>"
exit 1
fi

if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
log_stderr '[info] Enable workload group !'
work_load_group_for_cgroup_path
fi

update_conf_from_configmap
# resolve password for root to manage nodes in doris.
resolve_password_from_secret
Expand All @@ -242,4 +282,3 @@ log_stderr "run start_be.sh"
# befor doris 2.0.2 ,doris start with : start_xx.sh
# sine doris 2.0.2 ,doris start with : start_xx.sh --console doc: https://doris.apache.org/docs/dev/install/standard-deployment/#version--202
$DORIS_HOME/bin/start_be.sh --console

0 comments on commit a5cd399

Please sign in to comment.