MongoDB學習筆記-- 安裝(一)

MongoDB是一種面向文檔的數據庫,而非傳統的關係型數據庫,能夠大多數的平臺如運行。 linux

當前最新版本爲:2.4  下載地址:http://www.mongodb.org/downloads mongodb

安裝步驟(windows): 數據庫

  1. 解壓下載的mongodb-win32....*.zip,而後C盤下建立一個mongodb的文件夾:C:\mongodb.解壓包中包含一個bin文件夾。將bin文件夾拷貝到mongodb文件夾中。
  2. 建立data文件夾,而後分別創建db,log文件夾。由於MongoDB須要一個data文件夾來存儲他的文件。默認路徑爲: C:\data\db。(MongoDB requires a data folder to store its files. The default location for the MongoDB data directory is C:\data\db
  3. 在log文件夾中建立MongoDB.log日誌文件。
  4. 運行cmd,進入bin目錄。
  5. 運行
    C:\mongodb\bin\mongod.exe --dbpath c:\mongodb\data\db
    若是出現錯誤碼,請以管理員身份運行cmd.
  6. 執行mongo.exe,進入mongodb。
     c:\mongodb\bin>mongod
      
    This will start the main MongoDB database process. The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.
    db.test.save({a:1})
     db.test.find()
  7. 使MognoDB 做爲一個Windows Service:(Setup MongoDB as a Windows Service, so that the database will start automatically following each reboot cycle.)
  8. c:\mongodb\bin>
    C:mongodb\bin>mongod --dbpath "C:\mongodb\data\db" --logpath "C:\mongodb\data\log\MongoDB.log" --install --serviceName "MongoDB"

  9. 至此,服務已經安裝成功。 

       NET START MongoDB   (開啓服務) ubuntu

        NET stop MongoDB   (關閉服務) windows

相關文章
相關標籤/搜索