diff options
author | unknown <tomas@poseidon.(none)> | 2004-08-27 11:48:27 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.(none)> | 2004-08-27 11:48:27 +0000 |
commit | 987fc113959189c59e8f6e99d8d5364d9d62bc89 (patch) | |
tree | 553669a934f12f62a64ba7fd2729840a40015ef3 /ndb/src/mgmclient/CommandInterpreter.cpp | |
parent | 6566af8c3599d6ca6f3110a02d4e8476d386888e (diff) | |
download | mariadb-git-987fc113959189c59e8f6e99d8d5364d9d62bc89.tar.gz |
see respective file
ndb/src/mgmsrv/InitConfigFileParser.hpp:
Rename: ndb/src/common/mgmcommon/InitConfigFileParser.hpp -> ndb/src/mgmsrv/InitConfigFileParser.hpp
ndb/src/mgmsrv/InitConfigFileParser.cpp:
Rename: ndb/src/common/mgmcommon/InitConfigFileParser.cpp -> ndb/src/mgmsrv/InitConfigFileParser.cpp
ndb/src/mgmsrv/ConfigInfo.hpp:
Rename: ndb/src/common/mgmcommon/ConfigInfo.hpp -> ndb/src/mgmsrv/ConfigInfo.hpp
ndb/src/common/mgmcommon/Makefile.am:
moved files to mgmsrv
ndb/src/mgmclient/CommandInterpreter.cpp:
added shutdown command
ndb/src/mgmclient/CommandInterpreter.hpp:
added shutdown command
ndb/src/mgmsrv/Config.cpp:
.
ndb/src/mgmsrv/Config.hpp:
.
ndb/src/mgmsrv/ConfigInfo.cpp:
wait with this
ndb/src/mgmsrv/Makefile.am:
moved files to mgmsrv
ndb/test/include/NdbBackup.hpp:
backup not necessarily in file system path
ndb/test/ndbapi/testDict.cpp:
compile error
ndb/test/src/NdbBackup.cpp:
aligned with new config param
Diffstat (limited to 'ndb/src/mgmclient/CommandInterpreter.cpp')
-rw-r--r-- | ndb/src/mgmclient/CommandInterpreter.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index c90ed1822f1..631531ca696 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -47,10 +47,13 @@ static const char* helpText = "HELP DEBUG Help for debug compiled version\n" #endif "SHOW Print information about cluster\n" +#if 0 "SHOW CONFIG Print configuration\n" "SHOW PARAMETERS Print configuration parameters\n" +#endif "START BACKUP Start backup\n" "ABORT BACKUP <backup id> Abort backup\n" +"SHUTDOWN Shutdown all processed in cluster and quit\n" "CLUSTERLOG ON Enable Cluster logging\n" "CLUSTERLOG OFF Disable Cluster logging\n" "CLUSTERLOG FILTER <severity> Toggle severity filter on/off\n" @@ -62,7 +65,9 @@ static const char* helpText = "EXIT SINGLE USER MODE Exit single user mode\n" "<id> STATUS Print status\n" "<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\n" +#ifdef HAVE_GLOBAL_REPLICATION "REP CONNECT <host:port> Connect to REP server on host:port\n" +#endif "QUIT Quit management client\n" ; @@ -299,6 +304,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect) executeShow(allAfterFirstToken); return true; } + else if (strcmp(firstToken, "SHUTDOWN") == 0) { + executeShutdown(allAfterFirstToken); + return true; + } else if (strcmp(firstToken, "CLUSTERLOG") == 0){ executeClusterLog(allAfterFirstToken); return true; @@ -629,6 +638,57 @@ CommandInterpreter::executeHelp(char* parameters) /***************************************************************************** + * SHUTDOWN + *****************************************************************************/ + +void +CommandInterpreter::executeShutdown(char* parameters) +{ + connect(); + + ndb_mgm_cluster_state *state = ndb_mgm_get_status(m_mgmsrv); + if(state == NULL) { + ndbout_c("Could not get status"); + printError(); + return; + } + + int result = 0; + result = ndb_mgm_stop(m_mgmsrv, 0, 0); + if (result <= 0) { + ndbout << "Shutdown failed." << endl; + printError(); + return; + } + + ndbout << "NDB Cluster storage node(s) have shutdown." << endl; + + int mgm_id= 0; + for(int i=0; i < state->no_of_nodes; i++) { + if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM && + state->node_states[i].version != 0){ + if (mgm_id == 0) + mgm_id= state->node_states[i].node_id; + else { + ndbout << "Unable to locate management server, shutdown manually with #STOP" + << endl; + } + } + } + + result = 0; + result = ndb_mgm_stop(m_mgmsrv, 1, &mgm_id); + if (result <= 0) { + ndbout << "Shutdown failed." << endl; + printError(); + return; + } + + ndbout << "NDB Cluster management server shutdown." << endl; + exit(0); +} + +/***************************************************************************** * SHOW *****************************************************************************/ |