From efb19c6a867f73ba690bcc4ef7eeba2f29ab440c Mon Sep 17 00:00:00 2001 From: Yadd Date: Thu, 6 Jul 2023 14:58:49 +0400 Subject: [PATCH] Add Cassandra support (#2965) --- doc/sources/admin/cassandraconfbackend.rst | 46 ++++++++++++ doc/sources/admin/cassandrasessionbackend.rst | 70 +++++++++++++++++++ doc/sources/admin/index_configdb.rst | 1 + doc/sources/admin/index_sessiondb.rst | 1 + doc/sources/admin/start.rst | 2 + 5 files changed, 120 insertions(+) create mode 100644 doc/sources/admin/cassandraconfbackend.rst create mode 100644 doc/sources/admin/cassandrasessionbackend.rst diff --git a/doc/sources/admin/cassandraconfbackend.rst b/doc/sources/admin/cassandraconfbackend.rst new file mode 100644 index 0000000000..27c094a7f2 --- /dev/null +++ b/doc/sources/admin/cassandraconfbackend.rst @@ -0,0 +1,46 @@ +Cassandra configuration backend +========================================== + +`Cassandra `__ is a NoSQL database that can be +used both for storing configuration and +:doc:`sessions`. You need to install Perl DBD::Cassandra +module to be able to use this backend. This driver emulates a SQL connector. + +See :doc:`how to change configuration backend` to +change your configuration database. + +Configuration +------------- + +Prepare the database +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cql + + CREATE KEYSPACE IF NOT EXISTS llng + WITH REPLICATION = { + 'class' : 'SimpleStrategy', + 'replication_factor' : 1 + }; + DROP TABLE IF EXISTS llng.lmconfig; + CREATE TABLE llng.lmconfig ( + cfgnum int PRIMARY KEY, + conf text + ); + +Connection settings +~~~~~~~~~~~~~~~~~~~ + +Change configuration settings in ``/etc/lemonldap-ng/lemonldap-ng.ini`` +file (section configuration): + +.. code-block:: ini + + [configuration] + type = CDBI + dbiChain = DBI:Cassandra:host=localhost;keyspace=llng + dbiUser = lemonldaprw + dbiPassword = mypassword + ; optional + dbiTable = mytablename + diff --git a/doc/sources/admin/cassandrasessionbackend.rst b/doc/sources/admin/cassandrasessionbackend.rst new file mode 100644 index 0000000000..8501f28db7 --- /dev/null +++ b/doc/sources/admin/cassandrasessionbackend.rst @@ -0,0 +1,70 @@ +Cassandra session backend +==================================== + +`Apache::Session::Browseable::Cassandra `__ +is a `Cassandra `__ session backend. + +Setup +----- + +Install and launch a `Cassandra `__ server. +Install +`Apache::Session::Browseable `__ +Perl module (version ⩾ 1.3.12 required). + +Prepare the database +~~~~~~~~~~~~~~~~~~~~ + +Your database must have a specific table to host sessions. Here are some +examples for main databases servers. + +.. code-block:: cql + + CREATE KEYSPACE IF NOT EXISTS llng + WITH REPLICATION = { + 'class' : 'SimpleStrategy', + 'replication_factor' : 1 + }; + DROP TABLE IF EXISTS llng.sessions; + CREATE TABLE llng.sessions ( + id text PRIMARY KEY, + a_session text, + # Indexed fields + _whatToTrace text, + _session_kind text, + _utime text, + ipAddr text + ); + CREATE INDEX ON llng.sessions (_whatToTrace); + CREATE INDEX ON llng.sessions (_session_kind); + CREATE INDEX ON llng.sessions (_utime); + CREATE INDEX ON llng.sessions (ipAddr); + +Manager +~~~~~~~ + +In the manager: set +`Apache::Session::Browseable::Cassandra `__ +in ``General parameters`` » ``Sessions`` » ``Session storage`` » +``Apache::Session module`` and add the following parameters (case +sensitive): + +=================== ================================================= ========================================= +Required parameters +---------------------------------------------------------------------------------------------------------- +Name Comment Example +=================== ================================================= ========================================= +**DataSource** The `DBI `__ string dbi:Cassandra:host=10.2.3.1;keyspace=llng +**UserName** The database username lemonldap-ng +**Password** The database password mysuperpassword +**TableName** *(Optional)* Name of the table sessions +**Index** Indexed fields _whatToTrace _session_kind _utime ipAddr +=================== ================================================= ========================================= + +Security +-------- + +Restrict network access to the Cassandra server. For remote servers, you +can use :doc:`SOAP session backend` in cunjunction +to increase security for remote server that access through an unsecure +network. diff --git a/doc/sources/admin/index_configdb.rst b/doc/sources/admin/index_configdb.rst index 95a43b6b9d..054bfd004b 100644 --- a/doc/sources/admin/index_configdb.rst +++ b/doc/sources/admin/index_configdb.rst @@ -10,6 +10,7 @@ Configuration database sqlconfbackend ldapconfbackend mongodbconfbackend + cassandraconfbackend soapconfbackend restconfbackend localconfbackend diff --git a/doc/sources/admin/index_sessiondb.rst b/doc/sources/admin/index_sessiondb.rst index 075f2c5465..085cbe0c49 100644 --- a/doc/sources/admin/index_sessiondb.rst +++ b/doc/sources/admin/index_sessiondb.rst @@ -10,6 +10,7 @@ Sessions database ldapsessionbackend redissessionbackend mongodbsessionbackend + cassandrasessionbackend browseablesessionbackend restsessionbackend soapsessionbackend diff --git a/doc/sources/admin/start.rst b/doc/sources/admin/start.rst index 835d4f213f..b540bff6d0 100644 --- a/doc/sources/admin/start.rst +++ b/doc/sources/admin/start.rst @@ -363,6 +363,7 @@ Backend Shareable Comment :doc:`YAML` |new| Same as :doc:`File` but in YAML format instead of JSON :doc:`SQL (CDBI/RDBI)` ✔ **Recommended for large-scale systems**. Prefer CDBI. +:doc:`Cassandra` ✔ Via SQL pseudo-driver :doc:`LDAP` ✔ :doc:`MongoDB` |deprecated| ✔ :doc:`SOAP` |deprecated| ✔ Proxy backend to be used in conjunction with another @@ -412,6 +413,7 @@ Backend Shareable :ref: :doc:`Browseable LDAP` ✔ ✔ ✔ ✔ :doc:`Redis` ✔ ✔ ✔ ✔ The fastest. Must be secured by network access control. :doc:`MongoDB` |deprecated| ✔ ✔ ✔ ✔ Must be secured by network access control. +:doc:`Cassandra` ✔ ✔ ✔ ✔ Another supported NoSQL DB :doc:`SQL` ✔ ✔ ✔ ✔ Unoptimized for :doc:`session explorer` and :doc:`single session` features. :doc:`REST` |new| ✔ ✔ ✔ ✔ Proxy backend to be used in conjunction with another session backend. :doc:`SOAP` |deprecated| ✔ ✔ ✔ ✔ Proxy backend to be used in conjunction with another session backend. -- GitLab