How do you manually call fencing agents from the commandline?
Environment
- Red Hat Enterprise Linux Server 5 (with the High Availability Add on)
- Red Hat Enterprise Linux Server 6 (with the High Availability Add on)
Issue
- How do you manually call fencing agents from the command line?
Resolution
There are three ways to execute a fence agent script. These 3 methods will attempt to reboot a particular machine with the fence device:
-
Call the fence agent with command line args for the particular fence device script which is located in /sbin/fence_* or */usr/sbin/fence_**.
$ fence_ipmilan -a 192.168.1.42 -l <username> -p <password> -o reboot -
Call the fence agent by piping stdin into the fence agents. Calling the fence agent and piping stdin into the agent can be accomplished a couple ways:
-
Redirection with file contents:
$ cat /tmp/fence_ipmilan-args ipaddr=192.168.1.42 login=<username> password=<password> action=reboot $ fence_ipmilan < /tmp/fence_ipmilan-args -
Echo a string via stdin into the fence agent:
$ echo -e "ipaddr=192.168.1.42 \nlogin=<username> \npasswd=<password> \naction=reboot" | fence_ipmilan
-
-
Call fence_node which will use the /etc/cluster/cluster.conf as arguments for the fence_agent.
-
The /etc/cluster/cluster.conf has the following arguments(some of the cluster.conf has been left out):
<?xml version="1.0"?> <cluster config_version="1" name="cs-rh6cluster"> .... <clusternodes> <clusternode name="rhnode1.examplerh.com" nodeid="1"> <fence> <method name="1"> <device name="rh5node1_ipmi"/> </method> </fence> </clusternode> .... </clusternodes> .... <fencedevices> <fencedevice agent="fence_ipmilan" ipaddr="192.168.1.42" login="username" name="rh5node1_ipmi" passwd="password"/> </fencedevices> .... </cluster> -
The command that will be used to fence the node is:
$ fence_node rh5node1.examplerh.com
-
For more information, see the tech brief at https://access.redhat.com/knowledge/techbriefs/fencing-red-hat-enterprise-linux-methods-use-cases-and-failover.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.