Linux上mongodb開機自啟動

來源:互聯網
上載者:User

標籤:linu   png   image   分享   tar   mkdir   port   重啟   fork   

1、下載MongoDB

2、安裝MongoDB(安裝到/usr/local下)

1 tar -xzvf mongodb-linux-x86_64-2.4.9.tgz2 mv mongodb-linux-x86_64-2.4.9 mongodb3 cd mongodb4 mkdir db5 mkdir logs6 cd bin7 vi mongodb.conf
把下面的代碼複製到mongodb.conf中,儲存
1 dbpath = /usr/local/mongodb/db2 logpath = /usr/local/mongodb/logs/mongodb.log3 port = 270174 fork = true5 nohttpinterface=true6 logappend = true

 3、重新綁定mongodb的設定檔地址和訪問IP,執行 ./bin/mongod --bind_ip localhost -f /usr/local/mongodb/bin/mongodb.conf(如所示)

4、開機自動啟動mongodb,編輯/etc/rc.d/rc.local,在檔案後面加上如下這行

1 /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf

5、重啟,測試成功

 

Linux上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.