20 #include <ndb_global.h>
23 #include <OutputStream.hpp>
28 #include <NdbRestarter.hpp>
31 int main(
int argc,
const char** argv){
34 const char* _hostName = NULL;
41 {
"initial",
'i', arg_flag, &_initial,
"Do initial restart",
""},
42 {
"wait",
'\0', arg_negative_flag, &_wait,
"Wait until restarted(default=true)",
""},
43 {
"usage",
'?', arg_flag, &_help,
"Print help",
"" }
46 int num_args =
sizeof(args) /
sizeof(args[0]);
50 "This program will connect to the mgmsrv of a NDB cluster\n"\
51 " and restart the cluster. \n";
53 if(getarg(args, num_args, argc, argv, &optind) || _help) {
54 arg_printusage(args, num_args, argv[0], desc);
55 return NDBT_ProgramExit(NDBT_WRONGARGS);
57 _hostName = argv[optind];
63 ndbout <<
"Restarting cluster with initial restart" << endl;
64 if (restarter.restartAll(
true,
false,
false) != 0)
67 ndbout <<
"Restarting cluster " << endl;
68 if (restarter.restartAll() != 0)
71 if (result == NDBT_FAILED){
72 g_err <<
"Failed to restart cluster" << endl;
73 return NDBT_ProgramExit(NDBT_FAILED);
77 ndbout <<
"Waiting for cluster to start" << endl;
78 if ( restarter.waitClusterStarted(120) != 0){
79 ndbout <<
"Failed waiting for restart of cluster" << endl;
83 ndbout <<
"Cluster restarted" << endl;
85 return NDBT_ProgramExit(result);