Merge branch 'ent-10847-modo-standby-en-vista-ha' into 'develop'
Ent-10847-modo-standby-en-vista-ha Closes pandora_enterprise#10847 See merge request artica/pandorafms!6302
This commit is contained in:
commit
c31c8d899f
|
@ -417,6 +417,17 @@ sub ha_database_connect_pandora($) {
|
||||||
|
|
||||||
# Select a new master database.
|
# Select a new master database.
|
||||||
my ($dbh, $utimestamp, $max_utimestamp) = (undef, undef, -1);
|
my ($dbh, $utimestamp, $max_utimestamp) = (undef, undef, -1);
|
||||||
|
|
||||||
|
my @disabled_nodes = get_disabled_nodes($conf);
|
||||||
|
|
||||||
|
# If there are disabled nodes ignore them from the HA_DB_Hosts.
|
||||||
|
if(scalar @disabled_nodes ne 0){
|
||||||
|
@HA_DB_Hosts = grep { my $item = $_; !grep { $_ eq $item } @disabled_nodes } @HA_DB_Hosts;
|
||||||
|
|
||||||
|
my $data = join(",", @disabled_nodes);
|
||||||
|
log_message($conf, 'LOG', "Ignoring disabled hosts: " . $data);
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $ha_dbhost (@HA_DB_Hosts) {
|
foreach my $ha_dbhost (@HA_DB_Hosts) {
|
||||||
|
|
||||||
# Retry each database ha_connect_retries times.
|
# Retry each database ha_connect_retries times.
|
||||||
|
@ -507,6 +518,36 @@ sub ha_restart_pandora($) {
|
||||||
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
|
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Get ip of the disabled nodes.
|
||||||
|
###############################################################################
|
||||||
|
sub get_disabled_nodes($) {
|
||||||
|
my ($conf) = @_;
|
||||||
|
|
||||||
|
my $dbh = db_connect('mysql',
|
||||||
|
$conf->{'dbname'},
|
||||||
|
$conf->{'dbhost'},
|
||||||
|
$conf->{'dbport'},
|
||||||
|
$conf->{'ha_dbuser'},
|
||||||
|
$conf->{'ha_dbpass'});
|
||||||
|
|
||||||
|
my $disabled_nodes = get_db_value($dbh, "SELECT value FROM tconfig WHERE token = 'ha_disabled_nodes'");
|
||||||
|
|
||||||
|
if(!defined($disabled_nodes) || $disabled_nodes eq ""){
|
||||||
|
$disabled_nodes = ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
my @disabled_nodes = split(',', $disabled_nodes);
|
||||||
|
|
||||||
|
if(scalar @disabled_nodes ne 0){
|
||||||
|
$disabled_nodes = join(",", @disabled_nodes);
|
||||||
|
@disabled_nodes = get_db_rows($dbh, "SELECT host FROM tdatabase WHERE id IN ($disabled_nodes)");
|
||||||
|
@disabled_nodes = map { $_->{host} } @disabled_nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @disabled_nodes;
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Main (Pacemaker)
|
# Main (Pacemaker)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
Loading…
Reference in New Issue