<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<section id="JCR.SearchIndexBackup">
  <title>How to backup the data of your JCR using an external backup tool in 3 steps?</title>

  <section id="JCR.SearchIndexBackup.SuspendRepository">
    <title>Step 1: Suspend the Repository</title>

    <para>To keep all the data of your repository consistent, you have to
    suspend it which means that all the working threads will be suspended until 
    the resume operation is performed. Indexes will be flushed during
    the suspend operation.</para>

    <para>You can suspend your repository by calling the suspend method
    on the MBean of the RepositorySuspendController corresponding to
    your repository as shown below:</para>

    <mediaobject>
      <imageobject>
        <imagedata fileref="images/repository-suspend-controller.png" />
      </imageobject>
    </mediaobject>

    <para>The result of the suspend method will be "suspended" if everything worked
    well otherwise you should get "undefined" which means that at least one component has not been 
    suspended successfully, in that case you can check the log file to understand what happens.</para>

    <mediaobject>
      <imageobject>
        <imagedata fileref="images/repository-suspend-controller-suspended.png" />
      </imageobject>
    </mediaobject>
  </section>

  <section id="JCR.SearchIndexBackup.Backup">
    <title>Step 2: Backup the data</title>

    <para>Now we can backup the data manually or using third party softwares. We will
    need to backup:</para>

    <itemizedlist>
      <listitem>
        <para>The database content</para>
      </listitem>

      <listitem>
        <para>The Lucene indexes</para>
      </listitem>

      <listitem>
        <para>The value storages content (if configured)</para>
      </listitem>
    </itemizedlist>
  </section>

  <section id="JCR.SearchIndexBackup.ResumeRepository">
    <title>Step 3: Resume the Repository</title>

    <para>Once the backup is done, we need to call the resume operation to resume
    all the working threads that have been previously suspended. The expected return result is "online".</para>

    <mediaobject>
      <imageobject>
        <imagedata fileref="images/repository-suspend-controller-online.png" />
      </imageobject>
    </mediaobject>
  </section>
</section>
