nalc-server/doc/planSauvegarde.md

140 lines
3.4 KiB
Markdown

<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. Plan de sauvegarde et restauration du serveur NALC</a>
<ul>
<li><a href="#sec-1-1">1.1. Quelques variables</a></li>
<li><a href="#sec-1-2">1.2. Tableau des sauvegardes</a></li>
<li><a href="#sec-1-3">1.3. Étapes de restauration des BDD</a></li>
</ul>
</li>
</ul>
</div>
</div>
# Plan de sauvegarde et restauration du serveur NALC<a id="sec-1" name="sec-1"></a>
## Quelques variables<a id="sec-1-1" name="sec-1-1"></a>
NALC-SERVER=/home/minetest/nalc-server-0.4.17-r1
bak=$NALC-SERVER/backup
bak<sub>tmp</sub>=/var/tmp/nalc-0.4<sub>dump</sub>
log<sub>dir</sub>=$NALC-SERVER/logs
## Tableau des sauvegardes<a id="sec-1-2" name="sec-1-2"></a>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="left" />
<col class="left" />
<col class="left" />
<col class="left" />
<col class="left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="left">Quoi</th>
<th scope="col" class="left">Comment</th>
<th scope="col" class="left">Depuis</th>
<th scope="col" class="left">Vers</th>
<th scope="col" class="left">Quand</th>
</tr>
</thead>
<tbody>
<tr>
<td class="left">$NALC-SERVER/minetest/minetest.conf</td>
<td class="left">cp</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak/data/</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">$NALC-SERVER/start.sh</td>
<td class="left">cp</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak/data/</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">$NALC-SERVER/backup.sh</td>
<td class="left">cp</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak/data/</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">$NALC-SERVER/minetest/worlds/nalc</td>
<td class="left">tar -I pbzip2</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak/data/world.tar.bz2</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">BDD nalc-0.4.17</td>
<td class="left">pg<sub>dump</sub> -Fc</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak<sub>tmp</sub>/nalc-0.4.17.dump</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">BDD players-nalc-0.4.17</td>
<td class="left">pg<sub>dump</sub> -Fc</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak<sub>tmp</sub>/players-nalc-0.4.17.dump</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">$bak<sub>tmp</sub>/\*.dump</td>
<td class="left">tar</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$bak/data/dump<sub>sql</sub>.tar</td>
<td class="left">5h00</td>
</tr>
<tr>
<td class="left">$log<sub>dir</sub>/moredebug.log</td>
<td class="left">bzip2 && tar</td>
<td class="left">$NALC-SERVER/shutdown.sh</td>
<td class="left">$log<sub>dir</sub>/moredebug-logs.tar</td>
<td class="left">5h00</td>
</tr>
</tbody>
</table>
## Étapes de restauration des BDD<a id="sec-1-3" name="sec-1-3"></a>
$ cd $NALC-SERVER
$ mkdir dumps
$ cd dumps
$ tar -xvf $bak/data/dump_sql.tar
$ dropdb nalc-0.4.17
$ dropdb players-nalc-0.4.17
$ createdb nalc-0.4.17
$ createdb players-nalc-0.4.17
$ (login as postgresql user)
$ pg_restore -d nalc-0.4.17 $NALC-SERVER/dumps/nalc-0.4.17.dump
$ pg_restore -d players-nalc-0.4.17 $NALC-SERVER/dumps/players-nalc-0.4.17.dump
$ (logout)
$ rm -rf $NALC-SERVER/dumps