diff --git a/sbin/ngcp-sync-constants b/sbin/ngcp-sync-constants index e40716ce..7ca0e759 100755 --- a/sbin/ngcp-sync-constants +++ b/sbin/ngcp-sync-constants @@ -56,7 +56,6 @@ use constant COPY_PASSWORDS => [ # pairs of from/to { reminder => { dbuser => 'dbpassword' }} ]; -use constant NGCP_NODENAME => "/etc/ngcp_ha_node"; sub Usage { print < \&Usage, "i|init-passwords" => \$init_passwords, @@ -99,7 +100,8 @@ GetOptions("h|?|help" => \&Usage, "no-grant-nodes" => \$skip_grant_nodes, "t|test" => \$test_mode, "force-grants" => \$force_grants, - "pair-repl" => \$replication, + "pair-repl" => \$pair_repl, + "local-repl" => \$slave_repl, "v|verbose" => \$debug); #---------------------------------------------------------------------- sub pwgen { @@ -222,6 +224,7 @@ sub sync_repuser { my $mhost = $args{mhost}; my $mport = $args{mport} || 3306; my $mhost_ip = $args{mhost}; + my $replication = $args{repl} || 0; unless ( is_ipv4($mhost) or is_ipv6($mhost) ) { $mhost_ip = inet_ntoa(scalar(gethostbyname($mhost))); @@ -457,13 +460,14 @@ sub sync_mysql_data { my $pass = $pair->{'pass'}; next unless ($user && $pass); - # special handling for getting replication set up or in sync + # special handling for getting pair replication set up or in sync if($user eq 'replicator') { if ($mhost) { sync_repuser( dbh => $dbh, mhost => $mhost, - user => $user, pass => $pass + user => $user, pass => $pass, + repl => $pair_repl ); grant_user( dbh => $dbh, @@ -654,7 +658,8 @@ sub do_slave_sync dbh => $dbh, mhost => $mhost, mport => $mport, user => $user, pass => $pass, - dbid => "2" + dbid => "2", + repl => $slave_repl ); # mysql sipwise user my ($mysql_user, $mysql_pass) = get_mysql_credentials(); @@ -744,6 +749,9 @@ No real updates, only for checks =item B<--pair-repl> Set replication between peers +=item B<--local-repl> +Set replication between local RO slave and central db. Needs --slave to be effective + =item B<--verbose> Verbose mode where all changes are written to STDOUT