Debian Codegraph @

doc/sources/admin/mongodbconfbackend.rst

raw
1 MongoDB configuration backend (deprecated)
2 ==========================================
3
4 `MongoDB <https://www.mongodb.org/>`__ is a NoSQL database that can be
5 used both for storing configuration and
6 :doc:`sessions<mongodbsessionbackend>`. You need to install Perl MongoDB
7 module to be able to use this backend.
8
9 .. tip::
10
11 `MongoDB has officially deprecated the Perl driver <https://www.mongodb.com/blog/post/the-mongodb-perl-driver-is-being-deprecated>`__, so we advice to choose another backend
12
13 For Debian, you can install mongodb module with:
14
15 ::
16
17 apt install libmongodb-perl
18
19 For CentOS:
20
21 ::
22
23 yum install perl-MongoDB
24
25 See :doc:`how to change configuration backend<changeconfbackend>` to
26 change your configuration database.
27
28 Configuration
29 -------------
30
31 To use a MongoDB backend, configure your ``lemonldap-ng.ini`` file
32 (section configuration) :
33
34 - Choose MongoDB as type
35 - Set dbName and collectionName parameters if different than default
36 values (llConfDB and configuration)
37 - Set host and if needed db_name username, password and ssl fields as
38 follow.
39
40 Example :
41
42 .. code-block:: ini
43
44 [configuration]
45 type = MongoDB
46 dbName = llConfDB
47 collectionName = configuration
48 ; using a single server
49 host = 127.0.0.1:27017
50 ; using a replicaSet
51 ; host = mongodb://mongo1.example.com,mongo2.example.com/?replicaSet=myset
52 ssl = 1
53 ; authentication parameters
54 db_name = admin
55 user = lluser
56 password = llpassword
57
58 ===================================================================================================================== ================================ ==========
59 Optional parameters (see `MongoDB::MongoClient <http://search.cpan.org/perldoc?MongoDB%3A%3AMongoClient>`__ man page)
60 ===================================================================================================================== ================================ ==========
61 Name Comment Example
62 db_name Admin database (default: admin) admin
63 auth_mechanism Authentication mechanism PLAIN
64 auth_mechanism_properties
65 connect_timeout Connection timeout 10000
66 ssl Boolean or hash ref (default: 0) 1
67 username Username to use to connect lluser
68 password Password llpassword
69 ===================================================================================================================== ================================ ==========
70
71 Mini MongoDB howto
72 ==================
73
74 Just some commands needed to create collection and user:
75
76 ::
77
78 $ mongo
79 connecting to: test
80 > use configuration
81 switched to db configuration
82 > db.createCollection("configuration")
83 ...
84 > db.createUser({user:"lluser",pwd:"llpassword",roles:["readWrite"]})
85 ...
86 > exit
87 bye
88 $
89