Using the efm utility
=====================

Failover Manager provides the ``efm`` utility to assist with cluster
management. The RPM installer adds the utility to the
``/usr/edb/efm-4.<x>/bin`` directory when you install Failover Manager.

efm allow-node
--------------

``efm allow-node <cluster_name> <address>``

Invoke the ``efm allow-node`` command to allow the specified node to
join the cluster. When invoking the command, provide the name of the
cluster and the IP address of the joining node.

This command must be invoked by efm, a member of the efm group, or root.

efm disallow-node
-----------------

``efm disallow-node <cluster_name> <address>``

Invoke the ``efm disallow-node`` command to remove the specified node
from the allowed hosts list and prevent the node from joining a cluster.
Provide the name of the cluster and the address of the node when calling
the ``efm disallow-node`` command. This command must be invoked by efm,
a member of the efm group, or root.

..  Note::
   If you removed the node from the cluster and aren't planning to add it again, you can use the  :ref:`efm reset-members <efm reset-members>`  command instead.

efm cluster-status
------------------

``efm cluster-status <cluster_name>``

Invoke the ``efm cluster-status`` command to display the status of a
Failover Manager cluster. For more information about the status report,
see :ref:`Monitoring a Failover Manager cluster <Monitoring a Failover Manager cluster>`  .

efm cluster-status-json
-----------------------

``efm cluster-status-json <cluster_name>``

Invoke the ``efm cluster-status-json`` command to display the status of
a Failover Manager cluster in JSON format. While the format of the
displayed information is different from the display generated by the
``efm cluster-status`` command, the information source is the same.

The following example is generated by querying the status of a healthy
cluster with three nodes:

.. code:: text

   {
       "nodes": {
           "172.16.144.176": {
               "type": "Witness",
               "db": "N\/A",
               "vip": "",
               "vip_active": false
           },
           "172.16.144.177": {
               "type": "Primary",
               "db": "UP",
               "vip": "",
               "vip_active  :   false"
               "xlogReceive :   0/14001478"
               "xlog    :   0/14001478"
               "xloginfo    :"
           },
           "172.16.144.180": {
               "type": "Standby",
               "db": "UP",
               "vip": "",
               "vip_active  :   false"
               "xlogReceive :   0/14001478"
               "xlog    :   0/14001478"
               "xloginfo    :"
           }
       },
       "allowednodes": [
           "172.16.144.177",
           "172.16.144.160",
           "172.16.144.180",
           "172.16.144.176"
       ],
       "membershipcoordinator": "172.16.144.177",
       "failoverpriority": [
           "172.16.144.180"
       ],
       "minimumstandbys": 0,
       "missingnodes": [],
       "messages": []
   }

efm encrypt
-----------

``efm encrypt <cluster_name> [--from-env]``

Invoke the ``efm encrypt`` command to encrypt the database password
before including the password in the cluster properties file. Include
the ``--from-env`` option to instruct Failover Manager to use the value
specified in the ``EFMPASS`` environment variable and execute without
user input. For more information, see :ref:`Encrypting your database password <Encrypting your database password>`  .

efm promote
-----------

``efm promote cluster_name [-switchover [-sourcenode <address>][-quiet][-noscripts]``

The ``efm promote`` command instructs Failover Manager to perform a
manual failover of standby to primary.

Attempt a manual promotion only during a maintenance window for your
database cluster and if the status command reports that all standbys in
the cluster are up to date with the primary.

Include the ``–switchover`` clause to promote a standby node and
reconfigure a primary node as a standby node. Include the
``-sourcenode`` keyword, and specify a node address to indicate the node
whose recovery settings to copy to the old primary node, which makes it
a standby. Include the ``-quiet`` keyword to suppress notifications
during the switchover process. Include the ``-noscripts`` keyword to
instruct Failover Manager not to invoke fencing or post-promotion
scripts.

This command must be invoked by efm, a member of the efm group, or root.

..  Note::
   This command instructs the service to ignore the value specified in the `auto.failover`  parameter in the cluster properties file.

efm reset-members
-----------------

``efm reset-members <cluster_name>``

Invoke the ``efm reset-members`` command to remove cached node addresses
from a Failover Manager cluster. Run this command after a node is
permanently removed from the cluster to prevent the cluster from trying
to connect to the removed node’s address. Running this command does the
following on each node in the cluster:

1. Resets the addresses in the ``.nodes`` file to the current cluster
   members. This occurs even if the ``stable.nodes.file`` property is
   set to ``true`` .

2. Updates the Allowed Node host list to include only the current
   members.

3. Disconnects all agents from each other briefly and then reconnects.

Running databases aren’t affected by this operation. After the operation
completes, you might need to update the standby priority list. See the
 :ref:`efm set-priority <efm set-priority>`  command for more information.

efm resume
----------

``efm resume <cluster_name>``

Invoke the ``efm resume`` command to resume monitoring a previously
stopped database. This command must be invoked by efm, a member of the
efm group, or root.

efm set-priority
----------------

``efm set-priority <cluster_name> <address> <priority>``

Invoke the ``efm set-priority`` command to assign a failover priority to
a standby node. The value specifies the order in which to use the node
in the event of a failover. This command must be invoked by efm, a
member of the efm group, or root.

Use the priority option to specify the place for the node in the
priority list. For example, specify a value of ``1`` to indicate that
the node is the primary standby and will be the first node promoted in
the event of a failover. A priority value of ``0`` instructs Failover
Manager not to promote the standby.

efm stop-cluster
----------------

``efm stop-cluster <cluster_name>``

Invoke the ``efm stop-cluster`` command to stop Failover Manager on all
nodes. This command instructs Failover Manager to connect to each node
on the cluster and instruct the existing members to shut down. The
command has no effect on running databases, but when the command
completes, there’s no failover protection in place.

..  Note::
   When you invoke the `efm stop-cluster`  command, all authorized node information is removed from the Allowed Node host list.

This command must be invoked by efm, a member of the efm group, or root.

efm upgrade-conf
----------------

``efm upgrade-conf <cluster_name> [-source <directory>]``

Invoke the ``efm upgrade-conf`` command to copy the configuration files
from an existing Failover Manager installation and add parameters
required by a Failover Manager installation. Provide the name of the
previous cluster when invoking the utility. This command must be invoked
with superuser privileges if you’re running Failover Manager in the
default mode.

For information on the optional ``-source`` flag, or if you’re upgrading
from a Failover Manager configuration that doesn’t use sudo, see
 :ref:`Upgrading Failover Manager in Eager Failover mode <Upgrading Failover Manager in Eager Failover mode>`  .

efm node-status-json
--------------------

``efm node-status-json <cluster_name>``

Invoke the ``efm node-status-json`` command to display the status of a
local node in JSON format. A successful execution of this command
returns ``0`` as its exit code. In case of a database failure or an
agent status becoming IDLE, the command returns ``1`` as exit code.

The following is an example output of the ``efm node-status-json``
command:

.. code:: text

   {
     "type":"Standby",
     "address":"172.16.144.130",
     "db":"UP",
     "vip":"",
     "vip_active":"false"
    }

efm –help
---------

``efm --help``

Invoke the ``efm --help`` command to display online help for the
Failover Manager utility commands.
