Apache Drill provides the ability to connect and submit queries to the MongoDB cluster with enabled authentication.
Drill provides numerous ways for providing credentials that will be used for connecting to MongoDB.
The simplest way for providing credentials is by specifying them within the mongo connection string:
{ "type": "mongo", "connection": "mongodb://user1:user1Pass@mongoHost:27017/", "batchSize": 100, "enabled": true }
where
user1
- name of the useruser1Pass
- user passwordmongoHost
mongo hostThis way of providing username and password takes precedence over all other methods.
Mongo storage plugin is integrated with Credentials provider, so it is possible to specify credentials using it.
Credentials provider creates connection string with provided username and password, similar to the previous section, so Drill will use this connection string when connecting to MongoDB.
Here is the example of using Plain Credentials Provider with Mongo storage plugin, but it is possible to use any other Credentials Provider implementation (including custom ones) in a similar manner:
{ "type": "mongo", "connection": "mongodb://mongoHost:27017/", "batchSize": 100, "credentialsProvider": { "credentialsProviderType": "PlainCredentialsProvider", "credentials": { "username": "user1", "password": "user1Pass" } }, "enabled": true }
Please refer to Plugin credentials provider for more details related to Credentials Provider.