Skip to content

Instantly share code, notes, and snippets.

@anhtranbk
Last active July 27, 2018 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anhtranbk/7a1135a335cde1f95f5f4b919054dc2a to your computer and use it in GitHub Desktop.
Save anhtranbk/7a1135a335cde1f95f5f4b919054dc2a to your computer and use it in GitHub Desktop.
Setup MongoDB on Centos 7
# /usr/lib/systemd/system/mongod.service
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
use local
rs.initiate()
net:
port: 27017
bindIp: 0.0.0.0
replication:
oplogSizeMB: 36864
replSetName: rs0
echo '[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc' > /etc/yum.repos.d/mongodb-org-4.0.repo
yum install -y mongodb-org
systemctl enable mongod
systemctl start mongod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment