MongoDB配置簡明文檔

來源:互聯網
上載者:User

標籤:系統內容   idf   變數   bash   rhel   std   程式包   $path   \n   

1、下載MongoDB程式包(RHEL 7 Linux 64-bit x64)

[[email protected] /]# wget -P/usr/local/src/ https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.1.tgz

2、解壓程式包:

[[email protected] /]# tar -xzvf mongodb-linux-x86_64-rhel70-4.0.1.tgz -C /usr/local/src/[[email protected] /]# mv /usr/local/src/mongodb-linux-x86_64-rhel70-4.0.1 /usr/local/mongodb

3、建立程式運行所需的目錄:

[[email protected] /]# mkdir /usr/local/mongodb/etc /usr/local/mongodb/data /usr/local/mongodb/log

4、建立MongoDB設定檔:

[[email protected] /]# vim /usr/local/mongodb/etc/mongod.confdbpath = /usr/local/mongodb/data/logpath = /usr/local/mongodb/log/mongodb.logpidfilepath = /usr/local/mongodb/log/mongodb.pidbind_ip = 127.0.0.1port = 27017fork = true

5、啟動MongoDB程式:

[[email protected] /]# /usr/local/mongodb/bin/mongod -f /usr/local/mongodb/etc/mongod.conf

6、MongoDB添加到系統內容變數:

[[email protected] /]# sed -i ‘$a export MONGODB_HOME=/usr/local/mongodb\nexport PATH=$MONGODB_HOME/bin:$PATH‘ /etc/profile
[[email protected] /]# source /etc/profile

7、MongoDB用戶端登入:

[[email protected] /]# mongoMongoDB shell version v4.0.1connecting to: mongodb://127.0.0.1:27017MongoDB server version: 4.0.1

[THE END]

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.