Yii Framework Forum: Mongoyii And Connection Using Openshift - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Mongoyii And Connection Using Openshift connection Rate Topic: -----

#1 User is offline   enginedave 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 05-March 11
  • Location:Northern Ireland

Posted 09 August 2013 - 04:52 PM

I have successfully uploaded the yii template application to OpenShift and added the MongoDB (version 2.2) service to my app. However I don't seem to be able to make the connection.

OpenShift give me the following information (slightly changed here for security):

MongoDB 2.2 database added.  Please make note of these credentials:
   Root User:     admin
   Root Password: 3Uhu78sikjat
   Database Name: newmdb
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/


This is what I have added to the main.php file

'mongodb' => array(
			'class' => 'EMongoClient',
			'server' => 'mongodb://admin:3Uhu78sikjat@$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/',
			'db' => 'newmdb'
		),


I have been able to get this working locally but cannot connect once uploaded to the host service. Any ideas what I'm doing wrong? This is the message i get from the server...

Failed to connect to: $OPENSHIFT_MONGODB_DB_HOST:0: No such file or directory

0

#2 User is offline   enginedave 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 05-March 11
  • Location:Northern Ireland

Posted 10 August 2013 - 03:36 PM

View Postenginedave, on 09 August 2013 - 04:52 PM, said:

I have successfully uploaded the yii template application to OpenShift and added the MongoDB (version 2.2) service to my app. However I don't seem to be able to make the connection.

OpenShift give me the following information (slightly changed here for security):

MongoDB 2.2 database added.  Please make note of these credentials:
   Root User:     admin
   Root Password: 3Uhu78sikjat
   Database Name: newmdb
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/


This is what I have added to the main.php file

'mongodb' => array(
			'class' => 'EMongoClient',
			'server' => 'mongodb://admin:3Uhu78sikjat@$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/',
			'db' => 'newmdb'
		),


I have been able to get this working locally but cannot connect once uploaded to the host service. Any ideas what I'm doing wrong? This is the message i get from the server...

Failed to connect to: $OPENSHIFT_MONGODB_DB_HOST:0: No such file or directory



Eventually got this to work by SSH into the remote server on OpenShift get the values of the environment variables and explicitly put them into the string so that it becomes :

'mongodb' => array(
			'class' => 'EMongoClient',
			'server' => 'mongodb://admin:3Uhu78sikjat@$127.3.48.9:27017/',
			'db' => 'newmdb'
		),

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users