Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Fix #2022, Support master and standby server on a single node #2027

Merged
merged 8 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# limitations under the License.
#

export SMART_SERVER_LOG_FILE_NAME=smartserver-$(hostname)-$(whoami).log
export SMART_SERVER_LOG_FILE_NAME=smartserver-master-$(hostname)-$(whoami).log
export SMART_STANDBY_LOG_FILE_NAME=smartserver-standby-$(hostname)-$(whoami).log
export SMART_AGENT_LOG_FILE_NAME=smartagent-$(hostname)-$(whoami).log
export SMART_LOG_FILE_NAME=${SMART_SERVER_LOG_FILE_NAME}

Expand Down Expand Up @@ -314,6 +315,20 @@ function init_command() {
JAVA_OPST+=" ${SSM_JAVA_OPT} ${SSM_AGENT_JAVA_OPT}"
SMART_VARGS+=" -D smart.agent.address="${SSM_EXEC_HOST}
;;
standby)
SMART_CLASSNAME=org.smartdata.server.SmartDaemon
SMART_PID_FILE=/tmp/Standby.pid
ALLOW_DAEMON_OPT=true
export SMART_LOG_FILE_NAME=${SMART_STANDBY_LOG_FILE_NAME}
export SMART_LOG_FILE=${SMART_LOG_DIR}/${SMART_LOG_FILE_NAME}
if [ $SSM_DEBUG_ENABLED == "true" ]; then
JAVA_OPTS+=" -Xdebug -Xrunjdwp:transport=dt_socket,address=8008,server=y,suspend=y"
fi
JAVA_OPTS+=" -Dsmart.log.file="${SMART_LOG_FILE_NAME}
JAVA_OPST+=" ${SSM_JAVA_OPT} ${SSM_SERVER_JAVA_OPT}"
SMART_VARGS+=" -D smart.agent.master.address="${SSM_EXEC_HOST}
reorder_lib
;;
getconf)
SMART_CLASSNAME=org.smartdata.server.utils.tools.GetConf
;;
Expand Down
4 changes: 0 additions & 4 deletions bin/start-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ while [ $# != 0 ]; do
The default one is localhost. "
shift
;;
"--help" | "-h")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be kept.

echo -e "--help -h Show this usage information\n--config Specify or overwrite an configure option.\n--host Specify the host on which Smart Agent will be started by giving its hostname or IP. The default one is localhost. "
shift
;;
*)
break;
;;
Expand Down
6 changes: 1 addition & 5 deletions bin/start-ssm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ while [ $# != 0 ]; do
-format Format the configured database."
shift
;;
"--help" | "-h")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be kept.

echo -e "--help -h Show this usage information\n--config Specify or overwrite an configure option.\n-format Format the configured database."
shift
;;
*)
SMART_VARGS+=" $1"
shift
Expand Down Expand Up @@ -119,7 +115,7 @@ if [ x"${SMARTSERVERS}" != x"" ]; then
--config "${SMART_CONF_DIR}" \
--hosts "${OTHER_MASTERS}" --hostsend \
--daemon start ${DEBUG_OPT_STANDBY} \
smartserver $SMART_VARGS_STANDBY
standby $SMART_VARGS_STANDBY
fi
else
echo "ERROR: No SmartServers configured in 'servers'."
Expand Down
13 changes: 12 additions & 1 deletion bin/stop-ssm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,23 @@ if [ -f "${SERVERS_FILE}" ]; then

if [ x"${SMARTSERVERS}" != x"" ]; then
echo "Stopping SmartServers on [${SMARTSERVERS}]"
FIRST_MASTER=$(echo ${SMARTSERVERS} | awk '{print $1}')
. "${SMART_HOME}/bin/ssm" \
--remote \
--config "${SMART_CONF_DIR}" \
--hosts "${SMARTSERVERS}" --hostsend \
--hosts "${FIRST_MASTER}" --hostsend \
--daemon stop ${DEBUG_OPT} \
smartserver

if [ x"${SMARTSERVERS}" != x"${FIRST_MASTER}" ]; then
OTHER_MASTERS=${SMARTSERVERS/${FIRST_MASTER} /}
. "${SMART_HOME}/bin/ssm" \
--remote \
--config "${SMART_CONF_DIR}" \
--hosts "${OTHER_MASTERS}" --hostsend \
--daemon stop ${DEBUG_OPT} \
standby
fi
else
echo "No SmartServers configured in 'servers'."
fi
Expand Down
10 changes: 8 additions & 2 deletions docs/ssm-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ SSM will fetch the whole HDFS namespace when it starts by default. If you do not

## **Configure Smart Server**

SSM supports running multiple Smart Servers for high-availability. Only one of these Smart Servers can be in active state and provide services. One of the standby Smart Servers will take its place if the active Smart Server failed.
SSM supports running multiple Smart Servers for high-availability. Only one of these Smart Servers can be in active state and provide services. One of the standby Smart Servers will take its place if the active Smart Server failed.

SSM also supports running one standby server with master server on a single node.

Open `servers` file under ${SMART_HOME}/conf, put each server's hostname or IP address line by line. Lines start with '#' are treated as comments.

Expand Down Expand Up @@ -543,7 +545,11 @@ Note: To make the scripts work, you have to set up password-less SSH connections

# Trouble Shooting
---------------------------------------------------------------------------------
All logs will go to smartserver-$hostname-$user.log under ${SMART_HOME}/logs directory.
Logs for master server will go to smartserver-master-$hostname-$user.log under ${SMART_HOME}/logs directory.

Logs for standby server will go to smartserver-standy-$hostname-$user.log under ${SMART_HOME}/logs directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standy -> standby


Logs for agent will go to smartagent-$hostname-$user.log under ${SMART_HOME}/logs directory.

1. Smart Server can't start successfully

Expand Down