From 1242ae5e1edf285764da12c40c27f1eea15d1c18 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Thu, 30 Jul 2020 19:49:26 +0800 Subject: [PATCH] [modify] --- packaging/tools/install.sh | 125 +++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 67 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 47a8febe35..aee4bbadf6 100644 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -31,7 +31,7 @@ install_main_dir="/usr/local/taos" bin_dir="/usr/local/taos/bin" # v1.5 jar dir -v15_java_app_dir="/usr/local/lib/taos" +#v15_java_app_dir="/usr/local/lib/taos" service_config_dir="/etc/systemd/system" nginx_port=6060 @@ -189,19 +189,19 @@ function install_bin() { function install_lib() { # Remove links ${csudo} rm -f ${lib_link_dir}/libtaos.* || : - ${csudo} rm -rf ${v15_java_app_dir} || : + #${csudo} rm -rf ${v15_java_app_dir} || : ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/* ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so - if [ "$verMode" == "cluster" ]; then - # Compatible with version 1.5 - ${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} chmod 777 ${v15_java_app_dir} || : - fi + #if [ "$verMode" == "cluster" ]; then + # # Compatible with version 1.5 + # ${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} chmod 777 ${v15_java_app_dir} || : + #fi } function install_header() { @@ -223,42 +223,39 @@ function install_config() { ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg - if [ "$verMode" == "cluster" ]; then - [ ! -z $1 ] && return 0 || : # only install client + [ ! -z $1 ] && return 0 || : # only install client - if ((${update_flag}==1)); then - return 0 - fi - - if [ "$interactiveFqdn" == "no" ]; then - return 0 - fi - - #FQDN_FORMAT="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" - #FQDN_FORMAT="(:[1-6][0-9][0-9][0-9][0-9]$)" - #PORT_FORMAT="(/[1-6][0-9][0-9][0-9][0-9]?/)" - #FQDN_PATTERN=":[0-9]{1,5}$" + if ((${update_flag}==1)); then + return 0 + fi + + if [ "$interactiveFqdn" == "no" ]; then + return 0 + fi - # first full-qualified domain name (FQDN) for TDengine cluster system - echo - echo -e -n "${GREEN}Enter FQDN:port (like h1.taosdata.com:6030) of an existing TDengine cluster node to join OR leave it blank to build one${NC} :" - read firstEp - while true; do - if [ ! -z "$firstEp" ]; then - # check the format of the firstEp - #if [[ $firstEp == $FQDN_PATTERN ]]; then - # Write the first FQDN to configuration file - ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg - break - #else - # read -p "Please enter the correct FQDN:port: " firstEp - #fi - else + #FQDN_FORMAT="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + #FQDN_FORMAT="(:[1-6][0-9][0-9][0-9][0-9]$)" + #PORT_FORMAT="(/[1-6][0-9][0-9][0-9][0-9]?/)" + #FQDN_PATTERN=":[0-9]{1,5}$" + + # first full-qualified domain name (FQDN) for TDengine cluster system + echo + echo -e -n "${GREEN}Enter FQDN:port (like h1.taosdata.com:6030) of an existing TDengine cluster node to join OR leave it blank to build one${NC} :" + read firstEp + while true; do + if [ ! -z "$firstEp" ]; then + # check the format of the firstEp + #if [[ $firstEp == $FQDN_PATTERN ]]; then + # Write the first FQDN to configuration file + ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg break - fi - done - - fi + #else + # read -p "Please enter the correct FQDN:port: " firstEp + #fi + else + break + fi + done } @@ -563,12 +560,11 @@ function update_TDengine() { if [ -z $1 ]; then install_bin install_service - install_config + install_config + openresty_work=false if [ "$verMode" == "cluster" ]; then # Check if openresty is installed - openresty_work=false - # Check if nginx is installed successfully if type curl &> /dev/null; then if curl -sSf http://127.0.0.1:${nginx_port} &> /dev/null; then @@ -580,8 +576,8 @@ function update_TDengine() { fi fi - echo - echo -e "\033[44;32;1mTDengine is updated successfully!${NC}" + #echo + #echo -e "\033[44;32;1mTDengine is updated successfully!${NC}" echo echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg" if ((${service_mod}==0)); then @@ -592,15 +588,12 @@ function update_TDengine() { echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}" fi - if [ "$verMode" == "cluster" ]; then - if [ ${openresty_work} = 'true' ]; then - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}" - else - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" - fi + if [ ${openresty_work} = 'true' ]; then + echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}" else - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" + echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" fi + echo echo -e "\033[44;32;1mTDengine is updated successfully!${NC}" else @@ -643,8 +636,8 @@ function install_TDengine() { install_bin install_service - if [ "$verMode" == "cluster" ]; then - openresty_work=false + openresty_work=false + if [ "$verMode" == "cluster" ]; then # Check if nginx is installed successfully if type curl &> /dev/null; then if curl -sSf http://127.0.0.1:${nginx_port} &> /dev/null; then @@ -669,21 +662,19 @@ function install_TDengine() { echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}" else echo -e "${GREEN_DARK}To start TDengine ${NC}: taosd${NC}" + fi + + if [ ${openresty_work} = 'true' ]; then + echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}" + else + echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" fi - if [ "$verMode" == "cluster" ]; then - if [ ${openresty_work} = 'true' ]; then - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}" - else - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" - fi - else - echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}" + if [ ! -z "$firstEp" ]; then + echo + echo -e "${GREEN_DARK}Please run${NC}: taos -h $firstEp ${GREEN_DARK} to login into cluster, then execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}in TAOS shell to add this new node into the clsuter${NC}" + echo fi - - echo - echo -e "${GREEN_DARK}Please run${NC}: taos -h $firstEp ${GREEN_DARK} to login into cluster, then execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}in TAOS shell to add this new node into the clsuter${NC}" - echo echo -e "\033[44;32;1mTDengine is installed successfully!${NC}" echo else # Only install client -- GitLab