【MongoDB】Configure a Windows Service for MongoDB,mongodbconfigure

來源:互聯網
上載者:User

【MongoDB】Configure a Windows Service for MongoDB,mongodbconfigure

In this blog, I will mainly attach great importantance to how to create a windows service for mongodb. The method described in the next is referred from the official website of mongodb. 

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/


  • First of all, create the folder and files that need to store db and log. if you forgot, you could view the above the blog. In my local machine,


  • create a configuration file 
create  a configuration file, this file can include any of the configuration options for mongod, but must include a valid setting for logpath. we can learn from the next picture that echo command promart. 

  • create the mongodb service. use the following command. and use command ’net start mongodb ‘ to start the service. 


in the meantime, we could use anther way to start service. 


  • use the command { net stop mongoDB} to stop this server or in the above service window.


WIN7下,將MongoDB作為 Windows 服務Install失敗

這個問題我也遇到過,以管理員身份運行cmd,然後再執行以上命令就OK了。
 
在Linux系統上裝有一個MongoDB資料庫,怎配置成Linux系統上的為主,Windows系統上的MongoDB為從資料庫?

在啟動Linux上的mongodb時使用master參數,在windows上啟動時使用slave參數試試。
不過官方文檔推薦2.4以後都使用replica set,不要再使用主從複製了。
使用replica set需要3個以上的節點,可以設定兩個或以上的資料節點,多個選舉節點,節點數要是基數個,哪個節點時primary由系統自己決定就好。
沒有試過在Linux和windows上同時開啟mongodb。
開啟mongodb的參數可以參考這裡:
docs.mongodb.org/...tions/
主從複製資訊參考這裡:

docs.mongodb.org/manual/core/master-slave/
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.