Debian – Connecting to Mongodb Bi-connector remotely in docker

debiandockermongodb

I recently installed the mongodb Bi-connector in order to use Tableau to visualize my data
I successfully installed it in a docker container using a debian image.
The connector successfully access my remote mongo instance and has generated the proper schema.

I tried to connect to my container and installed a mysql client to check if the connector was working, it's fine :
result

But when I exit the container and I try from my host machine here is what I get (I mapped the 3307 container's port to my 9015 host port)

$ mysql –host localhost –protocol tcp –port 9015
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system
error: 2

I've tried with different mysql client version, I ve tried mapping different ports, I ve tried 127.0.0.1 instead of localhost, nothing works.

So I was wondering, does the connector has to be on the same machine than the mysql client or tableau ?

Best Answer

Alright I found the issue. Now It works like a charm !

Turns out that when in a container the mongodrdl executable needs the --addr option to be set with the host name of the container as the container name (doesn't work with localhost or 127.0.0.1) Like this :

/usr/local/bin/mongosqld --addr mongo-bi-connector:3307 --schema schema.drdl --mongo-uri $MONGO_URI

I have published my sources on github and a docker image on the docker hub.

https://github.com/emmanuelvisage/docker-mongo-bi-connector https://hub.docker.com/r/visage/mongo-bi-connector/

I have added authentication support as well

Keep in mind that this include licensed content and requires a Mongodb entreprise license.

You're welcome !

Related Topic