Feature/sangshuduo/td 3973 use jemalloc (#6762)
* [TD-3973]<feature>: add jemalloc as submodule. * add macro definitions in cmake. * [TD-3973]<feature>: use jemalloc. build works as following instructions: cmake .. -DJEMALLOC_ENABLED=true make * fix jemalloc at tag 5.2.1 * link jemalloc works. * make install works. * support jemalloc in release.sh. * release script works. * fix a typo. * [TD-3937]<feature>: support jemalloc add install funtion to all scripts. * adjust install_jemalloc() position for update check compatiblity. Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
d53b734901
commit
7a80bf0417
|
@ -783,6 +783,7 @@ function update_TDengine() {
|
||||||
echo "File taos.tar.gz does not exist"
|
echo "File taos.tar.gz does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
install_jemalloc
|
||||||
tar -zxf taos.tar.gz
|
tar -zxf taos.tar.gz
|
||||||
|
|
||||||
# Check if version compatible
|
# Check if version compatible
|
||||||
|
@ -822,7 +823,6 @@ function update_TDengine() {
|
||||||
install_log
|
install_log
|
||||||
install_header
|
install_header
|
||||||
install_lib
|
install_lib
|
||||||
install_jemalloc
|
|
||||||
if [ "$pagMode" != "lite" ]; then
|
if [ "$pagMode" != "lite" ]; then
|
||||||
install_connector
|
install_connector
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -752,6 +752,7 @@ function update_PowerDB() {
|
||||||
echo "File power.tar.gz does not exist"
|
echo "File power.tar.gz does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
install_jemalloc
|
||||||
tar -zxf power.tar.gz
|
tar -zxf power.tar.gz
|
||||||
|
|
||||||
# Check if version compatible
|
# Check if version compatible
|
||||||
|
@ -790,7 +791,6 @@ function update_PowerDB() {
|
||||||
install_log
|
install_log
|
||||||
install_header
|
install_header
|
||||||
install_lib
|
install_lib
|
||||||
install_jemalloc
|
|
||||||
if [ "$pagMode" != "lite" ]; then
|
if [ "$pagMode" != "lite" ]; then
|
||||||
install_connector
|
install_connector
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -210,7 +210,7 @@ function install_lib() {
|
||||||
${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
|
${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if [ "$verMode" == "cluster" ]; then
|
#if [ "$verMode" == "cluster" ]; then
|
||||||
# # Compatible with version 1.5
|
# # Compatible with version 1.5
|
||||||
# ${csudo} mkdir -p ${v15_java_app_dir}
|
# ${csudo} mkdir -p ${v15_java_app_dir}
|
||||||
# ${csudo} ln -s ${install_main_dir}/connector/taos-jdbcdriver-1.0.2-dist.jar ${v15_java_app_dir}/JDBCDriver-1.0.2-dist.jar
|
# ${csudo} ln -s ${install_main_dir}/connector/taos-jdbcdriver-1.0.2-dist.jar ${v15_java_app_dir}/JDBCDriver-1.0.2-dist.jar
|
||||||
|
@ -227,6 +227,52 @@ function install_header() {
|
||||||
${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_jemalloc() {
|
||||||
|
jemalloc_dir=${script_dir}/jemalloc
|
||||||
|
|
||||||
|
if [ -d ${jemalloc_dir} ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/bin
|
||||||
|
|
||||||
|
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
|
||||||
|
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/lib
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
|
||||||
|
${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/lib
|
||||||
|
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
|
||||||
|
${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
|
||||||
|
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
|
||||||
|
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
|
||||||
|
fi
|
||||||
|
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
|
||||||
|
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
|
||||||
|
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function add_newHostname_to_hosts() {
|
function add_newHostname_to_hosts() {
|
||||||
localIp="127.0.0.1"
|
localIp="127.0.0.1"
|
||||||
OLD_IFS="$IFS"
|
OLD_IFS="$IFS"
|
||||||
|
@ -245,7 +291,7 @@ function add_newHostname_to_hosts() {
|
||||||
|
|
||||||
function set_hostname() {
|
function set_hostname() {
|
||||||
echo -e -n "${GREEN}Please enter one hostname(must not be 'localhost')${NC}:"
|
echo -e -n "${GREEN}Please enter one hostname(must not be 'localhost')${NC}:"
|
||||||
read newHostname
|
read newHostname
|
||||||
while true; do
|
while true; do
|
||||||
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then
|
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then
|
||||||
break
|
break
|
||||||
|
@ -343,39 +389,39 @@ function set_ipAsFqdn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function local_fqdn_check() {
|
function local_fqdn_check() {
|
||||||
#serverFqdn=$(hostname)
|
#serverFqdn=$(hostname)
|
||||||
echo
|
|
||||||
echo -e -n "System hostname is: ${GREEN}$serverFqdn${NC}"
|
|
||||||
echo
|
|
||||||
if [[ "$serverFqdn" == "" ]] || [[ "$serverFqdn" == "localhost" ]]; then
|
|
||||||
echo -e -n "${GREEN}It is strongly recommended to configure a hostname for this machine ${NC}"
|
|
||||||
echo
|
echo
|
||||||
|
echo -e -n "System hostname is: ${GREEN}$serverFqdn${NC}"
|
||||||
|
echo
|
||||||
|
if [[ "$serverFqdn" == "" ]] || [[ "$serverFqdn" == "localhost" ]]; then
|
||||||
|
echo -e -n "${GREEN}It is strongly recommended to configure a hostname for this machine ${NC}"
|
||||||
|
echo
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -r -p "Set hostname now? [Y/n] " input
|
read -r -p "Set hostname now? [Y/n] " input
|
||||||
if [ ! -n "$input" ]; then
|
if [ ! -n "$input" ]; then
|
||||||
set_hostname
|
set_hostname
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
case $input in
|
case $input in
|
||||||
[yY][eE][sS]|[yY])
|
[yY][eE][sS]|[yY])
|
||||||
set_hostname
|
set_hostname
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[nN][oO]|[nN])
|
[nN][oO]|[nN])
|
||||||
set_ipAsFqdn
|
set_ipAsFqdn
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Invalid input..."
|
echo "Invalid input..."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_config() {
|
function install_config() {
|
||||||
|
@ -552,14 +598,14 @@ function clean_service_on_systemd() {
|
||||||
${csudo} rm -f ${tarbitratord_service_config}
|
${csudo} rm -f ${tarbitratord_service_config}
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
nginx_service_config="${service_config_dir}/nginxd.service"
|
nginx_service_config="${service_config_dir}/nginxd.service"
|
||||||
if systemctl is-active --quiet nginxd; then
|
if systemctl is-active --quiet nginxd; then
|
||||||
echo "Nginx for TDengine is running, stopping it..."
|
echo "Nginx for TDengine is running, stopping it..."
|
||||||
${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
|
${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
|
||||||
fi
|
fi
|
||||||
${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
|
${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
|
||||||
${csudo} rm -f ${nginx_service_config}
|
${csudo} rm -f ${nginx_service_config}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# tq:2345:respawn:/etc/init.d/tqd start
|
# tq:2345:respawn:/etc/init.d/tqd start
|
||||||
|
@ -643,7 +689,7 @@ function install_service_on_systemd() {
|
||||||
${csudo} systemctl enable nginxd
|
${csudo} systemctl enable nginxd
|
||||||
fi
|
fi
|
||||||
${csudo} systemctl start nginxd
|
${csudo} systemctl start nginxd
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_service() {
|
function install_service() {
|
||||||
|
@ -706,6 +752,7 @@ function update_tq() {
|
||||||
echo "File tq.tar.gz does not exist"
|
echo "File tq.tar.gz does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
install_jemalloc
|
||||||
tar -zxf tq.tar.gz
|
tar -zxf tq.tar.gz
|
||||||
|
|
||||||
# Check if version compatible
|
# Check if version compatible
|
||||||
|
@ -754,7 +801,7 @@ function update_tq() {
|
||||||
install_config
|
install_config
|
||||||
|
|
||||||
openresty_work=false
|
openresty_work=false
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
# Check if openresty is installed
|
# Check if openresty is installed
|
||||||
# Check if nginx is installed successfully
|
# Check if nginx is installed successfully
|
||||||
if type curl &> /dev/null; then
|
if type curl &> /dev/null; then
|
||||||
|
@ -765,7 +812,7 @@ function update_tq() {
|
||||||
echo -e "\033[44;31;5mNginx for TQ does not work! Please try again!\033[0m"
|
echo -e "\033[44;31;5mNginx for TQ does not work! Please try again!\033[0m"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#echo
|
#echo
|
||||||
#echo -e "\033[44;32;1mTQ is updated successfully!${NC}"
|
#echo -e "\033[44;32;1mTQ is updated successfully!${NC}"
|
||||||
|
@ -808,7 +855,7 @@ function install_tq() {
|
||||||
|
|
||||||
echo -e "${GREEN}Start to install TQ...${NC}"
|
echo -e "${GREEN}Start to install TQ...${NC}"
|
||||||
|
|
||||||
install_main_path
|
install_main_path
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
install_data
|
install_data
|
||||||
|
@ -817,6 +864,7 @@ function install_tq() {
|
||||||
install_log
|
install_log
|
||||||
install_header
|
install_header
|
||||||
install_lib
|
install_lib
|
||||||
|
install_jemalloc
|
||||||
if [ "$pagMode" != "lite" ]; then
|
if [ "$pagMode" != "lite" ]; then
|
||||||
install_connector
|
install_connector
|
||||||
fi
|
fi
|
||||||
|
@ -862,23 +910,23 @@ function install_tq() {
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
if [ ! -z "$firstEp" ]; then
|
if [ ! -z "$firstEp" ]; then
|
||||||
tmpFqdn=${firstEp%%:*}
|
tmpFqdn=${firstEp%%:*}
|
||||||
substr=":"
|
substr=":"
|
||||||
if [[ $firstEp =~ $substr ]];then
|
if [[ $firstEp =~ $substr ]];then
|
||||||
tmpPort=${firstEp#*:}
|
tmpPort=${firstEp#*:}
|
||||||
else
|
else
|
||||||
tmpPort=""
|
tmpPort=""
|
||||||
fi
|
fi
|
||||||
if [[ "$tmpPort" != "" ]];then
|
if [[ "$tmpPort" != "" ]];then
|
||||||
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}"
|
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}"
|
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}"
|
||||||
fi
|
fi
|
||||||
echo -e "${GREEN_DARK}execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}to add this new node${NC}"
|
echo -e "${GREEN_DARK}execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}to add this new node${NC}"
|
||||||
echo
|
echo
|
||||||
elif [ ! -z "$serverFqdn" ]; then
|
elif [ ! -z "$serverFqdn" ]; then
|
||||||
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $serverFqdn${GREEN_DARK} to login into TQ server${NC}"
|
echo -e "${GREEN_DARK}To access TQ ${NC}: tq -h $serverFqdn${GREEN_DARK} to login into TQ server${NC}"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
echo -e "\033[44;32;1mTQ is installed successfully!${NC}"
|
echo -e "\033[44;32;1mTQ is installed successfully!${NC}"
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in New Issue