美文网首页
mongodb 安装常见异常

mongodb 安装常见异常

作者: 喝咖啡的蚂蚁 | 来源:发表于2018-07-31 18:13 被阅读0次

    mongodb window直接运行mongo.exe 或报错

    D:\Program Files\MongoDB\Server\3.2\bin>mongo.exe start
    2018-07-31T18:04:28.936+0800 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, wi
    ll zero-out data files
    MongoDB shell version: 3.2.20-22-g72058227a2
    connecting to: start
    2018-07-31T18:04:34.205+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms
    milliseconds, giving up.
    2018-07-31T18:04:34.206+0800 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017,
     connection attempt failed :
    connect@src/mongo/shell/mongo.js:229:14
    @(connect):1:6
    
    exception: connect failed
    

    需要指定mongoDB的路径
    mongod --dbpath D:\mongodb\data\db
    如果目录没有建立,脚本不会自动创建,而是会提示错误,需要手动建立目录,以下为错误信息(供参考):

    D:\Program Files\MongoDB\Server\3.2\bin>mongod --dbpath D:\mongodb\data\db
    2018-07-31T18:08:30.411+0800 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, wi
    ll zero-out data files
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] MongoDB starting : pid=11164 port=27017 dbpa
    th=D:\mongodb\data\db 64-bit host=YIZHAO
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R
    2
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] db version v3.2.20-22-g72058227a2
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] git version: 72058227a20ffded4ead6dc396db0d4
    86b1f1753
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2o-fips  27 Mar
     2018
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] allocator: tcmalloc
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] modules: none
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten] build environment:
    2018-07-31T18:08:30.883+0800 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
    2018-07-31T18:08:30.884+0800 I CONTROL  [initandlisten]     distarch: x86_64
    2018-07-31T18:08:30.884+0800 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-07-31T18:08:30.884+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "D:\mongodb\da
    ta\db" } }
    2018-07-31T18:08:30.885+0800 I STORAGE  [initandlisten] exception in initAndListen: 29 Data director
    y D:\mongodb\data\db not found., terminating
    2018-07-31T18:08:30.885+0800 I CONTROL  [initandlisten] dbexit:  rc: 100
    

    创建好目录再次启动会看到正常

    D:\Program Files\MongoDB\Server\3.2\bin>mongod --dbpath D:\mongodb\data\db
    2018-07-31T18:09:31.304+0800 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, wi
    ll zero-out data files
    2018-07-31T18:09:31.762+0800 I CONTROL  [initandlisten] MongoDB starting : pid=12104 port=27017 dbpa
    th=D:\mongodb\data\db 64-bit host=YIZHAO
    2018-07-31T18:09:31.764+0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R
    2
    2018-07-31T18:09:31.767+0800 I CONTROL  [initandlisten] db version v3.2.20-22-g72058227a2
    2018-07-31T18:09:31.768+0800 I CONTROL  [initandlisten] git version: 72058227a20ffded4ead6dc396db0d4
    86b1f1753
    2018-07-31T18:09:31.771+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2o-fips  27 Mar
     2018
    2018-07-31T18:09:31.775+0800 I CONTROL  [initandlisten] allocator: tcmalloc
    2018-07-31T18:09:31.777+0800 I CONTROL  [initandlisten] modules: none
    2018-07-31T18:09:31.779+0800 I CONTROL  [initandlisten] build environment:
    2018-07-31T18:09:31.781+0800 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
    2018-07-31T18:09:31.785+0800 I CONTROL  [initandlisten]     distarch: x86_64
    2018-07-31T18:09:31.787+0800 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-07-31T18:09:31.788+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "D:\mongodb\da
    ta\db" } }
    2018-07-31T18:09:31.799+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=4G
    ,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(e
    nabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),check
    point=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
    2018-07-31T18:09:32.234+0800 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonical
    ization worker
    2018-07-31T18:09:34.168+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data captu
    re with directory 'D:/mongodb/data/db/diagnostic.data'
    2018-07-31T18:09:34.175+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
    2018-07-31T18:10:43.962+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:13654 #1
    (1 connection now open)
    

    相关文章

      网友评论

          本文标题:mongodb 安装常见异常

          本文链接:https://www.haomeiwen.com/subject/mnqhvftx.html