void printShardingVersionInfo( bool out ) { if ( out ) { cout << "MongoS version " << versionString << " starting: pid=" << ProcessId::getCurrent() << " port=" << cmdLine.port << ( sizeof(int*) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << " (--help for usage)" << endl; DEV cout << "_DEBUG build" << endl; cout << "git version: " << gitVersion() << endl; #ifdef MONGO_SSL cout << "OpenSSL version: " << openSSLVersion() << endl; #endif cout << "build sys info: " << sysInfo() << endl; } else { log() << "MongoS version " << versionString << " starting: pid=" << ProcessId::getCurrent() << " port=" << cmdLine.port << ( sizeof( int* ) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << " (--help for usage)" << endl; DEV log() << "_DEBUG build" << endl; printGitVersion(); #ifdef MONGO_SSL printOpenSSLVersion(); #endif printSysInfo(); printCommandLineOpts(); } }
void printShardingVersionInfo( bool out ) { if ( out ) { cout << "MongoS version " << versionString << " starting: pid=" << getpid() << " port=" << cmdLine.port << ( sizeof(int*) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << " (--help for usage)" << endl; DEV cout << "_DEBUG build" << endl; cout << "git version: " << gitVersion() << endl; cout << "build sys info: " << sysInfo() << endl; } else { log() << "MongoS version " << versionString << " starting: pid=" << getpid() << " port=" << cmdLine.port << ( sizeof( int* ) == 4 ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << " (--help for usage)" << endl; DEV log() << "_DEBUG build" << endl; printGitVersion(); printSysInfo(); printCommandLineOpts(); } }
void _initAndListen(int listenPort ) { Client::initThread("initandlisten"); Database::_openAllFiles = false; Logstream::get().addGlobalTee( new RamLog("global") ); bool is32bit = sizeof(int*) == 4; { #if !defined(_WIN32) pid_t pid = getpid(); #else DWORD pid=GetCurrentProcessId(); #endif Nullstream& l = log(); l << "MongoDB starting : pid=" << pid << " port=" << cmdLine.port << " dbpath=" << dbpath; if( replSettings.master ) l << " master=" << replSettings.master; if( replSettings.slave ) l << " slave=" << (int) replSettings.slave; l << ( is32bit ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << endl; } DEV log() << "_DEBUG build (which is slower)" << endl; show_warnings(); log() << mongodVersion() << endl; printGitVersion(); printSysInfo(); printCommandLineOpts(); { stringstream ss; ss << endl; ss << "*********************************************************************" << endl; ss << " ERROR: dbpath (" << dbpath << ") does not exist." << endl; ss << " Create this directory or give existing directory in --dbpath." << endl; ss << " See http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo" << endl; ss << "*********************************************************************" << endl; uassert( 10296 , ss.str().c_str(), boost::filesystem::exists( dbpath ) ); } { stringstream ss; ss << "repairpath (" << repairpath << ") does not exist"; uassert( 12590 , ss.str().c_str(), boost::filesystem::exists( repairpath ) ); } acquirePathLock(forceRepair); boost::filesystem::remove_all( dbpath + "/_tmp/" ); FileAllocator::get()->start(); MONGO_ASSERT_ON_EXCEPTION_WITH_MSG( clearTmpFiles(), "clear tmp files" ); dur::startup(); if( cmdLine.durOptions & CmdLine::DurRecoverOnly ) return; // comes after getDur().startup() because this reads from the database clearTmpCollections(); checkIfReplMissingFromCommandLine(); Module::initAll(); if ( scriptingEnabled ) { ScriptEngine::setup(); globalScriptEngine->setCheckInterruptCallback( jsInterruptCallback ); globalScriptEngine->setGetInterruptSpecCallback( jsGetInterruptSpecCallback ); } repairDatabasesAndCheckVersion(); /* we didn't want to pre-open all files for the repair check above. for regular operation we do for read/write lock concurrency reasons. */ Database::_openAllFiles = true; if ( shouldRepairDatabases ) return; /* this is for security on certain platforms (nonce generation) */ srand((unsigned) (curTimeMicros() ^ startupSrandTimer.micros())); snapshotThread.go(); d.clientCursorMonitor.go(); PeriodicTask::theRunner->go(); startTTLBackgroundJob(); #ifndef _WIN32 CmdLine::launchOk(); #endif if( !noauth ) { // open admin db in case we need to use it later. TODO this is not the right way to // resolve this. Client::WriteContext c("admin",dbpath,false); } listen(listenPort); // listen() will return when exit code closes its socket. exitCleanly(EXIT_NET_ERROR); }