mongodbconfbackend.html 7.12 KB
Newer Older
Clément OUDOT's avatar
Clément OUDOT committed
1 2 3 4 5 6
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8" />
  <title>documentation:2.0:mongodbconfbackend</title>
<meta name="generator" content="DokuWiki"/>
Xavier Guimard's avatar
Xavier Guimard committed
7
<meta name="robots" content="index,follow"/>
Clément OUDOT's avatar
Clément OUDOT committed
8 9 10 11 12
<meta name="keywords" content="documentation,2.0,mongodbconfbackend"/>
<link rel="search" type="application/opensearchdescription+xml" href="lib/exe/opensearch.html" title="LemonLDAP::NG"/>
<link rel="start" href="mongodbconfbackend.html"/>
<link rel="contents" href="mongodbconfbackend.html" title="Sitemap"/>
<link rel="stylesheet" type="text/css" href="lib/exe/css.php.t.bootstrap3.css"/>
Xavier Guimard's avatar
Xavier Guimard committed
13 14 15 16 17 18 19 20 21
<!-- //if:usedebianlibs
  <link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
  <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
  <link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else -->
  <link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<!-- //endif -->
Clément OUDOT's avatar
Clément OUDOT committed
22 23 24
<script type="text/javascript">/*<![CDATA[*/var NS='documentation:2.0';var JSINFO = {"id":"documentation:2.0:mongodbconfbackend","namespace":"documentation:2.0"};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="lib/exe/js.php.t.bootstrap3.js"></script>
Xavier Guimard's avatar
Xavier Guimard committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script>
<!-- //endif -->
<!-- //if:usedebianlibs
  <script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
  <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
Xavier Guimard's avatar
Xavier Guimard committed
39
  <script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.min.js"></script>
Xavier Guimard's avatar
Xavier Guimard committed
40
//else -->
Xavier Guimard's avatar
Xavier Guimard committed
41
  <script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.js"></script>
Xavier Guimard's avatar
Xavier Guimard committed
42
<!-- //endif -->
Clément OUDOT's avatar
Clément OUDOT committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
</head>
<body>
<div class="dokuwiki export container">

<h1 class="sectionedit1" id="mongodb_configuration_backends">MongoDB configuration backends</h1>
<div class="level1">

<p>
<a href="https://www.mongodb.org/" class="urlextern" title="https://www.mongodb.org/"  rel="nofollow">MongoDB</a> is a NoSQL database that can be used both for storing configuration and <a href="mongodbsessionbackend.html" class="wikilink1" title="documentation:2.0:mongodbsessionbackend">sessions</a>. You need to install Perl MongoDB module to be able to use this backend.
</p>

<p>
See <a href="changeconfbackend.html" class="wikilink1" title="documentation:2.0:changeconfbackend">how to change configuration backend</a> to change your configuration database.
</p>

</div>
<!-- EDIT1 SECTION "MongoDB configuration backends" [1-366] -->
<h2 class="sectionedit2" id="configuration">Configuration</h2>
<div class="level2">

<p>
To use a MongoDB backend, configure your <code>lemonldap-ng.ini</code> file (section configuration) :
</p>
<ul>
<li class="level1"><div class="li"> Choose MongoDB as type</div>
</li>
<li class="level1"><div class="li"> Set dbName and collectionName parameters if different than default values (llConfDB and configuration)</div>
</li>
<li class="level1"><div class="li"> Set host and if needed db_name username, password and ssl fields as follow.</div>
</li>
</ul>

<p>
Example :
</p>
<pre class="code ini"><span class="re0"><span class="br0">&#91;</span>configuration<span class="br0">&#93;</span></span>
<span class="re1">type</span> <span class="sy0">=</span><span class="re2"> MongoDB</span>
<span class="re1">dbName</span> <span class="sy0">=</span><span class="re2"> llConfDB</span>
<span class="re1">collectionName</span> <span class="sy0">=</span><span class="re2"> configuration</span>
<span class="re1">host</span> <span class="sy0">=</span><span class="re2"> 127.0.0.1:27017</span>
<span class="re1">ssl</span> <span class="sy0">=</span><span class="re2"> 1</span>
<span class="co0">; authentication parameters</span>
<span class="re1">db_name</span> <span class="sy0">=</span><span class="re2"> admin</span>
<span class="re1">user</span> <span class="sy0">=</span><span class="re2"> lluser</span>
<span class="re1">password</span> <span class="sy0">=</span><span class="re2"> llpassword</span></pre>
<div class="table sectionedit3"><table class="inline table table-bordered table-striped">
	<thead>
	<tr class="row0 roweven">
		<th class="col0 centeralign" colspan="3">           Optional parameters (see <a href="http://search.cpan.org/perldoc?MongoDB%3A%3AMongoClient" class="urlextern" title="http://search.cpan.org/perldoc?MongoDB%3A%3AMongoClient"  rel="nofollow">MongoDB::MongoClient</a> man page)            </th>
	</tr>
	<tr class="row1 rowodd">
		<th class="col0 centeralign">           Name            </th><th class="col1 centeralign">             Comment              </th><th class="col2 centeralign">  Example   </th>
	</tr>
	</thead>
	<tr class="row2 roweven">
Xavier Guimard's avatar
Xavier Guimard committed
98
		<td class="col0 leftalign"> db_name                   </td><td class="col1 leftalign"> Admin database (default: admin)  </td><td class="col2 leftalign"> admin      </td>
Clément OUDOT's avatar
Clément OUDOT committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
	</tr>
	<tr class="row3 rowodd">
		<td class="col0 leftalign"> auth_mechanism            </td><td class="col1 leftalign"> Authentication mechanism         </td><td class="col2 leftalign"> PLAIN      </td>
	</tr>
	<tr class="row4 roweven">
		<td class="col0"> auth_mechanism_properties </td><td class="col1 leftalign">                                  </td><td class="col2 leftalign">            </td>
	</tr>
	<tr class="row5 rowodd">
		<td class="col0 leftalign"> connect_timeout           </td><td class="col1 leftalign"> Connection timeout               </td><td class="col2 leftalign"> 10000      </td>
	</tr>
	<tr class="row6 roweven">
		<td class="col0 leftalign"> ssl                       </td><td class="col1"> Boolean or hash ref (default: 0) </td><td class="col2 leftalign"> 1          </td>
	</tr>
	<tr class="row7 rowodd">
		<td class="col0 leftalign"> username                  </td><td class="col1 leftalign"> Username to use to connect       </td><td class="col2 leftalign"> lluser     </td>
	</tr>
	<tr class="row8 roweven">
		<td class="col0 leftalign"> password                  </td><td class="col1 leftalign"> Password                         </td><td class="col2"> llpassword </td>
	</tr>
</table></div>
<!-- EDIT3 TABLE [922-1688] -->
</div>
<!-- EDIT2 SECTION "Configuration" [367-1689] -->
<h1 class="sectionedit4" id="mini_mongodb_howto">Mini MongoDB howto</h1>
<div class="level1">

<p>
Just some commands needed to create collection and user:
</p>
<pre class="code">$ mongo
connecting to: test
&gt; use configuration
switched to db configuration
&gt; db.createCollection(&quot;configuration&quot;)
...
&gt; db.addUser({user:&quot;lluser&quot;,pwd:&quot;llpassword&quot;,roles:[&quot;readWrite&quot;]})
...
&gt; exit
bye
$</pre>

</div>
<!-- EDIT4 SECTION "Mini MongoDB howto" [1690-] --></div>
</body>
</html>