Bug 831966

Summary: cannot connect to mongo db via mongo shell for scalable jbosseap app
Product: OKD Reporter: Meng Bo <bmeng>
Component: ContainersAssignee: Mrunal Patel <mpatel>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: mpatel, xtian
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-25 18:27:16 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:
Attachments:
Description Flags
development log
none
mcollective log
none
mcollective-client log none

Description Meng Bo 2012-06-14 08:14:50 UTC
Description of problem:
mongo shell not work for scalable jbosseap app with mongodb embedded.

Version-Release number of selected component (if applicable):
cartridge-mongodb-2.0-0.21.3-1.git.0.d9f2d51.el6.noarch
cartridge-jbosseap-6.0-0.1.6-1.git.19.27af983.el6.noarch

How reproducible:
always

Steps to Reproduce:
1.create scalable jbosseap app
2.embedded mongodb to it
3.ssh login to the app
4.try mongo shell
  
Actual results:
[jeap-bmengint2.int.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.2
connecting to: test
Thu Jun 14 03:44:33 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed

Expected results:
should connect to the mongodb without problem

Additional info:
this issue not exist for normal jbosseap app

Comment 1 Mrunal Patel 2012-06-15 14:53:35 UTC
Was not able to reproduce. Could you provide mcollective/broker logs?

Comment 2 Meng Bo 2012-06-18 10:38:56 UTC
Still can reproduce this issue on devenv_1850, sometimes, the mongo shell can connect to the instance mongodb but not the application's.
Cannot get useful logs from instance.

Comment 3 Mrunal Patel 2012-06-19 22:36:45 UTC
It is just the DNS propagating. If you keep retrying after a few seconds, it eventually succeeds.

Comment 4 Meng Bo 2012-06-21 02:51:02 UTC
Checked this issue again on devenv_1860, issue still exist.

After embed mongodb to scalable jbosseap application, ssh to the application and run mongo shell. It will connect to the instance mongodb but not the applications.

[jbosseap1s-bmengdev.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.2
connecting to: test
PRIMARY> show dbs
admin	(empty)
local	0.0546875GB
openshift_broker_dev	0.0546875GB

When trying to connect to the application mongodb with specified the db dns, it can connect to it.

[jbosseap1s-bmengdev.dev.rhcloud.com ~]\> mongo ef3f33e451-bmengdev.dev.rhcloud.com:35541
MongoDB shell version: 2.0.2
connecting to: ef3f33e451-bmengdev.dev.rhcloud.com:35541/test
> show dbs
Wed Jun 20 22:36:49 uncaught exception: listDatabases failed:{ "errmsg" : "need to login", "ok" : 0 }

When trying to check the ENV vars of the application for mongodb info, get nothing about it.

[jbosseap1s-bmengdev.dev.rhcloud.com ~]\> env|grep -i nosql
[jbosseap1s-bmengdev.dev.rhcloud.com ~]\>

[jbosseap1s-bmengdev.dev.rhcloud.com .env]\> ls
JAVA_HOME		   OPENSHIFT_GEAR_DNS		OPENSHIFT_JBOSS_CLUSTER			   OPENSHIFT_PROXY_PORT
M2_HOME			   OPENSHIFT_GEAR_NAME		OPENSHIFT_JBOSS_CLUSTER_PORT		   OPENSHIFT_REPO_DIR
OPENSHIFT_APP_DNS	   OPENSHIFT_GEAR_TYPE		OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT	   OPENSHIFT_RUN_DIR
OPENSHIFT_APP_NAME	   OPENSHIFT_GEAR_UUID		OPENSHIFT_JBOSS_CLUSTER_REMOTING	   OPENSHIFT_RUNTIME_DIR
OPENSHIFT_APP_UUID	   OPENSHIFT_HAPROXY_STATUS_IP	OPENSHIFT_JBOSS_MESSAGING_PORT		   OPENSHIFT_TMP_DIR
OPENSHIFT_DATA_DIR	   OPENSHIFT_HOMEDIR		OPENSHIFT_JBOSS_MESSAGING_THROUGHPUT_PORT  PATH
OPENSHIFT_GEAR_CTL_SCRIPT  OPENSHIFT_INTERNAL_IP	OPENSHIFT_JBOSS_REMOTING_PORT		   USER_VARS
OPENSHIFT_GEAR_DIR	   OPENSHIFT_INTERNAL_PORT	OPENSHIFT_LOG_DIR
[jbosseap1s-bmengdev.dev.rhcloud.com .uservars]\> ls
[jbosseap1s-bmengdev.dev.rhcloud.com .uservars]\>

Comment 5 Meng Bo 2012-06-21 02:51:48 UTC
Created attachment 593336 [details]
development log

Comment 6 Meng Bo 2012-06-21 02:52:24 UTC
Created attachment 593337 [details]
mcollective log

Comment 7 Meng Bo 2012-06-21 02:52:52 UTC
Created attachment 593338 [details]
mcollective-client log

Comment 8 Meng Bo 2012-06-21 02:53:47 UTC
Attached all the avaiable logs for help debug.

Comment 9 Xiaoli Tian 2012-06-21 11:51:35 UTC
Notes, if you only type mongo, the DB you connected is the mongo in the sever, not the mongo we add for the cartridge.

Comment 10 Mrunal Patel 2012-06-21 15:14:56 UTC
Nosql connection hook was missing from the spec file. Submitted
https://github.com/openshift/crankcase/pull/154 with the fix.

Comment 11 Xiaoli Tian 2012-06-23 04:19:49 UTC
Verified it on stage-2.0.13

[scalejbosseap2-domainxstg1.stg.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.2
connecting to: 8ff7774e60-domainxstg1.stg.rhcloud.com:42181/admin
> show dbs
'admin	0.03125GB
local	(empty)
scalejbosseap2	0.03125GB
> use scalejbosseap2
switched to db scalejbosseap2