It was silly mistake by me. I did make proper changes to Firewall settings but I didn't reboot my machine.
After that, it was working fine :)
Question
For implementing Replication, I need to make sure that my 2 Mongo Instances are able to communicate with each other. For ex my IP is as follow
Instance 1 - 1.2.3.4
Instance 2 - 1.2.5.6
When i log into my first machine & run the following command
mongo --host 1.2.5.6 --port 27017
I get the following error
MongoDB shell version: 2.6.0
connecting to: 10.128.194.89:27017/test
2014-04-29T03:48:42.198-0400 warning: Failed to connect to 10.128.194.89:27017, reason: errno:111 Connection refused
2014-04-29T03:48:42.199-0400 Error: couldn't connect to server 10.128.194.89:27017 (10.128.194.89), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
I guessed I need to change my firewall settings for this server. So after enabling UFW, the output is this
To Action From
-- ------ ----
22 ALLOW Anywhere
80/tcp ALLOW Anywhere
Anywhere ALLOW 107.170.47.82
22 ALLOW Anywhere (v6)
80/tcp ALLOW Anywhere (v6)
Also in both the mongod.conf files i have commented out bind_ip
parameter to enable remote connections. I am not sure what I am missing out.
Solution
It was silly mistake by me. I did make proper changes to Firewall settings but I didn't reboot my machine.
After that, it was working fine :)