MongoDB 3.2 在CentOS 上的安裝和配置

來源:互聯網
上載者:User

標籤:etc   sha   tor   roc   epo   process   system   kernel   shell   

MongoDB 3.2 在CentOS 上的安裝和配置  2016-01-06 14:41:41 發布
您的評價:       0.0  
收藏     0收藏一、安裝

編輯/etc/yum.repos.d/mongodb-org-3.2.repo

[mongodb-org-3.2]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/gpgcheck=0enabled=1

 

yum install -y mongodb-org

 

二、配置

編輯/etc/mongod.conf

# mongod.conf# for documentation of all options, see:#   http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.systemLog:  destination: file  logAppend: true  path: /var/log/mongodb/mongod.log# Where and how to store data.storage:  dbPath: /data/mongo  journal:    enabled: true#  engine:#  mmapv1:#  wiredTiger:# how the process runsprocessManagement:  fork: true  # fork and run in background  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile# network interfacesnet:  port: 27017  bindIp: 127.0.0.1,<內網IP> # Listen to local interface only, comment to listen on all interfaces.注意不要逗號前後不要有空格#security:#operationProfiling:#replication:#sharding:## Enterprise-Only Options#auditLog:

 

執行

echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag

 

編輯/etc/rc.local,添加

echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag

 

編輯vi /etc/security/limits.d/99-mongodb-nproc.conf

# Default limit for number of user‘s processes to prevent# accidental fork bombs.# See rhbz #432903 for reasoning.*          soft    nproc     35000root       soft    nproc     unlimited

 

三、防火牆
iptables -I INPUT 10 -s <允許ip> -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPTiptables -A OUTPUT -d <允許ip> -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT

MongoDB 3.2 在CentOS 上的安裝和配置

聯繫我們

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