Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1112416

Summary: mongodb init script status check does not work with bind_ip = 0.0.0.0
Product: Red Hat OpenStack Reporter: Jon Jozwiak <jjozwiak>
Component: mongodbAssignee: Flavio Percoco <fpercoco>
Status: CLOSED ERRATA QA Contact: Ami Jeain <ajeain>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.0CC: breeler, chrobert, fpercoco, sclewis, yeylon
Target Milestone: rcKeywords: Reopened
Target Release: 5.0 (RHEL 6)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: mongodb-2.4.6-8.el6ost Doc Type: Bug Fix
Doc Text:
When using multiple IP addresses in the bind_ip option, mongodb's init script failed to parse the values, hence it was not possible to check the status of the mongod instance. This new package fixes that issue by considering multiple IP addresses and replacing the wildcard '0.0.0.0' with '127.0.0.1'
Story Points: ---
Clone Of:
: 1112840 (view as bug list) Environment:
Last Closed: 2014-07-28 18:47:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1112840    

Description Jon Jozwiak 2014-06-23 22:45:32 UTC
Description of problem:
If you set the bind_ip to 0.0.0.0 in /etc/mongodb.conf, '/etc/init.d/mongod status' returns with an exit code 1.  This impacts pacemaker HA configuration as the status then is considered failed.  There is a line in /etc/init.d/mongod that looks like this: 

mongostat -n 1 -h <bind_ip> --port <port> &> /dev/null

mongostat fails on the bind_ip as the command cannot be used against 0.0.0.0.  Ideally /etc/init.d/mongod would be modified that if bind_ip is set to 0.0.0.0, run the status check against 127.0.0.1.  


Version-Release number of selected component (if applicable):
mongodb-server-2.4.6-4

How reproducible:
It can be reproduced every time.  

Steps to Reproduce:
1. sed -i -e 's#bind_ip.*#bind_ip = 0.0.0.0#g' /etc/mongodb.conf
2. service mongod restart
3. service mongod status
4. echo $?

Actual results:
1

Expected results:
0

Additional info:

Comment 2 Chris Roberts 2014-06-24 15:38:21 UTC
Is there anyway we can get this backported to RHOS4?

Thanks,

Chris Roberts

Comment 3 Flavio Percoco 2014-06-24 19:25:08 UTC
@Chris, I'm planning to backport this to RHOS4. It won't probably get in until A5, though. I'll clone the bug now.

Comment 4 Perry Myers 2014-07-10 17:56:35 UTC
2.4.9-3.el7ost is on CDN so this is CLOSED->CURRENTRELEASE

Comment 5 Perry Myers 2014-07-10 17:58:51 UTC
Actually this was for RHEL 6 variant, so moving back to MODIFIED

Comment 8 Ami Jeain 2014-07-20 15:28:35 UTC
failedQA:

# sed -i -e 's#bind_ip.*#bind_ip = 0.0.0.0#g' /etc/mongodb.conf
[root@rhos-compute-node-10 ~]# vim /etc/mongodb.conf
[root@rhos-compute-node-10 ~]# service mongod restart
Stopping mongod:                                           [  OK  ]
Starting mongod:                                           [  OK  ]
Waiting for mongod to become available:                    [FAILED]
[root@rhos-compute-node-10 ~]#  service mongod status
mongod (pid  18871) is running...
/etc/init.d/mongod: line 163: [: missing `]'
/etc/init.d/mongod: line 163: 0.0.0.0: command not found
listening on 0.0.0.0:27017
[root@rhos-compute-node-10 ~]# echo $?
1



# rpm -q mongodb
mongodb-2.4.6-5.el6ost.x86_64

Comment 9 Lon Hohberger 2014-07-21 18:30:10 UTC
[ -z "$a" || "$a" = "0.0.0.0" ]
should be
[ -z "$a" -o "$a" = "0.0.0.0" ]

Simple fix.

Comment 10 Lon Hohberger 2014-07-21 20:26:17 UTC
Actually, there was a more subtle change required.  Updating.

Comment 12 Lon Hohberger 2014-07-21 20:35:44 UTC
Testing w/ 0.0.0.0:

[root@localhost ~]# grep bind_ip /etc/mongodb.conf 
bind_ip = 0.0.0.0
[root@localhost ~]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@localhost ~]# service mongod status
mongod is stopped
[root@localhost ~]# service mongod start
Starting mongod:                                           [  OK  ]
Waiting for mongod to become available:                    [  OK  ]
[root@localhost ~]# service mongod status
mongod (pid  16585) is running...
listening on 0.0.0.0:27017
connection test successful

Regression test against normal IP:

[root@localhost ~]# grep bind_ip /etc/mongodb.conf 
bind_ip = 192.168.122.142
[root@localhost ~]# service mongod status
mongod (pid  16757) is running...
listening on 192.168.122.142:27017
connection test successful
[root@localhost ~]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@localhost ~]# service mongod start
Starting mongod:                                           [  OK  ]
Waiting for mongod to become available:                    [  OK  ]
[root@localhost ~]# service mongod status
mongod (pid  16873) is running...
listening on 192.168.122.142:27017
connection test successful

Why not check localhost, too?

[root@localhost ~]# grep bind_ip /etc/mongodb.conf 
bind_ip = 127.0.0.1
[root@localhost ~]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@localhost ~]# service mongod start
Starting mongod:                                           [  OK  ]
Waiting for mongod to become available:                    [  OK  ]
[root@localhost ~]# service mongod status
mongod (pid  17109) is running...
listening on 127.0.0.1:27017
connection test successful

Note: editing the IP while mongodb is running may not work; that is orthogonal to this bugzilla.

Comment 13 Lon Hohberger 2014-07-21 20:48:54 UTC
Identical results on -8 RPM - only change is that if bind_ip is missing in mongodb.conf, we assume it's 0.0.0.0 instead of 127.0.0.1.

Comment 15 Ami Jeain 2014-07-23 11:01:58 UTC
verified. Indeed, you can't modify the conf file while the service is running. You have to stop it before

]# rpm -qa |grep mongodb
mongodb-2.4.6-8.el6ost.x86_64
libmongodb-2.4.6-8.el6ost.x86_64
mongodb-server-2.4.6-8.el6ost.x86_64

Comment 17 errata-xmlrpc 2014-07-28 18:47:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0928.html