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

Fix #2017, support debug mode for master server, standby server, agent #2020

Merged
merged 7 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ function init_command() {
ALLOW_DAEMON_OPT=true
export SMART_LOG_FILE_NAME=${SMART_AGENT_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_AGENT_JAVA_OPT}"
SMART_VARGS+=" -D smart.agent.address="${SSM_EXEC_HOST}
Expand Down
11 changes: 9 additions & 2 deletions bin/start-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ while [ $# != 0 ]; do
shift
;;
"--debug")
DEBUG_OPT="$1"
DEBUG_OPT_AGENT="$1"
shift
;;
"--help" | "-h")
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
;;
"--help" | "-h")
Expand Down Expand Up @@ -76,5 +83,5 @@ echo "Starting SmartAgents on [${AGENT_HOSTS}]"
--remote \
--config "${SMART_CONF_DIR}" \
--hosts "${AGENT_HOSTS}" --hostsend \
--daemon start ${DEBUG_OPT} \
--daemon start ${DEBUG_OPT_AGENT} \
smartagent -D smart.agent.master.address=${AGENT_MASTER}
34 changes: 28 additions & 6 deletions bin/start-ssm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,29 @@ while [ $# != 0 ]; do
shift
;;
"--debug")
DEBUG_OPT=$1
DEBUG=$1
shift
case "$1" in
"master")
DEBUG_OPT_MASTER="$DEBUG"
shift
;;
"standby")
DEBUG_OPT_STANDBY="$DEBUG"
shift
;;
"agent")
DEBUG_OPT_AGENT="$DEBUG"
shift
;;
*)
esac
shift
;;
"--help" | "-h")
echo -e "--help -h Show this usage information\n\
--config Specify or overwrite an configure option.\n\
-format Format the configured database."
shift
;;
"--help" | "-h")
Expand Down Expand Up @@ -77,12 +99,12 @@ if [ x"${SMARTSERVERS}" != x"" ]; then
--remote \
--config "${SMART_CONF_DIR}" \
--hosts "${FIRST_MASTER}" --hostsend \
--daemon start ${DEBUG_OPT} \
--daemon start ${DEBUG_OPT_MASTER} \
smartserver $SMART_VARGS

if [ x"${SMARTSERVERS}" != x"${FIRST_MASTER}" ]; then
OTHER_MASTERS=${SMARTSERVERS/${FIRST_MASTER} /}
if [ x"${DEBUG_OPT}" != x"" ]; then
if [ x"${DEBUG_OPT_MASTER}" != x"" ]; then
echo
echo " Please attach to SmartServer@${FIRST_MASTER} and resume the execution first!!"
read -n1 -s -p " And then hit any key to continue ... "
Expand All @@ -96,7 +118,7 @@ if [ x"${SMARTSERVERS}" != x"" ]; then
--remote \
--config "${SMART_CONF_DIR}" \
--hosts "${OTHER_MASTERS}" --hostsend \
--daemon start \
--daemon start ${DEBUG_OPT_STANDBY} \
smartserver $SMART_VARGS_STANDBY
fi
else
Expand All @@ -116,7 +138,7 @@ if [ -f "${AGENTS_FILE}" ]; then

if [ x"${AGENT_HOSTS}" != x"" ]; then
. "${SMART_HOME}"/bin/start-agent.sh \
--host "${AGENT_HOSTS}" \
"$@"
--host "${AGENT_HOSTS}" \
"$@"
fi
fi
4 changes: 4 additions & 0 deletions docs/ssm-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ Enter into ${SMART_HOME} directory for running SSM. You can type `./bin/ssm vers
`--config <config-dir>` can be used to specify where the config directory is.
`${SMART_HOME}/conf` is the default config directory if the config option is not used.

`--debug [master] [standby] [agent]` can be used to debug different targets.

If Smart Agents are configured, the start script will start the Agents one by one remotely.

Once you start the SSM server, you can open its web UI by
Expand All @@ -198,6 +200,8 @@ Enter into ${SMART_HOME} directory for running SSM. You can type `./bin/ssm vers

`./bin/start-agent.sh [--host .. --config ..]`

`--debug` can be used to debug smart agent.

`--help` `-h` Show the usage information.

If the host option is not used, localhost is the default one. You should put the hostname specified or localhost in conf/agents.
Expand Down