標籤:bin port tar blog mongodb starting log檔案 多個 ecif
擷取mongoDB
訪問https://www.mongodb.com/download-center,下載最新版本的mongoDB,按照指引一步一步安裝即可
配置mongoDB作為windows服務啟動建立一個設定檔
需要建立一個設定檔,設定檔必須設定 systemLog.path系統日誌的路徑
例如, 在 C:\Program Files\MongoDB\Server\3.6\mongod.cfg 建立一個設定檔,設定systemLog.path 和 storage.dbPath:
systemLog: destination: file path: c:\data\log\mongod.logstorage: dbPath: c:\data\db
作為windows 服務安裝
Install the MongoDB service by starting mongod.exe with the --install option and the -config option to specify the previously created configuration file.
安裝mongoDB服務通過“mongod.exe” 和 “--install” 選項 和 “--config”選項來使用指定的設定檔安裝。
例如:
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\3.6\mongod.cfg" --install
如果需要的話,還可以安裝多個執行個體 mongod.exe or mongos.exe,但是要為每個服務一個獨一無二的名字, --serviceName and --serviceDisplayName.
開始mongoDB服務
net start MongoDB
驗證服務是否啟動成功了
開啟剛才的配置路徑下的log檔案,如果看到了下面的話 那麼成功了!
[initandlisten] waiting for connections on port 27017
連結mongoDB
通過 mongo.exe shell連結
"C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"
停止
net stop MongoDB
刪除
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --remove
mongoDB的安裝和配置