************
Exploitation
************

Table Migration
===============

The command line does the following procedure:

- Rename existing table ('xxx' will be 'xxx_old')
- Create an empty partitioned table
- Migrate data in partitioned table (with 'SELECT INSERT' statement)

.. warning::
    You need to do some verifications before:

- Enough space on MySQL Server (at least twice the size of the table. Indexes and Datas)
- No data in futures (time is used for the partitioning)
- Enough memory on database server

.. warning:: 
    the 'SELECT INSERT' statement will lock the table and maybe your production in some points (per example table migration of 'logs').
  
Table migration is done by using the option '-m'::

  # php /usr/share/centreon/bin/centreon-partitioning.php -m data_bin

If the table migration is ok, the old table can be deleted with the following commande::

  # mysql centreon_storage
  mysql> DROP TABLE data_bin_old;

Table Update
============

After the table partitioned is done, current updates are needed. A cron script is executed every days::

  0 4 * * * centreon /usr/bin/php /usr/share/centreon/cron/centreon-partitioning.php >> /var/log/centreon/centreon-partitioning.log 2>&1

