Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to configure a replica set with three nodes: node A, B and C. I execute the rs.add()'s from node A and after that rs.status() shows that the three nodes are PRIMARY. Moreover node B and C have 0 pingMs. If I execute rs.status() from node B or C the only node listed is the self (As PRIMARY). I tried adding an arbiter but it didn't work (it behaved as the nodes B and C). I think this can be a networking problem but I can't figure it out.

Edit: This is the output for netstat -anp|grep 27017:

tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      -
tcp        0      0 10.0.1.211:55772        10.0.1.213:27017        TIME_WAIT   -
tcp        0      0 127.0.0.1:50509         127.0.0.1:27017         ESTABLISHED -
tcp        0      0 127.0.0.1:27017         127.0.0.1:50509         ESTABLISHED -
tcp        0      0 10.0.1.211:55774        10.0.1.213:27017        TIME_WAIT   -
tcp        0      0 10.0.1.211:55776        10.0.1.213:27017        ESTABLISHED -
tcp        0      0 10.0.1.211:39180        10.0.1.212:27017        ESTABLISHED -
tcp        0      0 10.0.1.211:39178        10.0.1.212:27017        TIME_WAIT   -
tcp        0      0 10.0.1.211:39176        10.0.1.212:27017        TIME_WAIT   -
unix  2      [ ACC ]     STREAM     LISTENING     3291267  -                   /tmp/mongodb-27017.sock

the private ips for the node B and C are 10.0.1.212 and 10.0.1.213 respectively (they appear to have an established connection in the 27017 port according to the netstat output).

share|improve this question
    
Sorry, my mistake. Please refer to stackoverflow.com/questions/12522349/… –  miguel Oct 25 '12 at 5:41
add comment

1 Answer

Sounds like the mongo process on Node A didn't actually manage to contact the other two nodes. There are three big arrows pointing to that:

  1. Node A reports all are in PRIMARY. Primary election happens after connection is established. If connection is not yet established, it'll show PRIMARY on everything.
  2. Ping=0. If a connection is established, this should be non-zero.
  3. Nodes B & C haven't heard of any other nodes. If connection happened, they'd have been told that the other nodes are there.

At this point I'd make double sure that...

  • Any firewalls are passing the right port through (usually 27017, but check /etc/mongodb.conf to be certain)
  • Mongo is listening to the expected ports on Nodes B & C.
    • netstat -anp should show a LISTEN port for the Mongo process. Make sure that port's the one you're expecting.
share|improve this answer
    
I am not sure about how to do the first thing you say (I am new to linux). I configured the mongodb.conf file to listen to the 27017 port and I didn't specify a bind_ip (According to mongodb.org/display/DOCS/… "To enable listening on all interfaces, remove the bind_ip option from your server configuration file"). The netstat command shows LISTEN (All the output is up) in the 27017 port. –  miguel Oct 2 '12 at 3:23
    
@miguel sudo iptables -L will give you the output for that. Fixing it depends on your distro. –  sysadmin1138 Oct 2 '12 at 11:23
    
I am using debian and the ifconfig command doesn't have a -L option. What does it do? –  miguel Oct 2 '12 at 11:59
    
@miguel I had the wrong command, see the edited comment. –  sysadmin1138 Oct 2 '12 at 12:10
    
in every node it shows "policy ACCEPT" for every chain –  miguel Oct 2 '12 at 13:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.