@ -70,6 +70,7 @@ Options:
-init-passwords|-i -- generate new passwords (constants.yml is updated)
-slave|-s -- sync repuser and replication on slave cluster instance
-no-grant-nodes -- skip copy grants for external nodes
-force-grants -- force grants (remove and create user if exists)
-test|-t -- test mode (no updates)
-verbose|-v -- verbose mode
USAGE
@ -87,6 +88,7 @@ my $init_passwords = 0;
my $debug = 0;
my $test_mode = 0;
my $error = 0;
my $force_grants = 0;
GetOptions("h|?|help" => \&Usage,
"i|init-passwords" => \$init_passwords,
@ -94,6 +96,7 @@ GetOptions("h|?|help" => \&Usage,
"s|slave" => \$slave,
"no-grant-nodes" => \$skip_grant_nodes,
"t|test" => \$test_mode,
"force-grants" => \$force_grants,
"v|verbose" => \$debug);
#----------------------------------------------------------------------
sub pwgen {
@ -355,7 +358,8 @@ SQL
$sth_cr->execute($host, $user, $host_orig) unless $test_mode;
}
else {
print "--> user ${user} already created\n" if $debug;
print "--> user ${user} already created. Set password again\n" if $debug;
$dbh->do("SET PASSWORD FOR '${user}'\@'${host}' = PASSWORD('${pass}');") unless $test_mode;
}
}
$sth_sel->finish;
@ -606,7 +610,7 @@ sub do_grant_nodes
grant_user(dbh => $dbh, user => $mysql_user, hosts => \@hosts, repuser => 0 );
sync_user( dbh => $dbh, user => $mysql_user, pass => $mysql_pass );
# all mysql users except repuser
copy_grants(dbh => $dbh, hosts => \@hosts);
copy_grants(dbh => $dbh, hosts => \@hosts, force => $force_grants );
};
if ($@) {
$dbh->rollback;
@ -724,6 +728,9 @@ Sync repuser and check replication of the read-only dbcluster instance (mysqld2)
=item B<--no-grant-nodes>
Skip creation of grants for external nodes. This is useful on installation phase at sp2
=item B<--force-grants>
Remove and recreate users for slave hosts
=item B<--test>
No real updates, only for checks