Cannot start MongoDB as a service

后端 未结 24 1496
情话喂你
情话喂你 2020-12-07 10:07

I have been developing for MongoDB for some months now and would like to install it as a service on my Windows 7 Enterprise machine. The following is the command that I hav

24条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 10:37

    Remember to create the database before starting the service

    C:\>"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --dbpath d:\MONGODB\DB
    2016-10-13T18:18:23.135+0200 I CONTROL  [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
    2016-10-13T18:18:23.147+0200 I CONTROL  [initandlisten] MongoDB starting : pid=4024 port=27017 dbpath=d:\MONGODB\DB 64-bit host=mongosvr
    2016-10-13T18:18:23.148+0200 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
    2016-10-13T18:18:23.149+0200 I CONTROL  [initandlisten] db version v3.2.8
    2016-10-13T18:18:23.149+0200 I CONTROL  [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
    2016-10-13T18:18:23.150+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015
    2016-10-13T18:18:23.151+0200 I CONTROL  [initandlisten] allocator: tcmalloc
    2016-10-13T18:18:23.151+0200 I CONTROL  [initandlisten] modules: none
    2016-10-13T18:18:23.152+0200 I CONTROL  [initandlisten] build environment:
    2016-10-13T18:18:23.152+0200 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
    2016-10-13T18:18:23.153+0200 I CONTROL  [initandlisten]     distarch: x86_64
    2016-10-13T18:18:23.153+0200 I CONTROL  [initandlisten]     target_arch: x86_64
    2016-10-13T18:18:23.154+0200 I CONTROL  [initandlisten] options: { storage: { dbPath: "d:\MONGODB\DB" } }
    2016-10-13T18:18:23.166+0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
    2016-10-13T18:18:23.722+0200 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
    2016-10-13T18:18:23.723+0200 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'd:/MONGODB/DB/diagnostic.data'
    2016-10-13T18:18:23.895+0200 I NETWORK  [initandlisten] waiting for connections on port 27017
    

    Then you can stop the process Control-C

    2016-10-13T18:18:44.787+0200 I CONTROL  [thread1] Ctrl-C signal
    2016-10-13T18:18:44.788+0200 I CONTROL  [consoleTerminate] got CTRL_C_EVENT, will terminate after current cmd ends
    2016-10-13T18:18:44.789+0200 I FTDC     [consoleTerminate] Shutting down full-time diagnostic data capture
    2016-10-13T18:18:44.792+0200 I CONTROL  [consoleTerminate] now exiting
    2016-10-13T18:18:44.792+0200 I NETWORK  [consoleTerminate] shutdown: going to close listening sockets...
    2016-10-13T18:18:44.793+0200 I NETWORK  [consoleTerminate] closing listening socket: 380
    2016-10-13T18:18:44.793+0200 I NETWORK  [consoleTerminate] shutdown: going to flush diaglog...
    2016-10-13T18:18:44.793+0200 I NETWORK  [consoleTerminate] shutdown: going to close sockets...
    2016-10-13T18:18:44.795+0200 I STORAGE  [consoleTerminate] WiredTigerKVEngine shutting down
    2016-10-13T18:18:45.116+0200 I STORAGE  [consoleTerminate] shutdown: removing fs lock...
    2016-10-13T18:18:45.117+0200 I CONTROL  [consoleTerminate] dbexit:  rc: 12
    

    Now your database is prepared and you can start the service using

    C:\>net start MongoDB
    The MongoDB service is starting.
    The MongoDB service was started successfully.
    

提交回复
热议问题