Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:2.1:mongodbconfbackend [2019/01/15 15:55] (current)
Line 1: Line 1:
 +====== MongoDB configuration backends ======
  
 +[[https://​www.mongodb.org/​|MongoDB]] is a NoSQL database that can be used both for storing configuration and [[mongodbsessionbackend|sessions]]. You need to install Perl MongoDB module to be able to use this backend.
 +
 +See [[changeconfbackend|how to change configuration backend]] to change your configuration database.
 +
 +===== Configuration =====
 +
 +To use a MongoDB backend, configure your ''​lemonldap-ng.ini''​ file (section configuration) :
 +  * Choose MongoDB as type
 +  * Set dbName and collectionName parameters if different than default values (llConfDB and configuration)
 +  * Set host and if needed db_name username, password and ssl fields as follow.
 +Example :
 +<code ini>
 +[configuration]
 +type = MongoDB
 +dbName = llConfDB
 +collectionName = configuration
 +host = 127.0.0.1:​27017
 +ssl = 1
 +; authentication parameters
 +db_name = admin
 +user = lluser
 +password = llpassword
 +</​code>​
 +
 +^           ​Optional parameters (see [[http://​search.cpan.org/​perldoc?​MongoDB%3A%3AMongoClient|MongoDB::​MongoClient]] man page)            ^^^
 +^           ​Name ​           ^             ​Comment ​             ^  Example ​  ^
 +| db_name ​                  | Admin database (default: admin) ​ | admin      |
 +| auth_mechanism ​           | Authentication mechanism ​        | PLAIN      |
 +| auth_mechanism_properties |                                  |            |
 +| connect_timeout ​          | Connection timeout ​              | 10000      |
 +| ssl                       | Boolean or hash ref (default: 0) | 1          |
 +| username ​                 | Username to use to connect ​      | lluser ​    |
 +| password ​                 | Password ​                        | llpassword |
 +
 +====== Mini MongoDB howto ======
 +
 +Just some commands needed to create collection and user:
 +<​code>​
 +$ mongo
 +connecting to: test
 +> use configuration
 +switched to db configuration
 +> db.createCollection("​configuration"​)
 +...
 +> db.createUser({user:"​lluser",​pwd:"​llpassword",​roles:​["​readWrite"​]})
 +...
 +> exit
 +bye
 +$
 +</​code>​