Added support to specify the FDB Cluster Text
Added support fo specify the number of ports from which to choose
Swapped tabs for spaces to make Marcus happy 😃
This commit is contained in:
parent
5d60663bbf
commit
40b51cbdbb
|
@ -7,7 +7,7 @@ SCRIPTID="${$}"
|
||||||
SAVEONERROR="${SAVEONERROR:-1}"
|
SAVEONERROR="${SAVEONERROR:-1}"
|
||||||
PYTHONDIR="${BINDIR}/tests/python"
|
PYTHONDIR="${BINDIR}/tests/python"
|
||||||
testScript="${BINDIR}/tests/bindingtester/run_binding_tester.sh"
|
testScript="${BINDIR}/tests/bindingtester/run_binding_tester.sh"
|
||||||
VERSION="1.8"
|
VERSION="1.9"
|
||||||
|
|
||||||
source ${SCRIPTDIR}/localClusterStart.sh
|
source ${SCRIPTDIR}/localClusterStart.sh
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ then
|
||||||
echo "Log dir: ${LOGDIR}"
|
echo "Log dir: ${LOGDIR}"
|
||||||
echo "Python path: ${PYTHONDIR}"
|
echo "Python path: ${PYTHONDIR}"
|
||||||
echo "Lib dir: ${LIBDIR}"
|
echo "Lib dir: ${LIBDIR}"
|
||||||
echo "Cluster String: ${CLUSTERSTRING}"
|
echo "Cluster String: ${FDBCLUSTERTEXT}"
|
||||||
echo "Script Id: ${SCRIPTID}"
|
echo "Script Id: ${SCRIPTID}"
|
||||||
echo "Version: ${VERSION}"
|
echo "Version: ${VERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,6 +6,7 @@ LOGDIR="${WORKDIR}/log"
|
||||||
ETCDIR="${WORKDIR}/etc"
|
ETCDIR="${WORKDIR}/etc"
|
||||||
BINDIR="${BINDIR:-${SCRIPTDIR}}"
|
BINDIR="${BINDIR:-${SCRIPTDIR}}"
|
||||||
FDBPORTSTART="${FDBPORTSTART:-4000}"
|
FDBPORTSTART="${FDBPORTSTART:-4000}"
|
||||||
|
FDBPORTTOTAL="${FDBPORTTOTAL:-1000}"
|
||||||
SERVERCHECKS="${SERVERCHECKS:-10}"
|
SERVERCHECKS="${SERVERCHECKS:-10}"
|
||||||
CONFIGUREWAIT="${CONFIGUREWAIT:-240}"
|
CONFIGUREWAIT="${CONFIGUREWAIT:-240}"
|
||||||
FDBCONF="${ETCDIR}/fdb.cluster"
|
FDBCONF="${ETCDIR}/fdb.cluster"
|
||||||
|
@ -18,18 +19,24 @@ status=0
|
||||||
messagetime=0
|
messagetime=0
|
||||||
messagecount=0
|
messagecount=0
|
||||||
|
|
||||||
# Define a random ip address and port on localhost
|
# Do nothing, if cluster string is already defined
|
||||||
if [ -z ${IPADDRESS} ]; then
|
if [ -n "${FDBCLUSTERTEXT}" ]
|
||||||
|
then
|
||||||
|
:
|
||||||
|
# Otherwise, define the cluster text
|
||||||
|
else
|
||||||
|
# Define a random ip address and port on localhost
|
||||||
|
if [ -z "${IPADDRESS}" ]; then
|
||||||
let index2="${RANDOM} % 256"
|
let index2="${RANDOM} % 256"
|
||||||
let index3="${RANDOM} % 256"
|
let index3="${RANDOM} % 256"
|
||||||
let index4="(${RANDOM} % 255) + 1"
|
let index4="(${RANDOM} % 255) + 1"
|
||||||
IPADDRESS="127.${index2}.${index3}.${index4}"
|
IPADDRESS="127.${index2}.${index3}.${index4}"
|
||||||
|
fi
|
||||||
|
if [ -z "${FDBPORT}" ]; then
|
||||||
|
let FDBPORT="(${RANDOM} % ${FDBPORTTOTAL}) + ${FDBPORTSTART}"
|
||||||
|
fi
|
||||||
|
FDBCLUSTERTEXT="${IPADDRESS}:${FDBPORT}"
|
||||||
fi
|
fi
|
||||||
if [ -z ${FDBPORT} ]; then
|
|
||||||
let FDBPORT="(${RANDOM} % 1000) + ${FDBPORTSTART}"
|
|
||||||
fi
|
|
||||||
CLUSTERSTRING="${IPADDRESS}:${FDBPORT}"
|
|
||||||
|
|
||||||
|
|
||||||
function log
|
function log
|
||||||
{
|
{
|
||||||
|
@ -171,7 +178,7 @@ function createClusterFile
|
||||||
else
|
else
|
||||||
description=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 8)
|
description=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 8)
|
||||||
random_str=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 8)
|
random_str=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 8)
|
||||||
echo "${description}:${random_str}@${CLUSTERSTRING}" > "${FDBCONF}"
|
echo "${description}:${random_str}@${FDBCLUSTERTEXT}" > "${FDBCONF}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${status}" -ne 0 ]; then
|
if [ "${status}" -ne 0 ]; then
|
||||||
|
@ -191,7 +198,7 @@ function stopCluster
|
||||||
|
|
||||||
# Add an audit entry, if enabled
|
# Add an audit entry, if enabled
|
||||||
if [ "${AUDITCLUSTER}" -gt 0 ]; then
|
if [ "${AUDITCLUSTER}" -gt 0 ]; then
|
||||||
printf '%-15s (%6s) Stopping cluster %-20s (%6s): %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "${$}" "${CLUSTERSTRING}" "${FDBSERVERID}" >> "${AUDITLOG}"
|
printf '%-15s (%6s) Stopping cluster %-20s (%6s): %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "${$}" "${FDBCLUSTERTEXT}" "${FDBSERVERID}" >> "${AUDITLOG}"
|
||||||
fi
|
fi
|
||||||
if [ -z "${FDBSERVERID}" ]; then
|
if [ -z "${FDBSERVERID}" ]; then
|
||||||
log 'FDB Server process is not defined'
|
log 'FDB Server process is not defined'
|
||||||
|
@ -199,7 +206,7 @@ function stopCluster
|
||||||
elif ! kill -0 "${FDBSERVERID}"; then
|
elif ! kill -0 "${FDBSERVERID}"; then
|
||||||
log "Failed to locate FDB Server process (${FDBSERVERID})"
|
log "Failed to locate FDB Server process (${FDBSERVERID})"
|
||||||
let status="${status} + 1"
|
let status="${status} + 1"
|
||||||
elif "${BINDIR}/fdbcli" -C "${FDBCONF}" --exec "kill; kill ${CLUSTERSTRING}; sleep 3" --timeout 120 &>> "${LOGDIR}/fdbcli-kill.log"
|
elif "${BINDIR}/fdbcli" -C "${FDBCONF}" --exec "kill; kill ${FDBCLUSTERTEXT}; sleep 3" --timeout 120 &>> "${LOGDIR}/fdbcli-kill.log"
|
||||||
then
|
then
|
||||||
# Ensure that process is dead
|
# Ensure that process is dead
|
||||||
if ! kill -0 "${FDBSERVERID}" 2> /dev/null; then
|
if ! kill -0 "${FDBSERVERID}" 2> /dev/null; then
|
||||||
|
@ -226,26 +233,22 @@ function startFdbServer
|
||||||
|
|
||||||
# Add an audit entry, if enabled
|
# Add an audit entry, if enabled
|
||||||
if [ "${AUDITCLUSTER}" -gt 0 ]; then
|
if [ "${AUDITCLUSTER}" -gt 0 ]; then
|
||||||
printf '%-15s (%6s) Starting cluster %-20s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "${$}" "${CLUSTERSTRING}" >> "${AUDITLOG}"
|
printf '%-15s (%6s) Starting cluster %-20s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "${$}" "${FDBCLUSTERTEXT}" >> "${AUDITLOG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${status}" -ne 0 ]; then
|
if ! displayMessage "Starting Fdb Server"
|
||||||
:
|
|
||||||
elif ! displayMessage "Starting Fdb Server"
|
|
||||||
then
|
then
|
||||||
log 'Failed to display user message'
|
log 'Failed to display user message'
|
||||||
let status="${status} + 1"
|
let status="${status} + 1"
|
||||||
|
|
||||||
else
|
else
|
||||||
"${BINDIR}/fdbserver" --knob_disable_posix_kernel_aio=1 -C "${FDBCONF}" -p "${CLUSTERSTRING}" -L "${LOGDIR}" -d "${WORKDIR}/fdb/${$}" &> "${LOGDIR}/fdbserver.log" &
|
"${BINDIR}/fdbserver" --knob_disable_posix_kernel_aio=1 -C "${FDBCONF}" -p "${FDBCLUSTERTEXT}" -L "${LOGDIR}" -d "${WORKDIR}/fdb/${$}" &> "${LOGDIR}/fdbserver.log" &
|
||||||
fdbpid=$!
|
if [ "${?}" -ne 0 ]
|
||||||
fdbrc=$?
|
|
||||||
if [ $fdbrc -ne 0 ]
|
|
||||||
then
|
then
|
||||||
log "Failed to start FDB Server"
|
log "Failed to start FDB Server"
|
||||||
let status="${status} + 1"
|
let status="${status} + 1"
|
||||||
else
|
else
|
||||||
FDBSERVERID="${fdbpid}"
|
FDBSERVERID="${!}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue