Can a web server determine if its active node is a HA fail-safe system without hard coding anything on the server itself?

I can think of several hacks using ping, the field name and the common name HA, but I think they lead to data leakage.

If the box even knows its part of the HA cluster, or what is the cluster name? Is this more of a DNS feature? Is there any API open for mailboxes to join the HA cluster and request the id of the current active node?

I want to distinguish between inactive node and active node in the notification mechanisms for the running program. If the active node warns that I want to get into the pager and in the inactive node, I want to send an email. Clicking a definition on the warning level moves the same problem elsewhere.

EASY DECISION: Polling the server from an external agent that connects through the network makes any shell game who is an active node a controversial point. To clarify this, the only thing the page will be on is the remote agent controlling the real one. Each inbox can send emails all day for everything I need.

+3
source share
4 answers

It really depends on the HA system used.

, IP-, - , , . ... , script , - , ping . script , ping < 2 ...

/ node, node , . , , , . , node (STONITH ), .

, , HA , / . , . HA , . Heartbeat .

, . , , , , :)

, / , , /. , , , . / / , . .

, DNS - - - .

+3

- , , . / ( ), / , , .

- DNS ( - ) . , , , . , , , .

, .

0

, HA , . , , . HA, . cronjob, , . script:

#!/bin/sh
HA_CLUSTER_IP=0.0.0.0
if ip addr | grep $HA_CLUSTER_IP >/dev/null; then
    eval "$@"
fi

( , Debian.) - , , ( 0.0.0.0 IP HA), , , script. , cronjobs.

, , , , .

UPDATE: HA Heartbeat IP- . , , , gethostbyname() , , IP- .

0

....? , - , . ifconfig, HA , . , HA eth0, eth0: 0, node.

Therefore, you can make a simple ifconfig output request to determine if the server supports an active node or not, for example, if eth0 was a configured interface:

ACTIVE_NODE=`ifconfig | grep -c 'eth0:0'`

This will set the $ ACTIVE_NODE variable to 1 (for active) and 0 (if in standby). Hope this helps.

http://www.of-networks.co.uk

0
source

Source: https://habr.com/ru/post/1705544/


All Articles