mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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
This commit is contained in:
@@ -1,23 +1,11 @@
|
|||||||
MYSQLDATAdir = $(localstatedir)
|
|
||||||
MYSQLSHAREdir = $(pkgdatadir)
|
|
||||||
MYSQLBASEdir= $(prefix)
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmgmsrvcommon.la
|
noinst_LTLIBRARIES = libmgmsrvcommon.la
|
||||||
|
|
||||||
libmgmsrvcommon_la_SOURCES = \
|
libmgmsrvcommon_la_SOURCES = \
|
||||||
LocalConfig.cpp \
|
LocalConfig.cpp \
|
||||||
Config.cpp \
|
|
||||||
ConfigInfo.cpp \
|
|
||||||
ConfigRetriever.cpp \
|
ConfigRetriever.cpp \
|
||||||
InitConfigFileParser.cpp \
|
|
||||||
IPCConfig.cpp NdbConfig.c
|
IPCConfig.cpp NdbConfig.c
|
||||||
|
|
||||||
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi
|
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi -I$(top_srcdir)/ndb/src/mgmsrv
|
||||||
|
|
||||||
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
|
|
||||||
-DDATADIR="\"$(MYSQLDATAdir)\"" \
|
|
||||||
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
|
|
||||||
-DNDB_BASE_PORT="\"@ndb_port_base@\""
|
|
||||||
|
|
||||||
include $(top_srcdir)/ndb/config/common.mk.am
|
include $(top_srcdir)/ndb/config/common.mk.am
|
||||||
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
|
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
|
||||||
|
@@ -47,10 +47,13 @@ static const char* helpText =
|
|||||||
"HELP DEBUG Help for debug compiled version\n"
|
"HELP DEBUG Help for debug compiled version\n"
|
||||||
#endif
|
#endif
|
||||||
"SHOW Print information about cluster\n"
|
"SHOW Print information about cluster\n"
|
||||||
|
#if 0
|
||||||
"SHOW CONFIG Print configuration\n"
|
"SHOW CONFIG Print configuration\n"
|
||||||
"SHOW PARAMETERS Print configuration parameters\n"
|
"SHOW PARAMETERS Print configuration parameters\n"
|
||||||
|
#endif
|
||||||
"START BACKUP Start backup\n"
|
"START BACKUP Start backup\n"
|
||||||
"ABORT BACKUP <backup id> Abort 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 ON Enable Cluster logging\n"
|
||||||
"CLUSTERLOG OFF Disable Cluster logging\n"
|
"CLUSTERLOG OFF Disable Cluster logging\n"
|
||||||
"CLUSTERLOG FILTER <severity> Toggle severity filter on/off\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"
|
"EXIT SINGLE USER MODE Exit single user mode\n"
|
||||||
"<id> STATUS Print status\n"
|
"<id> STATUS Print status\n"
|
||||||
"<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\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"
|
"REP CONNECT <host:port> Connect to REP server on host:port\n"
|
||||||
|
#endif
|
||||||
"QUIT Quit management client\n"
|
"QUIT Quit management client\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -299,6 +304,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect)
|
|||||||
executeShow(allAfterFirstToken);
|
executeShow(allAfterFirstToken);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(firstToken, "SHUTDOWN") == 0) {
|
||||||
|
executeShutdown(allAfterFirstToken);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (strcmp(firstToken, "CLUSTERLOG") == 0){
|
else if (strcmp(firstToken, "CLUSTERLOG") == 0){
|
||||||
executeClusterLog(allAfterFirstToken);
|
executeClusterLog(allAfterFirstToken);
|
||||||
return true;
|
return true;
|
||||||
@@ -628,6 +637,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
|
* SHOW
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
@@ -127,6 +127,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
void executeHelp(char* parameters);
|
void executeHelp(char* parameters);
|
||||||
void executeShow(char* parameters);
|
void executeShow(char* parameters);
|
||||||
|
void executeShutdown(char* parameters);
|
||||||
void executeRun(char* parameters);
|
void executeRun(char* parameters);
|
||||||
void executeInfo(char* parameters);
|
void executeInfo(char* parameters);
|
||||||
void executeClusterLog(char* parameters);
|
void executeClusterLog(char* parameters);
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "MgmtErrorReporter.hpp"
|
#include "MgmtErrorReporter.hpp"
|
||||||
#include <Properties.hpp>
|
#include <Properties.hpp>
|
||||||
#include "ConfigInfo.hpp"
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Ctor / Dtor
|
// Ctor / Dtor
|
@@ -24,7 +24,7 @@
|
|||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
#include <ndb_limits.h>
|
#include <ndb_limits.h>
|
||||||
#include <Properties.hpp>
|
#include <Properties.hpp>
|
||||||
#include "ConfigInfo.hpp"
|
#include <ConfigInfo.hpp>
|
||||||
|
|
||||||
class ConfigInfo;
|
class ConfigInfo;
|
||||||
|
|
@@ -33,15 +33,15 @@
|
|||||||
* Section names
|
* Section names
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define DB_TOKEN "NDBD"
|
#define DB_TOKEN "DB"
|
||||||
#define MGM_TOKEN "NDB_MGMD"
|
#define MGM_TOKEN "MGM"
|
||||||
#define API_TOKEN "MYSQLD"
|
#define API_TOKEN "API"
|
||||||
|
|
||||||
const ConfigInfo::AliasPair
|
const ConfigInfo::AliasPair
|
||||||
ConfigInfo::m_sectionNameAliases[]={
|
ConfigInfo::m_sectionNameAliases[]={
|
||||||
{API_TOKEN, "API"},
|
{API_TOKEN, "MYSQLD"},
|
||||||
{DB_TOKEN, "DB"},
|
{DB_TOKEN, "NDBD"},
|
||||||
{MGM_TOKEN, "MGM"},
|
{MGM_TOKEN, "NDB_MGMD"},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -975,7 +975,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
|
|||||||
ConfigInfo::USED,
|
ConfigInfo::USED,
|
||||||
false,
|
false,
|
||||||
ConfigInfo::STRING,
|
ConfigInfo::STRING,
|
||||||
DATADIR,
|
MYSQLCLUSTERDIR,
|
||||||
0, 0 },
|
0, 0 },
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1349,7 +1349,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
|
|||||||
ConfigInfo::USED,
|
ConfigInfo::USED,
|
||||||
false,
|
false,
|
||||||
ConfigInfo::STRING,
|
ConfigInfo::STRING,
|
||||||
DATADIR,
|
MYSQLCLUSTERDIR,
|
||||||
0, 0 },
|
0, 0 },
|
||||||
|
|
||||||
{
|
{
|
@@ -1,3 +1,7 @@
|
|||||||
|
MYSQLDATAdir = $(localstatedir)
|
||||||
|
MYSQLSHAREdir = $(pkgdatadir)
|
||||||
|
MYSQLBASEdir= $(prefix)
|
||||||
|
MYSQLCLUSTERdir= $(prefix)/mysql-cluster
|
||||||
|
|
||||||
ndbbin_PROGRAMS = ndb_mgmd
|
ndbbin_PROGRAMS = ndb_mgmd
|
||||||
|
|
||||||
@@ -11,6 +15,9 @@ ndb_mgmd_SOURCES = \
|
|||||||
NodeLogLevelList.cpp \
|
NodeLogLevelList.cpp \
|
||||||
SignalQueue.cpp \
|
SignalQueue.cpp \
|
||||||
MgmtSrvrConfig.cpp \
|
MgmtSrvrConfig.cpp \
|
||||||
|
ConfigInfo.cpp \
|
||||||
|
InitConfigFileParser.cpp \
|
||||||
|
Config.cpp \
|
||||||
CommandInterpreter.cpp
|
CommandInterpreter.cpp
|
||||||
|
|
||||||
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
|
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
|
||||||
@@ -24,6 +31,12 @@ LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \
|
|||||||
$(top_builddir)/strings/libmystrings.a
|
$(top_builddir)/strings/libmystrings.a
|
||||||
@TERMCAP_LIB@
|
@TERMCAP_LIB@
|
||||||
|
|
||||||
|
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
|
||||||
|
-DDATADIR="\"$(MYSQLDATAdir)\"" \
|
||||||
|
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
|
||||||
|
-DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \
|
||||||
|
-DNDB_BASE_PORT="\"@ndb_port_base@\""
|
||||||
|
|
||||||
include $(top_srcdir)/ndb/config/common.mk.am
|
include $(top_srcdir)/ndb/config/common.mk.am
|
||||||
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
|
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ private:
|
|||||||
int _node_id,
|
int _node_id,
|
||||||
unsigned _backup_id);
|
unsigned _backup_id);
|
||||||
|
|
||||||
const char * getFileSystemPathForNode(int _node_id);
|
const char * getBackupDataDirForNode(int _node_id);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1305,7 +1305,7 @@ runTableRenameNF(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
const int numNodes = restarter.getNumDbNodes();
|
const int numNodes = restarter.getNumDbNodes();
|
||||||
for(int i = 0; i<numNodes; i++){
|
for(int i = 0; i<numNodes; i++){
|
||||||
int nodeId = restarter.getDbNodeId(i);
|
int nodeId = restarter.getDbNodeId(i);
|
||||||
int error = NF_codes[i];
|
int error = NF_codes[i].error_id;
|
||||||
|
|
||||||
g_info << "NF1: node = " << nodeId << " error code = " << error << endl;
|
g_info << "NF1: node = " << nodeId << " error code = " << error << endl;
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ NdbBackup::start(unsigned int & _backup_id){
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
NdbBackup::getFileSystemPathForNode(int _node_id){
|
NdbBackup::getBackupDataDirForNode(int _node_id){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch configuration from management server
|
* Fetch configuration from management server
|
||||||
@@ -106,8 +106,8 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char * path;
|
const char * path;
|
||||||
if (iter.get(CFG_DB_FILESYSTEM_PATH, &path)){
|
if (iter.get(CFG_DB_BACKUP_DATADIR, &path)){
|
||||||
ndbout << "FileSystemPath not found" << endl;
|
ndbout << "BackupDataDir not found" << endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,9 +123,9 @@ NdbBackup::execRestore(bool _restore_data,
|
|||||||
const int buf_len = 1000;
|
const int buf_len = 1000;
|
||||||
char buf[buf_len];
|
char buf[buf_len];
|
||||||
|
|
||||||
ndbout << "getFileSystemPathForNode "<< _node_id <<endl;
|
ndbout << "getBackupDataDir "<< _node_id <<endl;
|
||||||
|
|
||||||
const char* path = getFileSystemPathForNode(_node_id);
|
const char* path = getBackupDataDirForNode(_node_id);
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user