Redash can create dashboards from a variety of data sources that display charts, pivot tables, cohorts, boxplots, counters, funnels, maps, eccentric, sunburst and sound clouds. Here’s how to use it.

Data forecasting concept
Photo: sutlafk / Shutterstock

Redash is a powerful data visualization platform that can be deployed to your on-premises data center or to a third party cloud host. Redash lets you create dashboards from a variety of data sources that display charts, pivot tables, cohorts, box plots, counters, funnels, maps, eccentric, sunburst and sound clouds.

Views: Recruitment Kit: Database Engineer (TekriPublic Premium)

The list of data sources you can connect to Redash is extensive and includes choices from Redshift, Google BigQuery, PostgreSQL, MySQL, Graphite, Presto, Google Sheets, Cloudera Impala, Hive and MongoDB.

I’m going to show you how easy it is to integrate Redash with MongoDB, the most popular NoSQL database on the market.

What you will need

To make this connection, you’ll need a running example of Redash as well as an accessible MongoDB server. You will need a user with pseudo privileges (to enable Mongodib for remote access).

Connect with

How to allow remote connection to MongoDB

All we have to do is allow the remote connection to the Mongodib server. To do this, log in to MongoDB Hosting Server and open the required configuration file:

sudo nano /etc/mongodb.conf

Identify the line:

bind_ip = 127.0.0.1

Change this line:

bind_ip = 127.0.0.1, SERVER

Where SERVER is the IP address of the Redash hosting server.

Save the file and restart MongoDB with:

sudo systemctl restart mongodb

If you haven’t already created a user with a database privilege, we should do it now. Say, for example, you want to give user jack access to the admin database. Open the MongoDB console with the command:

mongo

On the console, you would type the following (one line at a time):

db.createUser(

{           user: "jack",

pwd: "PASSWORD",

roles:[{role: "userAdminAnyDatabase" , db:"admin"}]})

Where PASSWORD is a strong / unique password.

If you issue an order show users You will see new users listed with the appropriate permissions from the admin database.

How to add MongoDB data source to Redash

Now it’s time to add MongoDB data source to Redash. Log in to your Redash instance and click Connect a data source (on the first page). Results page (Figure A), Click New Data Source.

Figure A

Creating a new data source connection in Redash.
Creating a new data source connection in Redash.

In the next window (Figure B), Scroll down and select MongoDB from the list.

Figure B

A good cross-section of data sources that you can use with Redash.
A good cross-section of data sources that you can use with Redash.

New window (Figure C), You need to fill in the required information for MongoDB connection.

Figure C

The MongDB connection setup is not quite straightforward, but it is not impossibly challenging.
The MongDB connection setup is not quite straightforward, but it is not impossibly challenging.

Here’s what you need to do:

  • In the Names section, type the readable name of any person.
  • The connection string is in the form mongodb: // USERNAME: PASSWORD @ HOSTNAME: PORT / DBNAME
  • Database Name will be the name of the database.

Where USERNAME is the MongoDB user you created, PASSWORD is the password of the MongoDB user, HOSTNAME is the IP address of the MongoDB server, PORT is probably 27017, and DBNAME is the name of the database used.

If you have SSL setup, the connection string will look like this:

mongodb: // USERNAME: PASSWORD @ HOSTNAME: PORTt / DBNAME? ssl = true & ssl_cert_reqs = CERT_NONE

Click Save, and the data source should be ready to go. Congratulations, you can now start creating your first query and dashboard on Redash.

Subscribe to TechRepublic How to do tech work on youtube From Jack Wallen to business professionals for all the latest technology advice.

Leave a Reply

Your email address will not be published.