I honestly have no clue why is this happening. my security group (for testing purpose) are open to all kind of traffic from anywhere.
i put:
sleep 60;
mongo --host mongodb://10.0.1.100 --port 27017 --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "10.0.1.100:27017", priority: 2}, {_id: 1, host: "10.0.2.100:27017"}, {_id: 2, host: "10.0.3.100:27017"}]})'
but still unable to run the replica from bash.
my mongodb.log states this:
2020-05-12T01:10:51.372+0000 I REPL [initandlisten] Did not find local voted for document at startup.
2020-05-12T01:10:51.372+0000 I REPL [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset
One more thing. in my mongod.conf i am binding my IP to 0.0.0.0. this is my 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
# network interfaces
net:
port: <%= @port %>
bindIp: <%= @bindIp %>
#processManagement:
#security:
#operationProfiling:
#replication:
replication:
replSetName: rs0
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
where port is 27017 and bindip is 0.0.0.0
if i run the same command from mongo console. i got this output in my mongo.log:
I REPL [conn161] replSetInitiate admin command received from client
2020-05-12T01:30:39.128+0000 W NETWORK [conn161] getaddrinfo("ip-10-0-1-100") failed: Name or service not known
2020-05-12T01:30:39.128+0000 I NETWORK [conn161] getaddrinfo("ip-10-0-1-100") failed: Name or service not known
2020-05-12T01:30:39.128+0000 E REPL [conn161] replSet initiate got NodeNotFound: No host described in new configuration 1 for replica set rs0 maps to this node while validating { _id: "rs0", version: 1, members: [ { _id: 0, host: "ip-10-0-1-100:27017" } ] }