mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
47 lines
1.9 KiB
Plaintext
47 lines
1.9 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * getting-started/openshift-cli.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="getting-started-cli-connecting-database_{context}"]
|
|
= Connecting to a database
|
|
|
|
Deploy and connect a MongoDB database where the `national-parks-app` application stores location information.
|
|
Once you mark the `national-parks-app` application as a backend for the map visualization tool, `parksmap` deployment uses the {product-title} discover mechanism to display the map automatically.
|
|
|
|
.Prerequisites
|
|
|
|
* You must have access to an {product-title} cluster.
|
|
* You must have installed the OpenShift CLI (`oc`).
|
|
* You have a deployed image.
|
|
|
|
.Procedure
|
|
|
|
* To connect to a database, enter the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc new-app quay.io/centos7/mongodb-36-centos7:master --name mongodb-nationalparks -e MONGODB_USER=mongodb -e MONGODB_PASSWORD=mongodb -e MONGODB_DATABASE=mongodb -e MONGODB_ADMIN_PASSWORD=mongodb -l 'app.kubernetes.io/part-of=national-parks-app,app.kubernetes.io/name=mongodb'
|
|
----
|
|
+
|
|
.Example output
|
|
+
|
|
[source,terminal]
|
|
----
|
|
--> Found container image dc18f52 (3 years old) from quay.io for "quay.io/centos7/mongodb-36-centos7:master"
|
|
|
|
MongoDB 3.6
|
|
-----------
|
|
MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. This container image contains programs to run mongod server.
|
|
|
|
Tags: database, mongodb, rh-mongodb36
|
|
|
|
* An image stream tag will be created as "mongodb-nationalparks:master" that will track this image
|
|
|
|
--> Creating resources with label app.kubernetes.io/name=mongodb,app.kubernetes.io/part-of=national-parks-app ...
|
|
imagestream.image.openshift.io "mongodb-nationalparks" created
|
|
deployment.apps "mongodb-nationalparks" created
|
|
service "mongodb-nationalparks" created
|
|
--> Success
|
|
----
|