| 1 |
How to change session backend |
| 2 |
============================= |
| 3 |
|
| 4 |
LemonLDAP::NG provides a script to change session backend. This script |
| 5 |
will help you transfer existing persistent sessions (or offline |
| 6 |
sessions) when migrating from one backend to another, or when adding |
| 7 |
indexes to a |
| 8 |
:doc:`browseable session backend</browseablesessionbackend>`. It is |
| 9 |
available in LemonLDAP::NG utilities directory (``convertSessions``). |
| 10 |
|
| 11 |
.. tip:: |
| 12 |
|
| 13 |
This script isn't able to migrate sessions from unhashed storage into |
| 14 |
hashed storage. Use the `convertToHashSessionStorage` to change from |
| 15 |
unhashed storage into hashed storage. |
| 16 |
|
| 17 |
Note also that this operation is not reversible. |
| 18 |
|
| 19 |
How it works |
| 20 |
------------ |
| 21 |
|
| 22 |
The ``convertSessions`` utility requires you to create a job |
| 23 |
configuration file with the following content: |
| 24 |
|
| 25 |
:: |
| 26 |
|
| 27 |
# This example migrates psessions from the default File backend to a PostgreSQL database |
| 28 |
[sessions_from] |
| 29 |
storageModule = Apache::Session::File |
| 30 |
storageModuleOptions = { \ |
| 31 |
'Directory' => '/var/lib/lemonldap-ng/psessions', \ |
| 32 |
'LockDirectory' => '/var/lib/lemonldap-ng/psessions/lock', \ |
| 33 |
} |
| 34 |
# Only convert some session types |
| 35 |
# sessionKind = Persistent, SSO |
| 36 |
|
| 37 |
[sessions_to] |
| 38 |
storageModule = Apache::Session::Browseable::Postgres |
| 39 |
storageModuleOptions = { \ |
| 40 |
'DataSource' => 'DBI:Pg:database=lemonldapdb;host=pg.example.com', \ |
| 41 |
'UserName' => 'lemonldaplogin', \ |
| 42 |
'Password' => 'lemonldappw', \ |
| 43 |
'Commit' => 1, \ |
| 44 |
'Index' => 'ipAddr _whatToTrace user', \ |
| 45 |
'TableName' => 'psessions', \ |
| 46 |
} |
| 47 |
|
| 48 |
Invocation |
| 49 |
---------- |
| 50 |
|
| 51 |
``convertSessions -c job.ini`` |
| 52 |
|
| 53 |
Options: |
| 54 |
|
| 55 |
- ``-c``: job configuration file (mandatory) |
| 56 |
- ``-r oldkey=newkey``: rename session keys during conversion (optional, can be given multiple times) |
| 57 |
- ``-x key``: remove session keys during conversion (optional, can be given multiple times) |
| 58 |
- ``-i``: ignore errors. By default errors will stop the script |
| 59 |
execution |
| 60 |
- ``-d``: print debugging output |