1

I try to add another net with the its corresponding bind ip and port to my AMI ec2 mongod.conf file so I will be able to create a 2 node replica set but when I run the command "sudo service mongos restart", mongos won't start. Here is my mongos.conf file:

# 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: /var/lib/mongo
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
  bindIp: 172.31.90.193 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
net:
  port: 27017
  bindIp: 172.31.92.31
#security:

#operationProfiling:

replication:
 replSetName: "Midterm"

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

Does anyone know why this is happening? I tried doing this in a vm using vagrant and it worked. Why would be any different in AMI ec2?

**UPDATE:

This is what the security group of one of my instances looks like: enter image description here

  • this works if I'm setting the replica set on 1 machine but im trying to create a 3 node replica set, meaning that I have 3 VMs and want to make a replica set where there is 1 instance on each machine – tom dinh Mar 19 at 23:33
  • the 1st node I made as primary couldn't find the second node to add to the replica set. – tom dinh Mar 20 at 0:25
  • Are you able to connect to the MongoDB running on the second machine from the first machine through mongo shell? If not enable inbound ports in the second machine, check the config file binip as well. – Mani Mar 20 at 0:30
  • if you mean ping, I can ping the bindIp of the machines on each other and there is a response – tom dinh Mar 20 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.