This file is indexed.

/usr/bin/masterha_conf_host is in mha4mysql-manager 0.53-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env perl

#  Copyright (C) 2011 DeNA Co.,Ltd.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#  Foundation, Inc.,
#  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

use strict;
use warnings FATAL => 'all';

use Getopt::Long;
use Pod::Usage;
use MHA::Config;

my $help;
my $version;
my $command;
my $conf;
my $block;
my $hostname;
my $params;

GetOptions(
  'help'       => \$help,
  'version'    => \$version,
  'command=s'  => \$command,
  'conf=s'     => \$conf,
  'block=s'    => \$block,
  'hostname=s' => \$hostname,
  'params=s'   => \$params,
);

if ($version) {
  print "masterha_conf_host version $MHA::ManagerConst::VERSION.\n";
  exit 0;
}

if ($help) {
  pod2usage(0);
}

if ( !$command ) {
  die "--command=<add|remove> must be set.\n";
}

if ( !$conf ) {
  die "--conf=<target_conf_file> must be set.\n";
}

if ( !-f $conf ) {
  die "$conf does not exist!\n";
}

if ($block) {
  if ( $block !~ m/^server/ ) {
    $block = "server" . $block;
  }
}
else {
  $block = "server_" . $hostname if ($hostname);
}
unless ($block) {
  die "--block=<block_name> must be set.\n";
}

if ( $command eq "add" ) {
  unless ($hostname) {
    die "--hostname=<new_host_name> must be set.\n";
  }
  my @param_array;
  if ($params) {
    @param_array = split( /;/, $params );
  }
  MHA::Config::add_block_and_save( $conf, $block, $hostname, \@param_array );
}
elsif ( $command eq "delete" || $command eq "remove" ) {
  MHA::Config::delete_block_and_save( $conf, $block );
}
else {
  pod2usage(1);
}

# ############################################################################
# Documentation
# ############################################################################

=pod

=head1 NAME

masterha_conf_host - Adding new host entry to, or removing existing host entry from a config file

=head1 SYNOPSIS

masterha_conf_host --command=add --conf=/etc/conf/masterha/app1.cnf --hostname=db101

 The following lines will be added to the conf file.
 [server_db101]
 hostname=db101

masterha_conf_host --command=add --conf=/etc/conf/masterha/app1.cnf --hostname=db101 --block=100 --params="no_master=1;ignore_fail=1"

 The following lines will be added to the conf file.
 [server_100]
 hostname=db101
 no_master=1
 ignore_fail=1

masterha_conf_host --command=delete --conf=/etc/conf/masterha/app1.cnf --block=server100

 Then entire block [server100] will be removed.

See online reference (http://code.google.com/p/mysql-master-ha/wiki/masterha_conf_host) for details.

=head1 DESCRIPTION

See online reference (http://code.google.com/p/mysql-master-ha/wiki/masterha_conf_host) for details.