MongoDB 通過設定檔啟動及註冊服務

來源:互聯網
上載者:User

標籤:mongod   註冊   pat   ODB   註冊系統   tar   class   img   直接   

1.配置mongodb環境變數,配置完成之後就可以直接執行mong、mongod等常用命令,不用每次都到mongodb安裝目錄bin下去執行;

2.通過命令啟動mongo服務

mongod --dbpath = D:\mongodb\data\db --logpath = D:\mongodb\data\log\mongod.log

3.每次都通過命令去啟動mongod太麻煩,那就註冊系統服務

mongod --install --dbpath = D:\mongodb\data\db --logpath = D:\mongodb\data\log\mongod.log

註冊完成之後,就可以在系統服務中找到mongodb 服務了,以後就不用每次都同過命令列來啟動服務了

 

4.通過設定檔來啟動mongo服務,設定檔需要自己建立,只需要在-f 後制定你自己的設定檔路徑即可

mongod -f D:\mongodb\conf\mongo.conf

設定檔內容如下,你可以根據自己需要增加或修改設定檔

dbpath = D:\mongodb\data\dblogpath = D:\mongodb\data\log\mongod.loglogappend = trueport = 27017

5.通過設定檔註冊服務,同直接制定dbpath和logpath類似,只不過這些參數資訊都在設定檔中

mongod --install -f D:\mongodb\conf\mongo.conf

 

完成服務註冊後就可通過net start及 net stop命令來啟動或停止mongo服務了,這樣是不是方便很多

MongoDB 通過設定檔啟動及註冊服務

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.