lemonldap-ng/doc/sources/admin/sqlconfbackend.rst

200 lines
3.3 KiB
ReStructuredText
Raw Normal View History

2020-05-14 23:29:41 +02:00
SQL configuration backends
==========================
There is 2 types of SQL configuration backends for LemonLDAP::NG:
- **CDBI**: very simple storage (recommended)
- **RDBI**: triple store storage
2020-05-18 09:56:39 +02:00
.. tip::
2020-05-14 23:29:41 +02:00
You can use any database engine if it provides a Perl Driver.
You will find here examples for MySQL and PostgreSQL, but other engines
may also work.
See :doc:`how to change configuration backend<changeconfbackend>`.
MySQL
-----
Perl Driver
~~~~~~~~~~~
You need DBD::MySQL Perl module:
- Debian:
::
apt install libdbd-mysql-perl
- Red Hat:
::
yum install perl-DBD-MySQL
Database and table creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create database:
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE DATABASE lemonldap-ng CHARACTER SET utf8;
Use database to create table:
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
use lemonldap-ng
RDBI
^^^^
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE TABLE lmConfig (
cfgNum int(11) NOT NULL,
field varchar(255) NOT NULL DEFAULT '',
value longtext,
PRIMARY KEY (cfgNum,field)
);
CDBI
^^^^
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE TABLE lmConfig (
cfgNum int not null primary key,
data longtext
);
Grant access
~~~~~~~~~~~~
You have to grant read/write access for the manager component. Other
components needs just a read access. You can also use the same user for
all.
2020-05-18 09:56:39 +02:00
.. tip::
2020-05-14 23:29:41 +02:00
You can use different dbiUser strings:
2020-05-18 09:56:39 +02:00
2020-05-14 23:29:41 +02:00
- one with read/write rights for servers hosting the manager
- one with just read rights for other servers
2020-05-18 09:56:39 +02:00
2020-05-14 23:29:41 +02:00
For example (suppose that our servers are in 10.0.0.0/24 network):
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES ON lemonldap-ng.lmConfig
TO lemonldaprw@manager.host IDENTIFIED BY 'mypassword';
GRANT SELECT ON lemonldap-ng.lmConfig
TO lemonldapro@'10.0.0.%' IDENTIFIED BY 'myotherpassword';
Connection settings
-------------------
Change configuration settings in ``/etc/lemonldap-ng/lemonldap-ng.ini``
file (section configuration):
2020-05-21 15:13:24 +02:00
.. code-block:: ini
2020-05-14 23:29:41 +02:00
[configuration]
type = RDBI
dbiChain = DBI:mysql:database=lemonldap-ng;host=1.2.3.4
dbiUser = lemonldaprw
dbiPassword = mypassword
; optional
dbiTable = mytablename
PostGreSQL
----------
.. _perl-driver-1:
Perl Driver
~~~~~~~~~~~
You need DBD::Pg Perl module:
- Debian:
::
apt install libdbd-pg-perl
- Red Hat:
::
yum install perl-DBD-Pg
.. _database-and-table-creation-1:
Database and table creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create database:
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE DATABASE lemonldap-ng;
Use database to create table:
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
use lemonldap-ng
.. _rdbi-1:
RDBI
^^^^
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE TABLE lmconfig (
cfgnum integer NOT NULL,
field text NOT NULL,
value text,
PRIMARY KEY (cfgNum,field)
);
.. _cdbi-1:
CDBI
^^^^
2020-05-21 15:13:24 +02:00
.. code-block:: sql
2020-05-14 23:29:41 +02:00
CREATE TABLE lmConfig (
cfgnum integer not null primary key,
data text
);
.. _connection-settings-1:
Connection settings
-------------------
Change configuration settings in ``/etc/lemonldap-ng/lemonldap-ng.ini``
file (section configuration):
2020-05-21 15:13:24 +02:00
.. code-block:: ini
2020-05-14 23:29:41 +02:00
[configuration]
type = RDBI
dbiChain = DBI:Pg:database=lemonldap-ng;host=1.2.3.4
dbiUser = lemonldaprw
dbiPassword = mypassword
; optional
dbiTable = mytablename