How to monitor IBM Compose DB - mongodb

I have an IBM Bluemix app. Bluemix created & deployed a Compose powered MongoDB for me. But I also have a seperate MongoDB deployment on Compose (http://compose.com).
Problem is, the Bluemix created version of MongoDB deployment has some issue I don't know. Because of this, I cannot use any other GUI tool such as Robomongo (https://robomongo.org), MongoClient to monitor the database. But most importantly, I cannot even use mongoimport CLI tool to import data.
So, if there's some way that I can either import the Bluemix created db into the Compose.io website or I can import / use Compose.io created DB into Bluemix, that would be great.

Depends on what you'll do. There is guide on Mongo by BlueMix with reference with Node, there is MongoDB UI written with Node. That is kind of official.
You can connect with other MongoDB UI (I mean full app) if you are using newest DB versions, your shell and DB management GUIs comply with the newest DB features including encryption. There is no official reference, you have to search whole earth, try and fail.
RoboMongo/Robo 3T does not work. You can ask on IBM DeveloperWorks to receive an official answer, I guess you'll get response something like this.

The MongoDB Compose on Bluemix uses SSL. So to connect to it from RoboMongo or another tool you need to either use the certificate displayed on the mongoldb credentials screen or just useunvalidated SSL.
So if this is the blue mix mongoldb URI:
"uri": "mongodb://admin:KUGHDSBKJSLKNA#bluemix-sandbox-xxx-y-portal.z.dblayer.com:29802,bluemix-sandbox-....-dblayer.com:29802/compose?ssl=true&authSource=admin"
You use the following in your GUI Tool:
Hostname: bluemix-sandbox-xxx-y-portal.z.dblayer.com
Port: 29802
User: admin
Password: KUGHDSBKJSLKNA
AuthenticationDB: admin
SSL: Unvalidated.

Related

How can we access Bluemix hosted "Compose for MongoDB" service from "outside"?

Situation:
Have created today a new Compose for MongoDB Service instance in Bluemix
Need:
I have to access this MongoDB DIRECTLY with tools (eg. Mongo Managemant Studio Pro, mongo.exe, etc.) for bulkloading, testing, ad-hoc data fix, etc.
Problem:
I have not found any docs, samples nor a CLEAR statement that
a) gives me some confirmation that THIS is possible
b) gives me COMPLETE information (not just some technical fragments that might have worked year ago) how to do it.
Maybe I am looking to the wrong places or do not know the right people. However I am stuck on this, and before quitting Bluemix MongoDB maybe somebody has a copy/past solution or handson step by step manual.
Any help welcome. Thanks!
Connecting to MongoDB service in Bluemix from an application is possible. For this answer I have used the application "Robo3T" and here are the steps:
Access your MongoDB Service on you Bluemix account. Usually under
"Cloud Foundry Services"
Open section "Manage", from "Connection Settings" copy from "HTTPS" the connection address and port. In this example "sl-eu-lon-2-portal.5.dblayer.com" and "20651"
In Robo3T create a new connection with the connection address from previous step
In tab Authentication configure database name, username and password
. The credentials are found as in step 1
From "Connection Settings" copy the SSL Certificate into a text file and save locally.
In Robo3T Add the certificate to the connection in the "SSL" tab
Test the connection and save the settings
Answer
YES, Bluemix hosted Compose for MongoDB instances can be connected from the mongo Shell and some updated DB Managment tools.
However, you have to make sure, that in case you are running the newest DB versions, that your tools (shell and DB management GUIs) comply with the newest DB features such as encryption etc.
Origin of the Problem
My problem was due to older and therefore incompatible versions of the mongo shell and DB-managment tools running against the newest MongoDB versions with their specialities on encription and multiple servers to be handled in the URI.
At least two DB managment tools are not compatible with the newest DB version and will take their time to get fixed. The problem is, that both will not tell you about this. They just do not not connect. No logs on either side. Period.
So my advise here: look for tool providers who express dedicated compliance with the specific version of your DB.
Advise to the Bluemix Team
It might not take much time to provide some sample connection strings for the most common tools like the mongo shell, MongoBooster, etc. to take the hassle and guesswork out of interpreting the Environment variables and figuring out what is needed for specific connection strings and what is not.
For instance MongoDB Atlas hosting provides for every cluster readymade connection strings for many tools you can just copy/past and done!
Connecting to Atlas took me 5 Minutes. For Bluemix I have lost hours! Not because it is complex, but because the documentation and the generated Info is somehow incomplete and messy - at least for the ones who do not connection strings for their living!

How use posgres or mongo databases in pcf-dev(pivotal cloudfoundry dev)?

dev (replacement of micro cloud foundry) I saw 3 services in marketplace mysql, redis and Rabbit, buy I need use mongo and postgres for my stuff, there is any easy way to add it in this deployment?
PCF Dev does not currently include support for MongoDB or Postgres service instances. It is also not currently possible to install tiles or BOSH releases.
All of these things may be supported eventually, but for now, you can run MongoDB or Postgres on your host system and create a user-provided service instance using the cf CLI.
Here's an example for Postgres: https://docs.tibco.com/pub/bwcf/1.0.0/doc/html/GUID-D7408016-8C7B-4637-BCC5-EDD9D5C52267.html
Note that you must use host.pcfdev.io instead of localhost to refer to the host system (instead of the PCF Dev VM). In the example above, your URL might look like:
url> postgresql://host.pcfdev.io:5432/postgres
(Also note that host.pcfdev.io may actually be host2.pcfdev.io if your system domain is local2.pcfdev.io instead of local.pcfdev.io)
~Stephen Levine, PCF Dev Product Manager

(OpenShift) Sharing MongoDB between Apps not possible anymore?

There are articles both here and over at OpenShift itself that suggest I can configure an app with a MongoDB and then set envvars within other apps to access that DB
e.g.
How do you access a MongoDB database from two Openshift apps?
and
https://blog.openshift.com/sharing-database-across-applications/
Problem is that the envvars/hostname for the app DB is either "localhost" or a dotted-quad (129.xxx.xxx.xxx) which clearly won't (and actually doesn't - I tried it) work if used in a connection-string from another app (in the same OpenShift 'domain'
Is this something OpenShift have done to discourage this sort of usage? at least on the 'free' tier?? - or am I missing something/has anyone got this working atm???
p.s. using the actual connection string for the app (e.g. app-domain.rhcloud.com) doesn't work (even from an 'internally hosted' app)
You need to create the application as scalable, then add MongoDB for it to work correctly. MongoDB will then go onto it's own gear, with it's own ip address and port number (remember to use this port number, or nothing will work).
You will never be able to access your mongodb gear from outside of openshift without using the rhc port-forward command (https://developers.openshift.com/en/managing-port-forwarding.html) because of firewall & other security issues.
However, if you use the scaled application approach, you will be able to connect to your mongodb instance from other openshift online hosted applications.

mongodb - user connection string, secure password

I've been following a tutorial with express, node and mongo.
I have in a config file on the server side:
production:{
db:'mongodb://MYUSERNAME:MYPASSWORD#ds033307.mongolab.com:33307/dbname',
rootPath:rootPath,
port:process.env.PORT||80
}
so, i have my username and password in clear text in a server side javascript file. should i be worried about this? if yes, where else can I put it?
Thanks.
Edit: I went back and had a look at mongolab and heroku (where my site is hosted) docs.
Where I found: "The MongoLab add-on contributes one config variable to your Heroku environment: MONGOLAB_URI", and so I was able to put the MONGOLAB_URI env var into my config and move the password out of the source code.
With regards to the same datacenter, am I right to assume heroku would not be hosting my mongolab database in their datacenter, but would instead be calling out to a cloud service mongo database? Not much I can do then, is there, if I want to stick with mongolab and heroku?
I know this question is old but according to Heroku's docs they currently use 2 datacenters (https://devcenter.heroku.com/articles/regions#data-center-locations).
Their US server is 'amazon-web-services::us-east-1' and their EU alternative is 'amazon-web-services::eu-west-1'.
Both of these data centers are available when launching mongo instances on Mongolab so you can choose for both your app and your db to be on the same datacenter giving much improved security.
I think you should always be concerned about storing passwords in source code files. Generally you would be much better off keeping it in a configuration file that is managed separately. This gives you the flexibility to use the same code with a different configuration file to point to development or qa databases.
Of bigger concern perhaps - are you hosting your application in the same datacenter that MongoLab is hosting your database? If not, that user name and password, along with your data, will traverse the internet in the clear.
MongoLab does not currently support SSL (other than for their RestAPI) so even they recommend being in the same data center:
Do you support SSL?
Not yet but it is on our roadmap to be available in Summer 2014. In
the meantime, we highly recommend that you run your application and
database in the same datacenter. If you have a Dedicated plan, we also
highly recommend that you configure custom firewall rules for your
database(s).
Rest API:
Each MongoLab account comes with a REST API that can be used to access
the databases, collections and documents belonging to that account.
The API exposes most the operations you would find in the MongoDB
driver, but offers them as a RESTful interface over HTTPS.
I would definitely read MongoLab's security page fairly closely:
https://docs.mongodb.com/manual/security/

MongoDB monitoring service on local host

Is there a MongoDB server performance monitoring tool which I can run on a local host or a local machine?
I am concerned about privacy issues while using third-party hosting tools like MongoDB Monitoring Service.
The MongoDB documentation has information on Monitoring MongoDB including monitoring strategies, relevant database commands, and some self-hosted monitoring options.
If you are concerned about the information collected by MongoDB Cloud Manager (née MMS) or would like to collect this information yourself, you can see a list of database commands used by the monitoring agent.
MongoBird is best monitoring tool for MongoDB. It can be installed on all platforms. because it is developed in Java. So, you can install mongobird on the local host.
MongoDB has created a free monitoring tool in version 4.0 which works on localhost. To use it just connect to the database and run db.enableFreeMonitoring()
For Example:
mongo test
MongoDB shell version v4.0.4
connecting to: mongodb://127.0.0.1:27017/test
Once you've connected you can enable monitoring like so:
test> db.enableFreeMonitoring()
{
"state": "enabled",
"message": "To see your monitoring data, navigate to the unique URL below. Anyone you share the URL with will also be able to view this page. You can disable monitoring at any time by running db.disableFreeMonitoring().",
"url": "https://cloud.mongodb.com/freemonitoring/cluster/HZL3ISL73QLWSNEAYMER2FGR3BINAEGJ",
"userReminder": "",
"ok": 1
}
Then go to the url provided (https://cloud.mongodb.com/freemonitoring/...).
Finally, to disable monitoring:
test> db.disableFreeMonitoring()