code4jhon
code4jhon

Reputation: 6034

Can I have more than one database per gear in openshift?

I've deployed Java apps and now a Grails app connected in OpenShift ... so far so good (cool service)

I can deploy more than 1 app to a single gear... but can I have more than 1 DB per gear ?

This config is making me think I can't

  String host = System.getenv('OPENSHIFT_MYSQL_DB_HOST')
  String port = System.getenv('OPENSHIFT_MYSQL_DB_PORT')
  String dbName = System.getenv('OPENSHIFT_APP_NAME')
  url = "jdbc:mysql://$host:$port/$dbName"
  username = System.getenv('OPENSHIFT_MYSQL_DB_USERNAME')
  password = System.getenv('OPENSHIFT_MYSQL_DB_PASSWORD')

took from this post: Configuring DataSource.groovy for Openshift for Grails

If I couldn't have more than DB per gear would suck ...

So can I have more than 1 DB per gear ?

Upvotes: 3

Views: 754

Answers (1)

niharvey
niharvey

Reputation: 2807

Would having just another database created on the gear suffice? or do you want 2 separate mysql processes running?

If you want two separate databases you could just ssh into your gear, use mysql to create another database. Then just create a custom environment variable to reference that second DB. ie. you could use $OPENSHIFT_APP_DB2 and use the same host and port details to connect.

If you need help getting custom environment variables you could use this for reference.

Upvotes: 7

Related Questions