예제 #1
0
파일: server.cpp 프로젝트: mongodb/mongo
ExitCode main(ServiceContext* serviceContext) {
    serviceContext->setFastClockSource(FastClockSourceFactory::create(Milliseconds{10}));

    auto const shardingContext = Grid::get(serviceContext);

    // We either have a setting where all processes are in localhost or none are
    std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers();
    for (std::vector<HostAndPort>::const_iterator it = configServers.begin();
         it != configServers.end();
         ++it) {
        const HostAndPort& configAddr = *it;

        if (it == configServers.begin()) {
            shardingContext->setAllowLocalHost(configAddr.isLocalHost());
        }

        if (configAddr.isLocalHost() != shardingContext->allowLocalHost()) {
            log(LogComponent::kDefault) << "cannot mix localhost and ip addresses in configdbs";
            return EXIT_BADOPTIONS;
        }
    }

#if defined(_WIN32)
    if (ntservice::shouldStartService()) {
        ntservice::startService();
        // If we reach here, then we are not running as a service. Service installation exits
        // directly and so never reaches here either.
    }
#endif

    return runMongosServer(serviceContext);
}
예제 #2
0
파일: server.cpp 프로젝트: akkabin/mongo
 static void initService() {
     ntservice::reportStatus( SERVICE_RUNNING );
     log() << "Service running" << endl;
     runMongosServer( false );
 }
예제 #3
0
파일: server.cpp 프로젝트: e-siedler/mongo
 bool initService() {
     ServiceController::reportStatus( SERVICE_RUNNING );
     log() << "Service running" << endl;
     runMongosServer( false );
     return true;
 }
예제 #4
0
파일: server.cpp 프로젝트: mongodb/mongo
ExitCode initService() {
    return runMongosServer(getGlobalServiceContext());
}