[Pacemaker] Running remote SSH commands on another server?

Michael Monette mmonette at 2keys.ca
Fri Jan 31 14:16:42 UTC 2014


It really doesn't matter. It's just testing and I just wanted to show an example of what sorta thing I was after.

I will check out that MailTo agent though, thanks for that :)

Mike


----- Original Message -----
From: "Frank Brendel" <Frank.Brendel at eurolog.com>
To: pacemaker at oss.clusterlabs.org
Sent: Friday, January 31, 2014 5:39:11 AM
Subject: Re: [Pacemaker] Running remote SSH commands on another server?

Are you aware that the script returns 0 in case that the ssh command fails?

You can test your script as described here
http://clusterlabs.org/doc/en-US/Pacemaker/1.1-plugin/html/Pacemaker_Explained/ap-lsb.html

A better method would be to write your own resource agent.
Have a look at the MailTo agent. Instead of sending an email it could 
execute your ssh command.


Frank


Am 30.01.2014 19:56, schrieb Michael Monette:
> I solved my problem by making some hacktacular LSB script called "proxyres".
>
> When I run a "service proxyres start", it SSHes and runs those restart commands on the Proxy.
> "service proxyres stop" simply exits with 0
> and service proxyres status will netcat a port, 0 success 3 for failure.
>
> It works..But hopefully there is a better method.
>
> Here is what it looks like just for fun:
>
> ######
>   
> [root at mail-2 ~] cat /etc/init.d/proxyres
> #!/bin/bash
> # Restart the gosh darn Proxy LSB script
> # chkconfig: 2345 80 05
> # description: RTGDP Script
>
> # RTGDP service controller script
> case "$1" in
>      start)
>          ssh -i "/root/.ssh/proxy_identity" proxy_user at 10.199.0.125 'service mta restart'
>          ;;
>      stop)
>          exit 0
>          ;;
>      status)
>          if nc -vz 10.199.0.125 443 > /dev/null
>          then
>          echo "Server is up"
>          true
>          else
>          echo "Server is down"
>          exit 3
>          fi
>          ;;
>      *)
>          echo "Usage: $0 {start|stop|status}"
>          exit 1
>          ;;
> esac
> exit 0
>
> ######
>
> Thanks,
>
> Mike
>
> ----- Original Message -----
> From: "Michael Monette" <mmonette at 2keys.ca>
> To: "The Pacemaker cluster resource manager" <pacemaker at oss.clusterlabs.org>
> Sent: Thursday, January 30, 2014 10:15:56 AM
> Subject: [Pacemaker] Running remote SSH commands on another server?
>
> Hello,
>
> I am coming up short in my searches, but I don't know exactly what I am searching for, hoping someone could point me in the right direction.
>
> I have Pacemaker setup in active/passive on my Email server. The systems are in sync using DRBD.
>
> When there is a failure on node-1, everything fails over to node-2 and vice versa. Everything actually works great.
>
> I have the mail servers sitting behind a proxy, which is also the MTA. The problem is, whenever the mailstores failover, there is a persistent connection going from the Proxy -> Mailstore that breaks, and any incoming/outgoing mail cannot be delivered even though the email server is back up. To fix this, I need to SSH into the proxy and restart the proxy services to re-establish that persistent connection.
>
> Is there any way to include this as part of the failover in PaceMaker?
>
> Something like:
>
> <**Failure occured on mail-1**>
> mount DRBD resources on mail-2
> Assign the failover-ip to mail-2
> Start the email server on mail-2
> SSH into the proxy and restart the proxy service (From mail-2 using keys)
>
> I am researching ways within the application itself to fix this problem, but no luck yet.
>
> Thanks for any help,
>
> Mike
>
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org


_______________________________________________
Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list