HA Installation - 2 node setup

Requirements :


We assume that user is performing the below set in infoworks version 2.5.X or below

We also assume that end user has access to all the 2 edge nodes as a infoworks user and has rights to generate ssh key, has a home directory(/home/infoworks/) and also to /opt/  path.

  1. Stop all infoworks services on both machines

    cd $IW_HOME/bin
    source env.sh
    ./stop.sh orchestrator all mongo
    #Check all services are stopped

  1. Setup Keyless SSH between active and passive machines:

    To check if keyless ssh is working correctly(Imp do not use -i keyfile option):

    ssh infoworksuser@ip_address_of_1st_machine

    If ssh works, all ok, jump to step 3.
    If ssh does not work, follow these instructions:

    On both machines run:

    cd /home/[infoworksuser]/
    cd /home/[infoworksuser]/.ssh/
    touch authorized_keys
    chmod 600 authorized_keys

    IMP: Copy the contents of Active machine (public key)


    INTO Passive machine


    Similarly copy the files from passive to active

  2. Update PIP on both machines

    cd  $IW_HOME/bin
    source env.sh
    pip install --upgrade pip

  3. On both machines, create the following file:


    Contents of this file should be AlphaNumeric password string about 10 chars and it should be same on both servers (this is like a password for mongo sync)

    chmod 400 IW_HOME/conf/mongoKey

  4. On active machine:

    vi IW_HOME/resources/mongodb/conf/mongodb.conf

    Edit the following:
    Turn off security:


# Turn on/off security.  Off is currently the default




# Turn on/off security.  Off is currently the default





#keyFile=...  (if key is missing add it)



Now proceed and start  the Mongo services

cd IW_HOME/bin

./start.sh mongo

source env.sh

mongo admin    #open mongo admin db

> db.createUser(


   user: "iw-ha",

   pwd: "IN11**rk",

   roles: [ "clusterAdmin" ]


after the above steps are completed, stop the mongo 

./stop.sh mongo

   6. On Passive machine

vi IW_HOME/resources/mongodb/conf/mongodb.conf

Edit the following:


#keyFile=...  (if key is missing add it)





Install HA:

On Passive Machine:

cd $IW_HOME/bin

wget https://s3.amazonaws.com/infoworks-resources/tmp/scripts/install-ha.sh -O install-ha.sh  

This script will create a HA directory inside $IW_HOME/ directory 

Execute the below command in $IW_HOME/bin/ path

bash install-ha.sh

After the execution gets completed please navigate to the below directory and make copy of the file as shown

cd $IW_HOME/conf/

cp ha.conf.default  ha.conf

We have made duplicate file of ha.conf.default as ha.conf now edit that file

vi ha.conf

Read the comments and fill in all configurations, see below for sample ha.conf file

IMP: For hostname, use hostname -f command

The HA configurations are stored in IW_HOME/conf/ha.conf, please edit ac required to modify the settings as highlighted below:



# hostname of the server, string
# Each server should be accessible by the other using the hostname
host1_hostname=1st_MACHINE’s hostname
# type - local/remote
# Local implies the installation is on the same node as the HA tool
# Remote implies the installation is on a different node but accessible via ssh
# role of the installation - active/passive
# During failover, the HA tool automatically modifies this value
# Infoworks services are running on host1 in this case so set the role to active
#SSH login details
# IW_HOME value for this host
# Node on which HA is installed in this case.
# During failover, if all services on the failing active node do not stop,
# The failover is halted and the following script will be executed
# The output the of the script will stored in the configured log folder
# If any service is not used and is stopped at all times, HA can be configured to ignore this service
# comma separated string of Component Names (as shown in output status.sh), spaces are acceptable

Start All services

Login to 1st machine(Active machine ) as Infoworks user and perform the below steps

cd $IW_HOME/bin
Source env.sh

Login to 2nd machine(Passive Machine) as Infoworks user and perform the below steps

cd $IW_HOME/bin
Source env.sh
./start-passive [1st_machine_hostname]

On the 2nd machine(passive machine):

cd $IW_HOME/bin
vi start.sh

[please comment the below mentioned lines(First 3 Lines and last line)


#if [ ${is_process_running} == true ]; then
#  echo "Process like HA Service is already running"
echo -e "Starting HA Service" | tee -a ${LOG_FILE} INFOWORKS_LOGS_BASE_PATH=`grep -v '^#' ${CONF_PROPS}| grep -o 'iw_logs_base_dir=.*' | cut -d '=' -f 2`
  mkdir -p ${HA_LOGS_DIR}
if [ -f "${HA_OUT_FILE}" ]; then
NOW=$(date "+%F-%T")
mv "${HA_OUT_FILE}" "${HA_OUT_FILE}-${NOW}"
export IW_HA_CONF=${IW_HOME}/conf/ha.conf
export IW_HA_LOG=${HA_LOGS_DIR}/ha.log
 export IW_MONGO_CONF=${IW_HOME}/resources/mongodb/conf/mongodb.conf
export IW_MONGO_HOME=${IW_HOME}/resources/mongodb
pushd ${IW_HOME}/HA >> ${LOG_FILE}
nohup python2.7 main.py &> ${HA_OUT_FILE} & echo $! > ${IW_HOME}/HA/ha.pid
echo $! > ha_pid
popd >> ${LOG_FILE

After making changes, please save the file and exit from vi editor.

Navigate to $IW_HOME/bin

cd $IW_HOME/bin
Source env.sh
./start.sh ha

After the above settings in 2nd machine(HA machine) only HA should be running.

User can validate the running process by running the below command

cd $IW_HOME/bin

User can see the logs for HA components in $IW_HOME/logs/ha/ha.log and $IW_HOME/logs/ha/ha.out