mongoDB的安裝和配置

來源:互聯網
上載者:User

標籤: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的安裝和配置

聯繫我們

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