Skip to content

Instantly share code, notes, and snippets.

@saurabh2590
Last active June 27, 2022 08:53
Show Gist options
  • Save saurabh2590/8e5f80312239ca988542f9ae707605ab to your computer and use it in GitHub Desktop.
Save saurabh2590/8e5f80312239ca988542f9ae707605ab to your computer and use it in GitHub Desktop.
mongodb.conf & rs.conf
# mongod.conf
storage:
engine: wiredTiger
dbPath: /data/mongo/db
directoryPerDB: true
wiredTiger:
engineConfig:
directoryForIndexes: true
cacheSizeGB: 110
journal:
enabled: true
systemLog:
destination: file
path: /var/log/mongodb/mongod.log
logAppend: true
operationProfiling:
slowOpThresholdMs: 1000
processManagement:
fork: true
pidFilePath: /var/run/mongodb/mongod.pid
net:
port: 27017
security:
authorization: enabled
clusterAuthMode: keyFile
keyFile: /etc/mongod/keyfile
replication:
replSetName: betterSet
oplogSizeMB: 65536
## rs.conf() output
{
"_id" : "betterSet",
"version" : 13,
"members" : [
{
"_id" : 0,
"host" : "mongo01.pro00.pro.bm.loc:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 1,
"host" : "mongo02.pro00.pro.bm.loc:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 2,
"host" : "mongo03.pro00.pro.bm.loc:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 0,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 0
},
{
"_id" : 3,
"host" : "mongo04.pro00.pro.bm.loc:27017",
"arbiterOnly" : true,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
}
],
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
}
}
}
## Contents of /data/mongo/db/WiredTiger.basecfg
# Do not modify this file.
#
# WiredTiger created this file when the database was created,
# to store persistent database settings. Instead of changing
# these settings, set a WIREDTIGER_CONFIG environment variable
# or create a WiredTiger.config file to override them.
version=(major=2,minor=5)
cache_size=24G
checkpoint=(wait=60,log_size=2GB)
eviction=(threads_max=4)
file_manager=(close_idle_time=100000)
log=(enabled=true,archive=true,path=journal,compressor=snappy)
session_max=20000
statistics=(fast)
statistics_log=(wait=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment