mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
ndb cluster config fixes, se respective files
mysql-test/ndb/ndb_config_2_node.ini: added new config parameter datadir ndb/include/mgmapi/mgmapi_config_parameters.h: added new config parameter datadir and backup data dir ndb/include/mgmcommon/ConfigRetriever.hpp: changed verify config so that it can be used by mgmt srvr ndb/include/mgmcommon/NdbConfig.h: added option to set path for ndb files ndb/src/common/mgmcommon/ConfigInfo.cpp: changed token names for DB, MGM and API added config parametsers for datadir and backup data dir ndb/src/common/mgmcommon/ConfigRetriever.cpp: changed verify config so that it can be used by mgmt srvr ndb/src/common/mgmcommon/InitConfigFileParser.cpp: no need anymore to make uppercase ndb/src/common/mgmcommon/NdbConfig.c: bugfix+ added method to set datadir ndb/src/kernel/Makefile.am: added debug libs to ndbd ndb/src/kernel/vm/Configuration.cpp: added debug libs to ndbd ndb/src/mgmsrv/MgmtSrvr.cpp: added verify config to mgmt srvr ndb/src/mgmsrv/main.cpp: .
This commit is contained in:
@ -5,15 +5,16 @@ DataMemory= CHOOSE_DataMemory
|
||||
IndexMemory= CHOOSE_IndexMemory
|
||||
Diskless= CHOOSE_Diskless
|
||||
TimeBetweenWatchDogCheck= 30000
|
||||
FileSystemPath= CHOOSE_FILESYSTEM
|
||||
DataDir= CHOOSE_FILESYSTEM
|
||||
|
||||
[ndbd]
|
||||
HostName: CHOOSE_HOSTNAME_1
|
||||
HostName= CHOOSE_HOSTNAME_1
|
||||
|
||||
[ndbd]
|
||||
HostName: CHOOSE_HOSTNAME_2
|
||||
HostName= CHOOSE_HOSTNAME_2
|
||||
|
||||
[ndb_mgmd]
|
||||
DataDir= CHOOSE_FILESYSTEM
|
||||
PortNumber= CHOOSE_PORT_MGM
|
||||
|
||||
[mysqld]
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define CFG_NODE_BYTE_ORDER 4
|
||||
#define CFG_NODE_HOST 5
|
||||
#define CFG_NODE_SYSTEM 6
|
||||
#define CFG_NODE_DATADIR 7
|
||||
|
||||
/**
|
||||
* DB config parameters
|
||||
@ -89,6 +90,8 @@
|
||||
|
||||
#define CFG_DB_LONG_SIGNAL_BUFFER 157
|
||||
|
||||
#define CFG_DB_BACKUP_DATA_PATH 158
|
||||
|
||||
#define CFG_NODE_ARBIT_RANK 200
|
||||
#define CFG_NODE_ARBIT_DELAY 201
|
||||
|
||||
|
@ -78,6 +78,11 @@ public:
|
||||
* Get config from file
|
||||
*/
|
||||
struct ndb_mgm_configuration * getConfig(const char * file);
|
||||
|
||||
/**
|
||||
* Verify config
|
||||
*/
|
||||
bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid);
|
||||
private:
|
||||
BaseString errorString;
|
||||
enum ErrorType {
|
||||
@ -97,11 +102,6 @@ private:
|
||||
Uint32 m_version;
|
||||
Uint32 m_node_type;
|
||||
NdbMgmHandle m_handle;
|
||||
|
||||
/**
|
||||
* Verify config
|
||||
*/
|
||||
bool verifyConfig(const struct ndb_mgm_configuration *);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NdbConfig_SetPath(const char *path);
|
||||
char* NdbConfig_NdbCfgName(int with_ndb_home);
|
||||
char* NdbConfig_ErrorFileName(int node_id);
|
||||
char* NdbConfig_ClusterLogFileName(int node_id);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -154,7 +154,7 @@ ConfigRetriever::getConfig() {
|
||||
if(p == 0)
|
||||
return 0;
|
||||
|
||||
if(!verifyConfig(p)){
|
||||
if(!verifyConfig(p, _ownNodeId)){
|
||||
free(p);
|
||||
p= 0;
|
||||
}
|
||||
@ -239,7 +239,7 @@ ConfigRetriever::setConnectString(const char * connectString) {
|
||||
}
|
||||
|
||||
bool
|
||||
ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 nodeid){
|
||||
|
||||
char buf[255];
|
||||
ndb_mgm_configuration_iterator * it;
|
||||
@ -253,8 +253,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
}
|
||||
NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it);
|
||||
|
||||
if(ndb_mgm_find(it, CFG_NODE_ID, _ownNodeId) != 0){
|
||||
snprintf(buf, 255, "Unable to find node with id: %d", _ownNodeId);
|
||||
if(ndb_mgm_find(it, CFG_NODE_ID, nodeid) != 0){
|
||||
snprintf(buf, 255, "Unable to find node with id: %d", nodeid);
|
||||
setError(CR_ERROR, buf);
|
||||
return false;
|
||||
}
|
||||
@ -266,6 +266,11 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
return false;
|
||||
}
|
||||
|
||||
const char * datadir;
|
||||
if(!ndb_mgm_get_string_parameter(it, CFG_NODE_DATADIR, &datadir)){
|
||||
NdbConfig_SetPath(datadir);
|
||||
}
|
||||
|
||||
char localhost[MAXHOSTNAMELEN];
|
||||
if(NdbHost_GetHostName(localhost) != 0){
|
||||
snprintf(buf, 255, "Unable to get own hostname");
|
||||
@ -332,8 +337,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
if(iter.get(CFG_CONNECTION_NODE_1, &nodeId1)) continue;
|
||||
if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue;
|
||||
|
||||
if(nodeId1 != _ownNodeId && nodeId2 != _ownNodeId) continue;
|
||||
remoteNodeId = (_ownNodeId == nodeId1 ? nodeId2 : nodeId1);
|
||||
if(nodeId1 != nodeid && nodeId2 != nodeid) continue;
|
||||
remoteNodeId = (nodeid == nodeId1 ? nodeId2 : nodeId1);
|
||||
|
||||
const char * name;
|
||||
struct in_addr addr;
|
||||
@ -342,7 +347,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
if(Ndb_getInAddr(&addr, name) != 0){
|
||||
tmp.assfmt("Unable to lookup/illegal hostname %s, "
|
||||
"connection from node %d to node %d",
|
||||
name, _ownNodeId, remoteNodeId);
|
||||
name, nodeid, remoteNodeId);
|
||||
setError(CR_ERROR, tmp.c_str());
|
||||
return false;
|
||||
}
|
||||
@ -352,7 +357,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
|
||||
if(Ndb_getInAddr(&addr, name) != 0){
|
||||
tmp.assfmt("Unable to lookup/illegal hostname %s, "
|
||||
"connection from node %d to node %d",
|
||||
name, _ownNodeId, remoteNodeId);
|
||||
name, nodeid, remoteNodeId);
|
||||
setError(CR_ERROR, tmp.c_str());
|
||||
return false;
|
||||
}
|
||||
|
@ -480,10 +480,6 @@ InitConfigFileParser::parseSectionHeader(const char* line) const {
|
||||
tmp[0] = ' ';
|
||||
trim(tmp);
|
||||
|
||||
// Convert section header to upper
|
||||
for(int i= strlen(tmp)-1; i >= 0; i--)
|
||||
tmp[i]= toupper(tmp[i]);
|
||||
|
||||
// Get the correct header name if an alias
|
||||
{
|
||||
const char *tmp_alias= m_info->getAlias(tmp);
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <NdbEnv.h>
|
||||
#include <NdbMem.h>
|
||||
|
||||
static char *datadir_path= 0;
|
||||
|
||||
static char*
|
||||
NdbConfig_AllocHomePath(int _len)
|
||||
{
|
||||
@ -27,19 +29,27 @@ NdbConfig_AllocHomePath(int _len)
|
||||
int path_len= 0;
|
||||
char *buf;
|
||||
|
||||
if (path == 0)
|
||||
path= datadir_path;
|
||||
|
||||
if (path)
|
||||
path_len= strlen(path);
|
||||
|
||||
len+= path_len;
|
||||
buf= NdbMem_Allocate(len);
|
||||
if (path_len > 0)
|
||||
snprintf(buf, len, "%s%c", path, DIR_SEPARATOR);
|
||||
snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
|
||||
else
|
||||
buf[0]= 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void
|
||||
NdbConfig_SetPath(const char* path){
|
||||
datadir_path= path;
|
||||
}
|
||||
|
||||
char*
|
||||
NdbConfig_NdbCfgName(int with_ndb_home){
|
||||
char *buf;
|
||||
|
@ -52,7 +52,10 @@ LDADD += \
|
||||
$(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
|
||||
$(top_builddir)/ndb/src/mgmapi/libmgmapi.la \
|
||||
$(top_builddir)/ndb/src/common/portlib/libportlib.la \
|
||||
$(top_builddir)/ndb/src/common/util/libgeneral.la
|
||||
$(top_builddir)/ndb/src/common/util/libgeneral.la \
|
||||
$(top_builddir)/dbug/libdbug.a \
|
||||
$(top_builddir)/mysys/libmysys.a \
|
||||
$(top_builddir)/strings/libmystrings.a
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -14,6 +14,9 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <ndb_global.h>
|
||||
#include <my_sys.h>
|
||||
|
||||
#include "Configuration.hpp"
|
||||
#include <ErrorHandlingMacros.hpp>
|
||||
#include "GlobalData.hpp"
|
||||
@ -56,6 +59,9 @@ Configuration::init(int argc, const char** argv){
|
||||
int _deamon = 0;
|
||||
int _help = 0;
|
||||
int _print_version = 0;
|
||||
#ifndef DBUG_OFF
|
||||
const char *debug_option= 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Arguments to NDB process
|
||||
@ -66,6 +72,10 @@ Configuration::init(int argc, const char** argv){
|
||||
{ "nostart", 'n', arg_flag, &_no_start,
|
||||
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" },
|
||||
{ "daemon", 'd', arg_flag, &_deamon, "Start ndbd as daemon", "" },
|
||||
#ifndef DBUG_OFF
|
||||
{ "debug", 0, arg_string, &debug_option,
|
||||
"Specify debug options e.g. d:t:i:o,out.trace", "options" },
|
||||
#endif
|
||||
{ "initial", 'i', arg_flag, &_initial,
|
||||
"Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" },
|
||||
|
||||
@ -84,15 +94,17 @@ Configuration::init(int argc, const char** argv){
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
ndbout << "no_start=" <<_no_start<< endl;
|
||||
ndbout << "initial=" <<_initial<< endl;
|
||||
ndbout << "deamon=" <<_deamon<< endl;
|
||||
ndbout << "connect_str="<<_connect_str<<endl;
|
||||
arg_printusage(args, num_args, argv[0], desc);
|
||||
return false;
|
||||
#ifndef DBUG_OFF
|
||||
my_init();
|
||||
if (debug_option)
|
||||
DBUG_PUSH(debug_option);
|
||||
#endif
|
||||
|
||||
DBUG_PRINT("info", ("no_start=%d", _no_start));
|
||||
DBUG_PRINT("info", ("initial=%d", _initial));
|
||||
DBUG_PRINT("info", ("deamon=%d", _deamon));
|
||||
DBUG_PRINT("info", ("connect_str=%s", _connect_str));
|
||||
|
||||
ndbSetOwnVersion();
|
||||
|
||||
if (_print_version) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "MgmtSrvr.hpp"
|
||||
#include "MgmtErrorReporter.hpp"
|
||||
#include <ConfigRetriever.hpp>
|
||||
|
||||
#include <NdbOut.hpp>
|
||||
#include <NdbApiSignal.hpp>
|
||||
@ -512,6 +513,8 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
|
||||
theConfCount(0),
|
||||
m_allocated_resources(*this) {
|
||||
|
||||
DBUG_ENTER("MgmtSrvr::MgmtSrvr");
|
||||
|
||||
_config = NULL;
|
||||
_isStatPortActive = false;
|
||||
_isClusterLogStatActive = false;
|
||||
@ -543,6 +546,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
|
||||
for(Uint32 i = 0; i<MAX_NODES; i++)
|
||||
nodeTypes[i] = (enum ndb_mgm_node_type)-1;
|
||||
|
||||
{
|
||||
ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator
|
||||
(config->m_configValues, CFG_SECTION_NODE);
|
||||
for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){
|
||||
@ -574,6 +578,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
|
||||
}
|
||||
}
|
||||
ndb_mgm_destroy_iterator(iter);
|
||||
}
|
||||
|
||||
m_statisticsListner = NULL;
|
||||
|
||||
@ -589,6 +594,18 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
|
||||
exit(-1);
|
||||
}
|
||||
_ownNodeId = tmp;
|
||||
|
||||
|
||||
{
|
||||
DBUG_PRINT("info", ("verifyConfig"));
|
||||
ConfigRetriever cr(NDB_VERSION, NDB_MGM_NODE_TYPE_MGM);
|
||||
if (!cr.verifyConfig(config->m_configValues, _ownNodeId)) {
|
||||
ndbout << cr.getErrorString() << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ struct getargs args[] = {
|
||||
"Specify cluster configuration file", "filename" },
|
||||
#ifndef DBUG_OFF
|
||||
{ "debug", 0, arg_string, &debug_option,
|
||||
"Specify debug option e.d. d:t:i:o,out.trace", "options" },
|
||||
"Specify debug options e.g. d:t:i:o,out.trace", "options" },
|
||||
#endif
|
||||
{ "daemon", 'd', arg_flag, &glob.daemon,
|
||||
"Run ndb_mgmd in daemon mode" },
|
||||
@ -143,8 +143,8 @@ NDB_MAIN(mgmsrv){
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my_init();
|
||||
#ifndef DBUG_OFF
|
||||
my_init();
|
||||
if (debug_option)
|
||||
DBUG_PUSH(debug_option);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user