Run mongosql
as a service with auto start on server restart
-
Download the BI Connector from the MongoDB Download Center
-
Install the MongoDB Connector for BI.
Extract the .tar archive you downloaded.
tar -xvzf mongodb-bi-linux-{arch}-{platform}-{version}.tgz
Install the programs within the bin/ directory into a directory listed in your system PATH.
sudo install -m755 bin/mongo* /usr/local/bin/
-
To install and run mongosqld as a system service, run the following commands:
sudo mongosqld install --config <pathToConfigFile>/mongosqld.conf
sudo systemctl start mongosql.service
-
To enable the service so it starts automatically at boot time, run the following:
systemctl enable mongosql.service
Command
bin/mongosqld --schemaSource <target_database_name> --auth --mongo-username=<username> --mongo-password=<password> --sslMode requireSSL --sslPEMKeyFile <path_to_ssl_key_pem>
Example
bin/mongosqld --schemaSource TRLPDB --auth --mongo-username=user --mongo-password=getmein --sslMode requireSSL --sslPEMKeyFile ./ssl/mongo.pem
Currently only cleartext authentication plugin is supported by Cube.js Mongo BI Driver. It requires SSL to be set up from mongosqld in order to encrypt passed credentials from CubeJs.
Self-signed certificate can be used to provide this encryption.
-
Generate a
self-signed
SSLkey
andcertificate
file with the following command:openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
-
Concat it together to create
sslPEMKeyFile
:cat key.pem certificate.pem > mongo.pem
-
Start mongosqld with enabled SSL:
./mongosqld --auth --sslMode requireSSL --sslPEMKeyFile mongo.pem