Tableau Desktop with MongoDB

MongoDB BI Connector is required for connecting Tableau Desktop to MongoDB database. Tableau uses MongoDB ODBC driver at client side to talk to MongoDB database. So we need to install MongoDB ODBC driver on the client side. A system DSN has to be created using ODBC administrator for Tableau Desktop to use during the connection phase.

To get the MongoDB Connector for BI, sign in to the MongoDB website and download the connector. Follow the Installation instructions on the MongoDB website.

Download and install the MongoDB ODBC Driver for BI Connector

I installed mongodb BI connector in the MongoDB server using tar file. This link gives pretty good explanation about how to install BI Connector. Click here

[root@snode1]# tar -xvzf mongodb-bi-linux-x86_64-rhel70-v2.13.1.tar
mongodb-bi-linux-x86_64-rhel70-v2.13.1/LICENSE
mongodb-bi-linux-x86_64-rhel70-v2.13.1/README
mongodb-bi-linux-x86_64-rhel70-v2.13.1/THIRD-PARTY-NOTICES
mongodb-bi-linux-x86_64-rhel70-v2.13.1/example-mongosqld-config.yml
mongodb-bi-linux-x86_64-rhel70-v2.13.1/bin/mongosqld
mongodb-bi-linux-x86_64-rhel70-v2.13.1/bin/mongodrdl
mongodb-bi-linux-x86_64-rhel70-v2.13.1/bin/mongotranslate
[root@snode1]# cd mongodb-bi-linux-x86_64-rhel70-v2.13.1/
[root@snode1 mongodb-bi-linux-x86_64-rhel70-v2.13.1]# install -m755 bin/mongo* /usr/bin/
[root@snode1 mongodb-bi-linux-x86_64-rhel70-v2.13.1]#

Launch BI Connector

mongodb-bi-linux package will install mongosqld. This is the BI Connector program which connect MongoDB instance to your BI tool. mongosqld requires a data schema which maps to MongoDB collections and databases.

mongosqld generates data schema by default and holds it in the memory. You can also create a schema file and edit it manually using mongordl program and create .drdl schema file and use the schema option when starting mongosqld.

mongosqld program can be started as a service or run in the command line on Linux. I configured mongodsqld.conf file and configured as a service.

[root@snode1 ~] # cat /etc/mongosqld.conf
systemLog:
path: '/var/log/mongosqld.log'
net:
bindIp: '192.168.1.161'
port: 3307

mongosqld defaults to port 3307 for listening.

mongosqld install --config /etc/mongosqld.conf
systemctl start mongosql.service
[root@snode1 ~]# cat /var/log/mongosqld.log
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten] mongosqld starting: version=v2.13.1 pid=24739 host=snode1
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten] git version: bae9ae2a9bff80642215b648d46312804fe62f2d
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten] OpenSSL version OpenSSL 1.0.1e-fips 11 Feb 2013 (built with OpenSSL 1.0.1e 11 Feb 2013)
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten] options: {config: "/etc/mongosqld.conf", systemLog: {path: "/var/log/mongosqld.log"}, net: {bindIp: [192.168.1.161]}, mongodb: {net: {auth: {source: "admin"}}}}
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for mongosqld.
2020-01-07T07:19:50.935-0800 I CONTROL [initandlisten]
2020-01-07T07:19:50.944-0800 I NETWORK [initandlisten] waiting for connections at 192.168.1.161:3307
2020-01-07T07:19:50.944-0800 I NETWORK [initandlisten] waiting for connections at /tmp/mysql.sock
2020-01-07T07:19:51.017-0800 I SCHEMA [sampler] sampling MongoDB for schema…
2020-01-07T07:19:51.285-0800 I SCHEMA [sampler] mapped schema for 2 namespaces: "test" (1): ["zips"]; "business" (1): ["reviews"]

Connecting Tableau to the MongoDB Connector for BI requires Tableau 10.3 or later, mongod and mongosqld. We configure mongod and mongosqld on OEL snode1 in the previous steps.

We will have to download and install MongoDB ODBC driver for BI Connector and install on my Windows system where Tableau Desktop is running.

Use this link to download MongoDB ODBC driver for BI connector

Create a System DSN using Microsoft ODBC Data Source program.

Select MongoDB ODBC driver

Once the system DSN is created, we can verify the connection and make sure it work.

If everything is ok, Open Tableau Desktop and select Other Database (ODBC) for the source database connection and select the System DSN just created. Once connection test completes, Click Sign in.

All the best!

Leave a reply