【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/