Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

Accessing a MongoDB cartridge from your local machine


In the Adding a MongoDB cartridge to your application recipe, you learned how to access a MongoDB database by performing an SSH into the application gear. In this recipe, you will learn how to connect with the MongoDB database from your local machine.

Getting ready

To complete this recipe, you will need an application with a MongoDB cartridge. Refer to the Adding a MongoDB cartridge to your application recipe in this chapter to learn how to add a MongoDB cartridge. Also, you will need the mongo command-line client on your machine. You can download the MongoDB database from the official website at http://www.mongodb.org/downloads/.

How to do it…

Perform the following steps to connect to a MongoDB cartridge from your local machine:

  1. Open a command-line terminal and change the directory to the myapp application directory. Execute the following command to forward remote ports to the local machine:

    $ rhc port-forward --app myapp
    Checking available...