Switching the master server on Linux systems

By default, server 0 (zero) is the master server.

To switch the master to another server, set the deployment option masterDatabaseServerID to the other server ID as follows:

  1. From the /opt/BESServer/bin command prompt, start the command line:
    ./iem login --server=servername:serverport --user=username --password=password
  2. From the /opt/BESServer/bin command prompt, run the following command:
     ./iem get admin/fields > /appo/switchmaster.xml 
  3. In the /appo/switchmaster.xml file, add or edit the following keyword and its value:
      <Name>masterDatabaseServerID<Name>
      <Value>0</Value>
    to switch the master server to another master server:
    <?xml version="1.0" encoding="UTF-8"?>
    <BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:noNamespaceSchemaLocation="BESAPI.xsd">
        <AdminField Resource="http://9.87.126.68:52311/api/admin/field
         /masterDatabaseServerID">
           <Name>masterDatabaseServerID</Name>
           <Value>3</Value>
        </AdminField>
    </BESAPI>
  4. Upload the modified file by running the following command:
     ./iem post /appo/switchmaster.xml admin/fields

After the value has successfully replicated to the new server, it become the master server. If a server suffers a failure while it is the master, another server must be made the master server by direct manipulation of the ADMINFIELDS table in the database.