This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(logs): Managing the modification of the log_id column from the ce…
…ntreon_storage.logs table (#7786) * Add script to modify the logs table structure * Add know issues in FAQ documentation documentation
- Loading branch information
Showing
12 changed files
with
850 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ FAQ | |
administration | ||
performance | ||
remote_server | ||
known_issues/index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
============ | ||
Known issues | ||
============ | ||
|
||
* Limitation of max value for the primary key of the centreon_storage.logs table (:ref:`update_centreon_storage_logs`) |
136 changes: 136 additions & 0 deletions
136
doc/en/faq/known_issues/update_centreon_storage_logs.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
.. _update_centreon_storage_logs: | ||
|
||
================================== | ||
Update centreon_storage.logs table | ||
================================== | ||
|
||
Issues | ||
====== | ||
|
||
Some customers have reached the maximum number of records in the centreon_storage.logs table which currently can only | ||
contain 2 147 483 647 records (signed integer, count from 0). | ||
|
||
Broker can therefore no longer add any elements to this table. | ||
|
||
Objectif | ||
======== | ||
|
||
The purpose of this procedure is to allow the modification of the log_id column of the centreon_storage.logs table. | ||
|
||
The easiest way to make this change would be to execute the following command directly on the table to change the type | ||
of the log_id column: :: | ||
|
||
ALTER TABLE centreon_storage.logs MODIFY log_id BIGINT(20) NOT NULL AUTO_INCREMENT | ||
|
||
However, this operation would block the table during the modification and could take several hours before the end of | ||
the operation. Broker would be forced to retain and block the logs upload on the Centreon interface throughout the | ||
process. | ||
|
||
Nevertheless, this option could be considered if the table contains only a few records (< 10 million). | ||
|
||
For large volumes we have created a script allowing the migration of data by partition from the old table to the new | ||
one without service interruption. | ||
|
||
Requirements | ||
============ | ||
|
||
Password | ||
-------- | ||
|
||
Before starting to run the script, it is necessary to get root password of Centreon database. | ||
|
||
Enable PHP on Centreon 19.10 (**Centos7**) | ||
------------------------------------------ | ||
|
||
On the new version 19.10 of Centreon (Centos7), it is mandatory to enable PHP before running PHP scripts in command line. | ||
|
||
Then, run the following command: :: | ||
|
||
# scl enable rh-php72 bash | ||
|
||
Explanations | ||
============ | ||
|
||
Functional diagram: | ||
|
||
.. image:: /images/faq/workflow_centreon_storage_logs.png | ||
:align: center | ||
|
||
The update will proceed as follows: | ||
|
||
1. renaming the table **centreon_storage.logs** in **centreon_storage.logs_old** | ||
2. creating the new table **centreon_storage.logs** | ||
3. migration of data by partition | ||
|
||
Update | ||
====== | ||
|
||
On regular installation of Centreon, the script is located here: :: | ||
|
||
# usr/share/centreon/tools/update_centreon_storage_logs.php | ||
|
||
Run in interactive mode (<10 million rows) | ||
------------------------------------------ | ||
|
||
1. go into the following folder : /usr/share/centreon/tools | ||
2. then, run the following script: :: | ||
|
||
# php update_centreon_storage_logs.php | ||
|
||
Run in non-interactive mode (>10 million rows) | ||
---------------------------------------------- | ||
|
||
1. go into the following folder : /usr/share/centreon/tools | ||
2. then, run the following script: :: | ||
|
||
# nohup php update_centreon_storage_logs.php --password=root_password [--keep |--no-keep] > update_logs.logs & | ||
|
||
.. note:: Run options: | ||
|
||
--password: | ||
root password of Centreon database (eg. --password=my_root_password). | ||
--keep: | ||
keep data of old table to centreon_storage.logs_old. | ||
--no-keep: | ||
remove progressively data from centreon_storage.logs_old during the migration to the new table centreon_storage.logs. | ||
--temporary-path: | ||
directory in which temporary files will be stored | ||
|
||
.. warning:: | ||
If you decide to keep the data from the old centreon_storage.logs table, do not forget to check the available disk space. | ||
|
||
Resuming migration | ||
------------------ | ||
|
||
If, for any reason, you want to stop the migration script, know that it is possible to restart it so that it can resume | ||
where it was. | ||
|
||
.. note:: Recovery option: | ||
|
||
--continue: | ||
This option is used to specify the resumption of migrations after an execution interruption. | ||
|
||
If this option is specified, the structures of the *centreon_storage.logs* and *centreon_storage.logs_old* | ||
tables will not be affected. | ||
|
||
For this there are two possibilities: | ||
|
||
1. y specifying the name of the last partition processed. | ||
2. Without specifying the name of the last partition processed, the script will use the first non-empty partition of | ||
the centreon_storage.logs_old table. | ||
|
||
.. warning:: | ||
Using the *--continue* option without specifying the name of the last partition being processed should only be used | ||
if you specified the *--no-keep* option the previous time the script was run. | ||
|
||
Examples: :: | ||
|
||
# nohup php update_centreon_storage_logs.php --continue [--password=root_password] | ||
|
||
or :: | ||
|
||
# nohup php update_centreon_storage_logs.php --continue=last_partition_name [--password=root_password] | ||
|
||
.. note:: | ||
To find the name of the last partition processed, just look in the script processing logs for the name of the last | ||
partition being processed before the script was stopped. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ Foire Aux Questions | |
administration | ||
performance | ||
remote_server | ||
known_issues/index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
================ | ||
Problèmes connus | ||
================ | ||
|
||
* Limitation de la valeur maximale pour la clé primaire de la table centreon_storage.logs | ||
(:ref:`update_centreon_storage_logs`) |
141 changes: 141 additions & 0 deletions
141
doc/fr/faq/known_issues/update_centreon_storage_logs.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
.. _update_centreon_storage_logs: | ||
|
||
============================================= | ||
Mise à jour de la table centreon_storage.logs | ||
============================================= | ||
|
||
Problématique | ||
============= | ||
|
||
Certains clients ont atteint le nombre maximal d'enregistrements dans la table centreon_storage.logs qui actuellement | ||
ne peuxtcontenir que 2 147 483 647 enregistrements (entier signé, comptage à partir de 0). | ||
|
||
Broker ne peut donc plus rajouter d'élément dans cette table. | ||
|
||
Objectif | ||
======== | ||
|
||
L’objectif de cette procédure est de permettre la modification de la colonne log_id de la table centreon_storage.logs | ||
|
||
La façon la plus simple pour effectuer cette modification consisterait à exécuter la commande suivante directement sur | ||
la table afin de modifier le type de la colonne log_id : :: | ||
|
||
ALTER TABLE centreon_storage.logs MODIFY log_id BIGINT(20) NOT NULL AUTO_INCREMENT | ||
|
||
Cependant cette opération bloquerait la table durant la modification et pourrait prendre plusieurs heures avant la fin | ||
de l'opération. Broker se verrait contraint de faire de la rétention et bloquerait la remontée de log sur l'interface | ||
Centreon durant tout le processus. | ||
|
||
Malgré tout cette option pourrait être envisagée dans le cas où la table ne contiendrait que peu d'enregistrements | ||
(< 10 millions). | ||
|
||
Pour les grosses volumétries nous avons réalisé un script permettant la migration des données par partition de | ||
l'ancienne table vers la nouvelle sans interruption de service. | ||
|
||
Prérequis | ||
========= | ||
|
||
Mot de passe | ||
------------ | ||
|
||
Avant de pouvoir exécuter le script il est nécessaire de vous munir du mot de passe root de la base de données | ||
Centreon. | ||
|
||
Activation de PHP pour Centreon 19.10 (**Centos7**) | ||
--------------------------------------------------- | ||
|
||
Sur la nouvelle version 19.10 de Centreon (Centos7) il est nécessaire d’activer PHP avant de pouvoir lancer des scripts | ||
PHP en ligne de commande. | ||
|
||
La commande est la suivante : :: | ||
|
||
# scl enable rh-php72 bash | ||
|
||
Explications | ||
============ | ||
|
||
Diagramme fonctionnel : | ||
|
||
.. image:: /images/faq/workflow_centreon_storage_logs.png | ||
:align: center | ||
|
||
La mise à jour de la table se déroulera de la façon suivante: | ||
|
||
1. renommage de la table **centreon_storage.logs** en **centreon_storage.logs_old** | ||
2. création de la nouvelle table **centreon_storage.logs** | ||
3. migration des données par partition | ||
|
||
Mise à jour | ||
=========== | ||
|
||
Sur une installation classique de Centreon, le script se situe à l’emplacement suivant : :: | ||
|
||
# usr/share/centreon/tools/update_centreon_storage_logs.php | ||
|
||
Exécution en mode interactif (<10 millions d’enregistrements) | ||
------------------------------------------------------------- | ||
|
||
1. placez-vous dans le dossier : /usr/share/centreon/tools | ||
2. puis exécuter le script suivant : :: | ||
|
||
# php update_centreon_storage_logs.php | ||
|
||
Exécution en mode non-interactif (>10 millions d’enregistrements) | ||
----------------------------------------------------------------- | ||
|
||
1. placez-vous dans le dossier : /usr/share/centreon/tools | ||
2. puis exécuter le script suivant : :: | ||
|
||
# nohup php update_centreon_storage_logs.php --password=root_password [--keep |--no-keep] > update_logs.logs & | ||
|
||
.. note:: Options de démarrage : | ||
|
||
--password: | ||
mot de passe root de la base de données Centreon (ex. --password=my_root_password). | ||
--keep: | ||
indique que faut conserver les données de l’ancienne table (renommé en centreon_storage.logs_old). | ||
--no-keep: | ||
indique que les données de l’ancienne table centreon_storage.logs_old peuvent être supprimées au fur et à mesure de | ||
la migration des données vers la nouvelle table centreon_storage.logs. | ||
--temporary-path: | ||
indique le dossier où seront stockés les fichiers temporaires. | ||
|
||
.. warning:: | ||
Si vous décidez de conserver les données de l'ancienne table centreon_storage.logs n'oubliez pas de vérifier l'espace | ||
disque disponible. | ||
|
||
Reprise de la migration | ||
----------------------- | ||
|
||
Si, pour une raison quelconque, vous souhaitez arrêter le script de migration sachez qu’il est possible de le redémarrer | ||
afin qu’il reprenne là où il en était. | ||
|
||
.. note:: Option de reprise : | ||
|
||
--continue: | ||
Cette option permet de spécifier la reprise des migrations après une interruption d'exécution. | ||
|
||
Si cette option est spécifiée les structures des tables *centreon_storage.logs* et *centreon_storage.logs_old* | ||
ne seront pas touchées. | ||
|
||
Pour cela il y a deux possibilités : | ||
|
||
1. En spécifiant le nom de dernière partition traitée. | ||
2. Sans spécifier le nom de la dernière partition traitée, le script utilisera la première partition non-vide de la | ||
table centreon_storage.logs_old. | ||
|
||
.. warning:: | ||
L’utilisation de l’option *--continue* sans spécifier le nom de la dernière partition traitée n’est à utiliser que | ||
si vous aviez spécifié l’option *--no-keep* lors de la précédente exécution du script. | ||
|
||
Exemples : :: | ||
|
||
# nohup php update_centreon_storage_logs.php --continue [--password=root_password] | ||
|
||
ou :: | ||
|
||
# nohup php update_centreon_storage_logs.php --continue=last_partition_name [--password=root_password] | ||
|
||
.. note:: | ||
Pour connaître le nom de la dernière partition traitée il vous suffit de regarder dans les logs de traitement du | ||
script le nom de la dernière partition en cours de traitement avant l’arrêt du script. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.