Archiving the Dgraph log files

Your Dgraph files are archived automatically once you run a baseline update script with the Deployment Template. In addition, if you prefer to archive Dgraph files on a more granular basis, you can create a custom Deployment Template script that stops the MDEX Engine process, archives the Dgraph log files and restarts the Dgraph.

The applyIndex() method of the baseline update script stops the Dgraph, archives the log files, and restarts the Dgraph. This method is located in the DistributeIndexAndApply step of the default baseline update script in the Deployment Template. You can use this method to create a customized script.

To stop the Dgraph, archive its logs, and restart the Dgraph:

  1. Copy the applyIndex() method into a new script within your Deployment Template project, and modify it as needed, as shown in the following example:
     
    <!--#######################################
     # CUSTOM: Restart all dgraphs, archiving log files 
     #
     -->
    <script id="DgraphRestartWithArchive">
    <log-dir>./logs</log-dir>
     <bean-shell-script>
       <![CDATA[
        for ( DgraphComponent dgraph : DgraphCluster.getDgraphs() )
        {
           if ( dgraph.isActive() )
           {
             dgraph.stop();
           }
        dgraph.archiveLogDir();
        dgraph.start();
        }
      ]]>
      </bean-shell-script>
    </script>
    
  2. To archive Dgraph logs, go to the application /control directory, and run this script: runcommand DgraphRestartWithArchive