-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathn1repl_manager.pl
executable file
·80 lines (51 loc) · 1.16 KB
/
n1repl_manager.pl
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
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use FindBin;
use lib "$FindBin::Bin/extlib/lib/perl5";
use lib "$FindBin::Bin/lib";
use Getopt::Long;
use Pod::Usage;
use Data::Dumper;
use N1Repl::Config;
use N1Repl::Manager;
++$|; # auto flush
my $daemonize = 0;
my $config_file;
Getopt::Long::Configure ("no_ignore_case");
GetOptions(
'conf=s' => \$config_file,
'daemon' => \$daemonize,
'h|help' => \my $help,
);
if ($help || !$config_file) {
pod2usage(-verbose=>2, -exitval=>0);
}
my $config = N1Repl::Config->new()->load($config_file);
my $sm = new N1Repl::Manager(driver=>'DBI', config => $config);
$sm->connect();
$sm->run();
__END__
=head1 NAME
n1repl_manager.pl
=head1 SYNOPSIS
% switch_master.pl --daemon
=head1 DESCRIPTION
master n : slave 1 replication manager for mysql
=head1 INSTALL
% perl cpanm --installdeps .
or
% perl cpanm -L extlib --installdeps .
=head1 OPTIONS
=over 4
=item --daemon
No Implemented
=item -h --help
Display help
=back
=head1 AUTHOR
do_aki
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.