Well it’s very strange I was running this setup without issues for over 6 months and all of a sudden I was unable to connect through mongos.
These are the commands I use to connect to the mongos instance:
mongo 10.4.44.88 -u mongo-admin -p --authenticationDatabase admin
To rule out network issues I have tried SSHing directly to the host and using mongo client there:
mongo localhost -u mongo-admin -p --authenticationDatabase admin
I don’t really get any errors it sort of just times out… It just says:
connecting to: mongodb://10.4.44.88:27017/test
Even after increasing the verbosity of the mongos instance I was unable to determine what causes the client to get stuck.
Mongos configuration:
Start command:
/usr/bin/mongos --config /etc/mongos.conf
mongos.conf:
[Unit]
Description=Mongo Cluster Router
After=network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongos --config /etc/mongos.conf
# 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
[Install]
WantedBy=multi-user.target
root@zenv-0689:~# cat /etc/mongos.conf
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongos.log
logRotate: reopen
processManagement:
pidFilePath: /var/run/mongodb/mongos.pid
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
security:
keyFile: /var/lib/mongodb/keyfile
sharding:
configDB: configReplSet/mongo-config01:27019,mongo-config02:27019,mongo-config03:27019
Mongod config servers:
Start command:
/usr/bin/mongod --config /etc/mongod.conf
mongod.conf:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
logRotate: reopen
processManagement:
pidFilePath: /var/run/mongodb/mongod.pid
# network interfaces
net:
port: 27019
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
security:
keyFile: /var/lib/mongodb/keyfile
replication:
replSetName: configReplSet
sharding:
clusterRole: "configsvr"
Mongod shard servers:
Start command:
/usr/bin/mongod --config /etc/mongod.conf
mongod.conf:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
logRotate: reopen
processManagement:
pidFilePath: /var/run/mongodb/mongod.pid
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
security:
keyFile: /var/lib/mongodb/keyfile
#operationProfiling:
replication:
replSetName: Shard00
#sharding:
sharding:
clusterRole: shardsvr
#auditLog:
#snmp: