Commit 5cccb453 authored by unknown's avatar unknown

-d default on ndb_mgmd and ndbd

-i depricated on ndbd
fixed bug in shutdown command in ndb_mgm


ndb/src/mgmsrv/main.cpp:
  added config.ini as default configuration file
  -d default on ndb_mgmd and ndbd
  -i depricated on ndbd
  fixed bug in shutdown command in ndb_mgm
parent 862d056d
......@@ -54,7 +54,7 @@ while test $# -gt 0; do
stop_ndb=1
;;
--initial)
flags_ndb="$flags_ndb -i"
flags_ndb="$flags_ndb --initial"
initial_ndb=1
;;
--debug*)
......@@ -143,7 +143,7 @@ fi
rm -f "$cfgfile" 2>&1 | cat > /dev/null
rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
if ( cd "$fs_ndb" ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
if ( cd "$fs_ndb" ; $exec_mgmtsrvr -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
......@@ -153,14 +153,14 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb -d $flags_ndb & )
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb -d $flags_ndb & )
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
......
......@@ -56,7 +56,8 @@ Configuration::init(int argc, const char** argv){
int _no_start = 0;
int _initial = 0;
const char* _connect_str = NULL;
int _deamon = 0;
int _daemon = 1;
int _no_daemon = 0;
int _help = 0;
int _print_version = 0;
#ifndef DBUG_OFF
......@@ -71,12 +72,13 @@ Configuration::init(int argc, const char** argv){
{ "version", 'v', arg_flag, &_print_version, "Print ndbd version", "" },
{ "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", "" },
{ "daemon", 'd', arg_flag, &_daemon, "Start ndbd as daemon (default)", "" },
{ "nodaemon", 0, arg_flag, &_no_daemon, "Do not start ndbd as daemon, provided for testing purposes", "" },
#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,
{ "initial", 0, arg_flag, &_initial,
"Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" },
{ "connect-string", 'c', arg_string, &_connect_str,
......@@ -91,18 +93,27 @@ Configuration::init(int argc, const char** argv){
if(getarg(args, num_args, argc, argv, &optind) || _help) {
arg_printusage(args, num_args, argv[0], desc);
for (int i = 0; i < argc; i++) {
if (strcmp("-i",argv[i]) == 0) {
printf("flag depricated %s, use %s\n", "-i", "--initial");
}
}
return false;
}
if (_no_daemon) {
_daemon= 0;
}
// check for depricated flag '-i'
#ifndef DBUG_OFF
my_init();
#ifndef DBUG_OFF
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", ("daemon=%d", _daemon));
DBUG_PRINT("info", ("connect_str=%s", _connect_str));
ndbSetOwnVersion();
......@@ -126,8 +137,8 @@ Configuration::init(int argc, const char** argv){
if (_connect_str)
_connectString = strdup(_connect_str);
// Check deamon flag
if (_deamon)
// Check daemon flag
if (_daemon)
_daemonMode = true;
// Save programname
......@@ -202,7 +213,7 @@ Configuration::fetch_configuration(){
if((globalData.ownId = cr.allocNodeId()) == 0){
for(Uint32 i = 0; i<3; i++){
NdbSleep_SecSleep(3);
if(globalData.ownId = cr.allocNodeId())
if((globalData.ownId = cr.allocNodeId()) != 0)
break;
}
}
......
......@@ -655,13 +655,13 @@ CommandInterpreter::executeShutdown(char* parameters)
int result = 0;
result = ndb_mgm_stop(m_mgmsrv, 0, 0);
if (result <= 0) {
if (result < 0) {
ndbout << "Shutdown failed." << endl;
printError();
return;
}
ndbout << "NDB Cluster storage node(s) have shutdown." << endl;
ndbout << result << " NDB Cluster storage node(s) have shutdown." << endl;
int mgm_id= 0;
for(int i=0; i < state->no_of_nodes; i++) {
......@@ -989,7 +989,7 @@ CommandInterpreter::executeStop(int processId, const char *, bool all)
} else {
result = ndb_mgm_stop(m_mgmsrv, 1, &processId);
}
if (result <= 0) {
if (result < 0) {
ndbout << "Shutdown failed." << endl;
printError();
} else
......
......@@ -61,6 +61,7 @@ struct MgmGlobals {
/** Command line arguments */
int daemon; // NOT bool, bool need not be int
int non_interactive;
int interactive;
const char * config_filename;
const char * local_config_filename;
......@@ -112,10 +113,12 @@ struct getargs args[] = {
"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" },
"Run ndb_mgmd in daemon mode (default)" },
{ NULL, 'l', arg_string, &glob.local_config_filename,
"Specify configuration file connect string (will default use Ndb.cfg if available)",
"filename" },
{ "interactive", 0, arg_flag, &glob.interactive,
"Run interactive. Not supported but provided for testing purposes", "" },
{ "nodaemon", 'n', arg_flag, &glob.non_interactive,
"Don't run as daemon, but don't read from stdin", "non-interactive" }
};
......@@ -143,6 +146,11 @@ NDB_MAIN(mgmsrv){
exit(1);
}
if (glob.interactive ||
glob.non_interactive) {
glob.daemon= 0;
}
#ifndef DBUG_OFF
my_init();
if (debug_option)
......@@ -155,8 +163,7 @@ NDB_MAIN(mgmsrv){
}
if(glob.config_filename == NULL) {
fprintf(stderr, "No configuration file specified\n");
exit(1);
glob.config_filename= "config.ini";
}
glob.socketServer = new SocketServer();
......@@ -178,6 +185,8 @@ NDB_MAIN(mgmsrv){
"" : glob.local_config_filename),
glob.cluster_config);
chdir(NdbConfig_get_path(0));
glob.cluster_config = 0;
glob.localNodeId= glob.mgmObject->getOwnNodeId();
......@@ -269,7 +278,7 @@ NDB_MAIN(mgmsrv){
glob.socketServer->startServer();
#if ! defined NDB_OSE && ! defined NDB_SOFTOSE
if(!glob.daemon && !glob.non_interactive){
if(glob.interactive) {
CommandInterpreter com(* glob.mgmObject);
while(com.readAndExecute());
} else
......@@ -296,8 +305,9 @@ MgmGlobals::MgmGlobals(){
local_config_filename = NULL;
interface_name = 0;
cluster_config = 0;
daemon = false;
daemon = 1;
non_interactive = 0;
interactive = 0;
socketServer = 0;
mgmObject = 0;
}
......
......@@ -465,7 +465,7 @@ setup_config(atrt_config& config){
proc.m_type = atrt_process::NDB_DB;
proc.m_proc.m_name.assfmt("%d-%s", index, "ndbd");
proc.m_proc.m_path.assign(dir).append("/libexec/ndbd");
proc.m_proc.m_args = "-i -n";
proc.m_proc.m_args = "--initial --nodaemon -n";
proc.m_proc.m_cwd.appfmt("%d.ndbd", index);
} else if(split1[0] == "mysqld"){
proc.m_type = atrt_process::MYSQL_SERVER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment