lemonldap-ng/build/lemonldap-ng/doc/4.4-PostGreSQL-session-backend.html
Clément Oudot 34ea9bacd1 Doc: add DBI
2010-03-22 14:41:35 +00:00

170 lines
4.7 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />
<title>Lemonldap::NG documentation:
4.4-PostGreSQL-session-backend.html</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<style type="text/css">
/*<![CDATA[*/
body{
background: #ddd;
font-family: sans-serif;
font-size: 11pt;
padding: 0 50px;
}
div.main-content{
padding: 10px;
background: #fff;
border: 2px #ccc solid;
}
a{
text-decoration: none;
}
p.footer{
text-align: center;
margin: 5px 0 0 0;
}
.heading-1{
text-align: center;
color: orange;
font-variant: small-caps;
font-size: 20pt;
}
.heading-1-1{
color: orange;
font-size: 14pt;
border-bottom: 2px #ccc solid;
}
pre{
background: #eee;
border: 2px #ccc solid;
padding: 5px;
border-left: 10px #ccc solid;
}
ul.star li{
list-style-type: square;
}
/*]]>*/
</style>
</head>
<body>
<div class="main-content">
<h2 class="heading-1"><span id="HSessionsinPostGreSQL">Sessions in
PostGreSQL</span></h2>
<p class="paragraph"></p>
<ul>
<li>
<a href="#HPostGreSQLconfiguration">PostGreSQL configuration</a>
<ul>
<li><a href="#HDatabasecreation">Database creation</a></li>
<li><a href="#HTablecreation">Table creation</a></li>
</ul>
</li>
<li><a href="#HLemonLDAP3A3ANGconfiguration">LemonLDAP::NG
configuration</a></li>
</ul>
<h3 class="heading-1-1"><span id="HPostGreSQLconfiguration">PostGreSQL
configuration</span></h3>
<p class="paragraph"></p>We suppose that LemonLDAP::Ng used a local
database.
<h4 class="heading-1-1-1"><span id="HDatabasecreation">Database
creation</span></h4>
<p class="paragraph"></p>For example, with Debian:
<p class="paragraph"></p>
<div class="code">
<pre>
# su - potsgres
$ createuser lemonldap-ng -P
Entrez le mot de passe pour le nouveau r&ocirc;le : &lt;PASSWORD&gt;
Entrez-le de nouveau : &lt;PASSWORD&gt;
Le nouveau r&ocirc;le est-il un <span class=
"java-keyword">super</span>-utilisateur ? (o/n) n
Le nouveau r&ocirc;le doit-il &ecirc;tre autoris&eacute; &agrave; cr&eacute;er des bases de donn&eacute;es ? (o/n) n
Le nouveau r&ocirc;le doit-il &ecirc;tre autoris&eacute; &agrave; cr&eacute;er de nouveaux r&ocirc;les ? (o/n) n
CREATE ROLE
$ createdb -O lemonldap-ng lemonldap-ng
CREATE DATABASE
</pre>
</div>
<h4 class="heading-1-1-1"><span id="HTablecreation">Table
creation</span></h4>
<p class="paragraph"></p>Create the table:
<p class="paragraph"></p>
<div class="code">
<pre>
$ psql -h 127.0.0.1 -U lemonldap-ng -W lemonldap-ng
Mot de passe pour l'utilisateur lemonldap-ng :
[...]
lemonldap-ng=&gt; create table sessions ( id <span class=
"java-object">char</span>(32) not <span class=
"java-keyword">null</span> primary key, a_session text );
NOTICE: CREATE TABLE / PRIMARY KEY cr&eacute;era un index implicite &laquo; sessions_pkey &raquo; pour la table &laquo; sessions &raquo;
CREATE TABLE
lemonldap-ng=&gt; q
</pre>
</div>
<h3 class="heading-1-1"><span id=
"HLemonLDAP3A3ANGconfiguration">LemonLDAP::NG configuration</span></h3>
<p class="paragraph"></p>Go to the Manager and go in <strong class=
"strong">General Parameters &gt; Session Storage</strong>. Then change
<strong class="strong">Apache::Session module</strong> to
"Apache::Session::Postgres" and in <strong class="strong">Apache::Session
parameters</strong> configure the following options:
<ul class="star">
<li>DataSource (for example:
dbi:Pg:dbname=lemonldap-ng;host=127.0.0.1)</li>
<li>UserName</li>
<li>Password</li>
<li>Commit</li>
</ul>You can also set the session module in perl scripts:
<div class="code">
<pre>
globalStorage =&gt; <span class=
"java-quote">"Apache::Session::Postgres"</span>,
globalStorageOptions =&gt; {
DataSource =&gt; <span class=
"java-quote">"dbi:Pg:database=lemonldap-ng;host=127.0.0.1"</span>,
UserName =&gt; <span class="java-quote">"lemonldap-ng"</span>,
Password =&gt; <span class=
"java-quote">"&lt;PASSWORD&gt;"</span>,
Commit =&gt; 1,
},
</pre>
</div>
<p class="paragraph"></p>
</div>
<p class="footer"><a href="index.html">Index</a></p>
</body>
</html>