| 20 | | linkend="table.sl-seqlog"/>.</para></listitem> |
|---|
| 21 | | |
|---|
| 22 | | <listitem><para> Vacuum certain tables used by &slony1;. As of 1.0.5, |
|---|
| 23 | | this includes &pglistener;; in earlier versions, you must vacuum that |
|---|
| 24 | | table heavily, otherwise you'll find replication slowing down because |
|---|
| 25 | | &slony1; raises plenty of events, which leads to that table having |
|---|
| 26 | | plenty of dead tuples.</para> |
|---|
| 27 | | |
|---|
| 28 | | <para> In some versions (1.1, for sure; possibly 1.0.5) there is the |
|---|
| 29 | | option of not bothering to vacuum any of these tables if you are using |
|---|
| 30 | | something like <application>pg_autovacuum</application> to handle |
|---|
| 31 | | vacuuming of these tables. Unfortunately, it has been quite possible |
|---|
| 32 | | for <application>pg_autovacuum</application> to not vacuum quite |
|---|
| 33 | | frequently enough, so you may prefer to use the internal vacuums. |
|---|
| 34 | | Vacuuming &pglistener; <quote>too often</quote> isn't nearly as |
|---|
| 35 | | hazardous as not vacuuming it frequently enough.</para> |
|---|
| 36 | | |
|---|
| 37 | | <para>Unfortunately, if you have long-running transactions, vacuums |
|---|
| 38 | | cannot clear out dead tuples that are newer than the eldest |
|---|
| 39 | | transaction that is still running. This will most notably lead to |
|---|
| 40 | | &pglistener; growing large and will slow |
|---|
| 41 | | replication.</para></listitem> |
|---|
| 42 | | |
|---|
| 43 | | <listitem> <para> The <link linkend="dupkey"> Duplicate Key Violation |
|---|
| 44 | | </link> bug has helped track down some &postgres; race conditions. |
|---|
| 45 | | One remaining issue is that it appears that is a case where |
|---|
| 46 | | <command>VACUUM</command> is not reclaiming space correctly, leading |
|---|
| 47 | | to corruption of B-trees. </para> |
|---|
| 48 | | |
|---|
| 49 | | <para> It may be helpful to run the command <command> REINDEX TABLE |
|---|
| 50 | | sl_log_1;</command> periodically to avoid the problem |
|---|
| 51 | | occurring. </para> </listitem> |
|---|
| 52 | | |
|---|
| 53 | | <listitem><para> As of version 1.2, <quote>log switching</quote> |
|---|
| 54 | | functionality is in place; every so often, it seeks to switch between |
|---|
| 55 | | storing data in &sllog1; and &sllog2; so that it may seek |
|---|
| 56 | | to <command>TRUNCATE</command> the <quote>elder</quote> data.</para> |
|---|
| 57 | | |
|---|
| 58 | | <para> That means that on a regular basis, these tables are completely |
|---|
| 59 | | cleared out, so that you will not suffer from them having grown to |
|---|
| 60 | | some significant size, due to heavy load, after which they are |
|---|
| 61 | | incapable of shrinking back down </para> </listitem> |
|---|
| 62 | | |
|---|
| 63 | | </itemizedlist> |
|---|
| 64 | | </para> |
|---|
| 65 | | |
|---|
| 66 | | |
|---|
| 67 | | <sect2 id="maintenance-autovac"> <title> Interaction with &postgres; |
|---|
| 68 | | autovacuum </title> |
|---|
| 69 | | |
|---|
| 70 | | <indexterm><primary>autovacuum interaction</primary></indexterm> |
|---|
| 71 | | |
|---|
| 72 | | <para> Recent versions of &postgres; support an |
|---|
| 73 | | <quote>autovacuum</quote> process which notices when tables are |
|---|
| 74 | | modified, thereby creating dead tuples, and vacuums those tables, |
|---|
| 75 | | <quote>on demand.</quote> It has been observed that this can interact |
|---|
| 76 | | somewhat negatively with &slony1;'s own vacuuming policies on its own |
|---|
| 77 | | tables. </para> |
|---|
| 78 | | |
|---|
| 79 | | <para> &slony1; requests vacuums on its tables immediately after |
|---|
| 80 | | completing transactions that are expected to clean out old data, which |
|---|
| 81 | | may be expected to be the ideal time to do so. It appears as though |
|---|
| 82 | | autovacuum may notice the changes a bit earlier, and attempts |
|---|
| 83 | | vacuuming when transactions are not complete, rendering the work |
|---|
| 84 | | pretty useless. It seems preferable to configure autovacuum to avoid |
|---|
| 85 | | vacuum &slony1;-managed configuration tables. </para> |
|---|
| 86 | | |
|---|
| 87 | | <para> The following query (change the cluster name to match your |
|---|
| 88 | | local configuration) will identify the tables that autovacuum should |
|---|
| 89 | | be configured not to process: </para> |
|---|
| | 22 | linkend="table.sl-seqlog"/>;</para></listitem> |
|---|
| | 23 | |
|---|
| | 24 | <listitem><para>effectue un vacuum sur certaines |
|---|
| | 25 | tables utilisées par &slony1;. |
|---|
| | 26 | A partir de la version 1.0.5, ceci inclut &pglistener;; |
|---|
| | 27 | dans les versions antérieures, vous devez lancer |
|---|
| | 28 | souvent des vacuums sur cette table, sinon |
|---|
| | 29 | vous verrez votre réplication ralentir |
|---|
| | 30 | car &slony1; lÚve beaucoup d'événets, |
|---|
| | 31 | qui mÚnent à table à contenir de nombreux |
|---|
| | 32 | tuples morts. |
|---|
| | 33 | </para> |
|---|
| | 34 | |
|---|
| | 35 | <para>Avec certaines versions (la 1.1; peut-être la 1.0.5) |
|---|
| | 36 | il est possible de ne plus s'embarrasser avec les vacuums |
|---|
| | 37 | sur ces tables si vous utiliser quelque chose comme |
|---|
| | 38 | <application>pg_autovacuum</application> |
|---|
| | 39 | pour gérer le nettoyage de ces tables. |
|---|
| | 40 | Malheureusement, il est possible que |
|---|
| | 41 | <application>pg_autovacuum</application> |
|---|
| | 42 | ne nettoie pas assez fréquemment, vous pourrez donc préférer utiliser les vacuums internes. |
|---|
| | 43 | |
|---|
| | 44 | Nettoyer la table &pglistener; <quote>trop |
|---|
| | 45 | souvent</quote> |
|---|
| | 46 | est moins risqué que de ne pas la nettoyer assez. |
|---|
| | 47 | </para> |
|---|
| | 48 | |
|---|
| | 49 | <para>Malheureusement, si vous avez de longues transactions, |
|---|
| | 50 | les vacuums ne peuvent pas nettoyer les tuples morts |
|---|
| | 51 | qui sont plus récents que les anciennes transactions |
|---|
| | 52 | toujours en cours. Ceci conduira en particulier à une |
|---|
| | 53 | forte croissance de &pglistener; |
|---|
| | 54 | et ralentira la réplication. |
|---|
| | 55 | </para></listitem> |
|---|
| | 56 | |
|---|
| | 57 | |
|---|
| | 58 | <listitem> <para> Le bug <link linkend="dupkey"> Violation par |
|---|
| | 59 | clef dupliqué</link> a permis d'isoler des situations de |
|---|
| | 60 | concurrence dans &postgres; |
|---|
| | 61 | Des problÚms subsiste notamment |
|---|
| | 62 | lorsque <command>VACUUM</command> ne |
|---|
| | 63 | réclame pas correctement l'espace |
|---|
| | 64 | menant à une corruption des arbres B. </para> |
|---|
| | 65 | |
|---|
| | 66 | <para>Il peut être utile de lancer la commande |
|---|
| | 67 | <command> REINDEX TABLE sl_log_1;</command> |
|---|
| | 68 | périodiquement pour éviter ce problÚm |
|---|
| | 69 | </para> </listitem> |
|---|
| | 70 | |
|---|
| | 71 | <listitem><para> A partir de la version 1.2, |
|---|
| | 72 | la fonctionnalité <quote>log switching</quote> |
|---|
| | 73 | est arrivée;de temps en temps, elle tente d'interchanger |
|---|
| | 74 | les données entre &sllog1; and &sllog2; |
|---|
| | 75 | afin de réaliser un |
|---|
| | 76 | <command>TRUNCATE</command> sur les <quote>plus vielles</quote> |
|---|
| | 77 | données.</para> |
|---|
| | 78 | |
|---|
| | 79 | <para> Cela signifie que de maniÚre réguliÚre, |
|---|
| | 80 | ces tables sont complÚtement nettoyées ce qui |
|---|
| | 81 | évitequ'elle ne grossisse trop |
|---|
| | 82 | lors d'une charge importante |
|---|
| | 83 | et qu'elles deviennent |
|---|
| | 84 | impossible à nettoyer. |
|---|
| | 85 | |
|---|
| | 86 | </para> </listitem> |
|---|
| | 87 | |
|---|
| | 88 | </itemizedlist> |
|---|
| | 89 | </para> |
|---|
| | 90 | |
|---|
| | 91 | |
|---|
| | 92 | <sect2 id="maintenance-autovac"> |
|---|
| | 93 | <title> Intéraction avec l'autovaccum de &postgres; |
|---|
| | 94 | </title> |
|---|
| | 95 | |
|---|
| | 96 | <indexterm><primary>interaction avec autovacuum</primary></indexterm> |
|---|
| | 97 | |
|---|
| | 98 | <para>Les versions récentes de&postgres; propose |
|---|
| | 99 | un processus <quote>autovacuum</quote> |
|---|
| | 100 | qui détecte les modifications sur les tables et la |
|---|
| | 101 | création |
|---|
| | 102 | de tuples mort, puis nettoie de ces tables, |
|---|
| | 103 | <quote>Ã la demande.</quote>. |
|---|
| | 104 | On a constaté que cela peut interagir de maniÚre |
|---|
| | 105 | négative avec la politique de vacuum de &slony1; |
|---|
| | 106 | sur ces propres tables. </para> |
|---|
| | 107 | |
|---|
| | 108 | <para> &slony1; demande des vacuums sur ses tables |
|---|
| | 109 | immédiatement aprÚs avoir complété les |
|---|
| | 110 | transactions |
|---|
| | 111 | qui sont sensées supprimer de vieilles données, |
|---|
| | 112 | ce qui est considéré comme le meilleur moment |
|---|
| | 113 | pour le faire. Il semble que l'autovacuum détecte |
|---|
| | 114 | les changements un peu trop tÃŽt, et lance un vacuum |
|---|
| | 115 | alors que les transactions ne sont pas complétées, |
|---|
| | 116 | ce qui est relativement inutile. |
|---|
| | 117 | Il apparait préférable de configurer l'autovacuum |
|---|
| | 118 | pour éviter les tables de configuration |
|---|
| | 119 | gérées par &slony1;. </para> |
|---|
| | 120 | |
|---|
| | 121 | <para> La requête suivante identifie les tables que |
|---|
| | 122 | l'autovacuum ne doit pas traiter (remplacez le nom du |
|---|
| | 123 | cluster par celui de votre configuration locale) : |
|---|
| | 124 | </para> |
|---|
| 121 | | <sect2><title> Watchdogs: Keeping Slons Running</title> |
|---|
| 122 | | |
|---|
| 123 | | <indexterm><primary>watchdogs to keep slon daemons running</primary></indexterm> |
|---|
| 124 | | |
|---|
| 125 | | <para>There are a couple of <quote>watchdog</quote> scripts available |
|---|
| 126 | | that monitor things, and restart the <application>slon</application> |
|---|
| 127 | | processes should they happen to die for some reason, such as a network |
|---|
| 128 | | <quote>glitch</quote> that causes loss of connectivity.</para> |
|---|
| 129 | | |
|---|
| 130 | | <para>You might want to run them...</para> |
|---|
| 131 | | |
|---|
| 132 | | <para> The <quote>best new way</quote> of managing <xref |
|---|
| 133 | | linkend="slon"/> processes is via the combination of <xref |
|---|
| 134 | | linkend="mkslonconf"/>, which creates a configuration file for each |
|---|
| 135 | | node in a cluster, and <xref linkend="launchclusters"/>, which uses |
|---|
| 136 | | those configuration files.</para> |
|---|
| 137 | | |
|---|
| 138 | | <para> This approach is preferable to elder <quote>watchdog</quote> |
|---|
| 139 | | systems in that you can very precisely <quote>nail down,</quote> in |
|---|
| 140 | | each config file, the exact desired configuration for each node, and |
|---|
| 141 | | not need to be concerned with what options the watchdog script may or |
|---|
| 142 | | may not give you. This is particularly important if you are using |
|---|
| 143 | | <link linkend="logshipping"> log shipping </link>, where forgetting |
|---|
| 144 | | the <command>-a</command> option could ruin your log shipped node, and |
|---|
| 145 | | thereby your whole day.</para> |
|---|
| 146 | | |
|---|
| 147 | | </sect2> |
|---|
| 148 | | |
|---|
| 149 | | <sect2 id="gensync"><title>Parallel to Watchdog: generate_syncs.sh</title> |
|---|
| 150 | | |
|---|
| 151 | | <indexterm><primary>generate SYNCs</primary></indexterm> |
|---|
| 152 | | |
|---|
| 153 | | <para>A new script for &slony1; 1.1 is |
|---|
| 154 | | <application>generate_syncs.sh</application>, which addresses the following kind of |
|---|
| 155 | | situation.</para> |
|---|
| 156 | | |
|---|
| 157 | | <para>Supposing you have some possibly-flakey server where the |
|---|
| 158 | | <application>slon</application> daemon that might not run all the time, you might |
|---|
| 159 | | return from a weekend away only to discover the following situation.</para> |
|---|
| 160 | | |
|---|
| 161 | | <para>On Friday night, something went <quote>bump</quote> and while the |
|---|
| 162 | | database came back up, none of the <application>slon</application> daemons |
|---|
| 163 | | survived. Your online application then saw nearly three days worth of |
|---|
| 164 | | reasonably heavy transaction load.</para> |
|---|
| 165 | | |
|---|
| 166 | | <para>When you restart <application>slon</application> on Monday, it |
|---|
| 167 | | hasn't done a SYNC on the master since Friday, so that the next |
|---|
| 168 | | <quote>SYNC set</quote> comprises all of the updates between Friday |
|---|
| 169 | | and Monday. Yuck.</para> |
|---|
| 170 | | |
|---|
| 171 | | <para>If you run <application>generate_syncs.sh</application> as a cron job every |
|---|
| 172 | | 20 minutes, it will force in a periodic <command>SYNC</command> on the origin, which |
|---|
| 173 | | means that between Friday and Monday, the numerous updates are split |
|---|
| 174 | | into more than 100 syncs, which can be applied incrementally, making |
|---|
| 175 | | the cleanup a lot less unpleasant.</para> |
|---|
| 176 | | |
|---|
| 177 | | <para>Note that if <command>SYNC</command>s <emphasis>are</emphasis> running |
|---|
| 178 | | regularly, this script won't bother doing anything.</para> |
|---|
| 179 | | </sect2> |
|---|
| 180 | | |
|---|
| 181 | | <sect2><title>Testing &slony1; State </title> |
|---|
| 182 | | |
|---|
| 183 | | <indexterm><primary>testing cluster status</primary></indexterm> |
|---|
| 184 | | |
|---|
| 185 | | <para> In the <filename>tools</filename> directory, you may find |
|---|
| 186 | | scripts called <filename>test_slony_state.pl</filename> and |
|---|
| 187 | | <filename>test_slony_state-dbi.pl</filename>. One uses the Perl/DBI |
|---|
| 188 | | interface; the other uses the Pg interface. |
|---|
| 189 | | </para> |
|---|
| 190 | | |
|---|
| 191 | | <para> Both do essentially the same thing, namely to connect to a |
|---|
| 192 | | &slony1; node (you can pick any one), and from that, determine all the |
|---|
| 193 | | nodes in the cluster. They then run a series of queries (read only, |
|---|
| 194 | | so this should be quite safe to run) which look at the various |
|---|
| 195 | | &slony1; tables, looking for a variety of sorts of conditions |
|---|
| 196 | | suggestive of problems, including: |
|---|
| 197 | | </para> |
|---|
| 198 | | |
|---|
| 199 | | <itemizedlist> |
|---|
| 200 | | <listitem><para> Bloating of tables like pg_listener, sl_log_1, sl_log_2, sl_seqlog </para></listitem> |
|---|
| 201 | | <listitem><para> Listen paths </para></listitem> |
|---|
| 202 | | <listitem><para> Analysis of Event propagation </para></listitem> |
|---|
| 203 | | <listitem><para> Analysis of Event confirmation propagation </para> |
|---|
| 204 | | |
|---|
| 205 | | <para> If communications is a <emphasis>little</emphasis> broken, |
|---|
| 206 | | replication may happen, but confirmations may not get back, which |
|---|
| 207 | | prevents nodes from clearing out old events and old replication |
|---|
| 208 | | data. </para> </listitem> |
|---|
| 209 | | </itemizedlist> |
|---|
| 210 | | |
|---|
| 211 | | <para> Running this once an hour or once a day can help you detect |
|---|
| 212 | | symptoms of problems early, before they lead to performance |
|---|
| 213 | | degradation. </para> |
|---|
| 214 | | </sect2> |
|---|
| 215 | | |
|---|
| 216 | | <sect2><title>Replication Test Scripts </title> |
|---|
| 217 | | |
|---|
| 218 | | <para> In the directory <filename>tools</filename> may be found four |
|---|
| 219 | | scripts that may be used to do monitoring of &slony1; instances: |
|---|
| 220 | | |
|---|
| 221 | | <itemizedlist> |
|---|
| 222 | | |
|---|
| 223 | | <listitem><para> <command>test_slony_replication</command> is a |
|---|
| 224 | | Perl script to which you can pass connection information to get to a |
|---|
| 225 | | &slony1; node. It then queries <xref linkend="table.sl-path"/> and |
|---|
| 226 | | other information on that node in order to determine the shape of the |
|---|
| 227 | | requested replication set.</para> |
|---|
| 228 | | |
|---|
| 229 | | <para> It then injects some test queries to a test table called |
|---|
| 230 | | <envar>slony_test</envar> which is defined as follows, and which needs to be |
|---|
| 231 | | added to the set of tables being replicated: |
|---|
| | 157 | <sect2><title> Chiens de garde : garder les Slons en vie</title> |
|---|
| | 158 | |
|---|
| | 159 | <indexterm><primary>Chiens de garde pour garder en vie les démons slon |
|---|
| | 160 | </primary></indexterm> |
|---|
| | 161 | |
|---|
| | 162 | <para>Il y a deux scripts <quote>chiens de garde</quote> disponibles pour surveiller |
|---|
| | 163 | la réplication et relancer les processus <application>slon</application> |
|---|
| | 164 | lorsqu'il meurent pour telle ou telle raison, par exemple une |
|---|
| | 165 | <quote>coupure</quote> réseau qui provoque une perte de connectivité.</para> |
|---|
| | 166 | |
|---|
| | 167 | <para>Ils pourraient vous être utiles...</para> |
|---|
| | 168 | |
|---|
| | 169 | <para> La <quote>meilleur et nouvelle</quote> façon de gérer les processus <xref |
|---|
| | 170 | linkend="slon"/> se fait via une combinaison de <xref |
|---|
| | 171 | linkend="mkslonconf"/>, qui crée un fichier de configuration pour chaque noeud |
|---|
| | 172 | d'un cluster, et <xref linkend="launchclusters"/> qui utilise ces fichiers |
|---|
| | 173 | de configuration.</para> |
|---|
| | 174 | |
|---|
| | 175 | <para> Cette approche est préférable aux anciens systÚmes de |
|---|
| | 176 | <quote>chiens de garde</quote> car vous pouvez <quote>pointer</quote> |
|---|
| | 177 | précisément, dans chaque fichier de configurationn, le paramÚtrage |
|---|
| | 178 | désiré pour chaque noeud, sans avoir à vous préoccuper des options |
|---|
| | 179 | que le script chien de garde vous proposer ( ou pas ). Ceci est particuliÚrement |
|---|
| | 180 | important si vous utilisez le <link linkend="logshipping"> log shipping </link>, |
|---|
| | 181 | auquel cas oublier l'option <command>-a</command> peut ruiner le noeud |
|---|
| | 182 | destinataire du log shipping et ruiner par là -même votre journée.</para> |
|---|
| | 183 | |
|---|
| | 184 | </sect2> |
|---|
| | 185 | |
|---|
| | 186 | <sect2 id="gensync"><title>En parallÚle aux chiens de garde : generate_syncs.sh</title> |
|---|
| | 187 | |
|---|
| | 188 | <indexterm><primary>Génére des SYNCs</primary></indexterm> |
|---|
| | 189 | |
|---|
| | 190 | <para>Un nouveau script est apparu dans &slony1; 1.1, il s'agit de |
|---|
| | 191 | <application>generate_syncs.sh</application>, qui est utilise dans les situations |
|---|
| | 192 | suivantes.</para> |
|---|
| | 193 | |
|---|
| | 194 | <para>Supposons que vous avez un serveur non fiable sur lequel le démon |
|---|
| | 195 | <application>slon</application> daemon ne fonctionne pas en continu, |
|---|
| | 196 | en rentrant de week-end vous vous trouverez peut-êtrÃÅ¡s la situation suivante : |
|---|
| | 197 | </para> |
|---|
| | 198 | |
|---|
| | 199 | <para>Le vendredi soir, quelque chose s'est <quote>cassé</quote> et le temps |
|---|
| | 200 | que la base de donnée redémarre, aucun des démons <application>slon</application> |
|---|
| | 201 | n'a survécu. Votre application en ligne a ensuite connu trois jours |
|---|
| | 202 | de charge transactionnelle relativement forte. |
|---|
| | 203 | </para> |
|---|
| | 204 | |
|---|
| | 205 | <para>Lorsque vous redémarrez <application>slon</application> le lundi, il n'y a pas eu |
|---|
| | 206 | de synchronisation sur le maître depuis Vendredi, ce qui fait que le prochain |
|---|
| | 207 | <quote>ensemble de SYNC</quote> comprendra toutes les modifications entre vendredi |
|---|
| | 208 | et lundi. Aïe !</para> |
|---|
| | 209 | |
|---|
| | 210 | <para>Si vous lancez <application>generate_syncs.sh</application> via une tache cron |
|---|
| | 211 | toute les 20 minutes, cela créera de force des événements <command>SYNC</command> |
|---|
| | 212 | sur l'origine, ce qui implique qu'entre vendredi et lundi, les nombreuses mises à jour |
|---|
| | 213 | seront découpées en plus de 100 ensemble de SYNCs, qui pourront être appliqués de |
|---|
| | 214 | maniÚre incrémentale, rendant la restauration mois déplaisante. |
|---|
| | 215 | </para> |
|---|
| | 216 | |
|---|
| | 217 | <para>Notez que si les <command>SYNC</command>s <emphasis>sont</emphasis> exécutés |
|---|
| | 218 | réguliÚrement, ce scripts ne fera rien de particulier.</para> |
|---|
| | 219 | </sect2> |
|---|
| | 220 | |
|---|
| | 221 | <sect2><title>Tester l'état &slony1; </title> |
|---|
| | 222 | |
|---|
| | 223 | <indexterm><primary>tester le statut du cluster</primary></indexterm> |
|---|
| | 224 | |
|---|
| | 225 | <para> Dans le répertoire <filename>tools</filename>, vous trouverez |
|---|
| | 226 | des scripts nommés <filename>test_slony_state.pl</filename> et |
|---|
| | 227 | <filename>test_slony_state-dbi.pl</filename>. Le premier utilise l'interface Perl/DBI |
|---|
| | 228 | ; l'autre utilise l'interface Pg. |
|---|
| | 229 | </para> |
|---|
| | 230 | |
|---|
| | 231 | <para> Les deux font essentiellement la même chose, c'est à dire |
|---|
| | 232 | se connecter à un noeud &slony1; (celui de votre choix) et à partir de là |
|---|
| | 233 | détermine la liste des noeuds du cluster. Ensuite ils lancent une |
|---|
| | 234 | série de requêtes ( en lecture seule, et donc sans danger ) afin |
|---|
| | 235 | de parcourir différentes tables à la recherche de différentes conditions |
|---|
| | 236 | susceptibles de rélever des problÚmes, telles que : |
|---|
| | 237 | </para> |
|---|
| | 238 | |
|---|
| | 239 | <itemizedlist> |
|---|
| | 240 | <listitem><para> Gonflement des tables comme pg_listener, sl_log_1, sl_log_2, sl_seqlog; </para></listitem> |
|---|
| | 241 | <listitem><para> Voies d'écoute;</para></listitem> |
|---|
| | 242 | <listitem><para> Analyse de la propagation des événéments; </para></listitem> |
|---|
| | 243 | <listitem><para> Analyse de la propagation des confirmations. </para> |
|---|
| | 244 | |
|---|
| | 245 | <para> Si la communication est <emphasis>légÚrement</emphasis> perturbée, |
|---|
| | 246 | la réplication peut fonctionner, mais les confirmations peuvent ne pas être retournées, |
|---|
| | 247 | ce qui empêche les noeuds de nettoyer les vieux événements et les anciennes données de réplication |
|---|
| | 248 | . </para> </listitem> |
|---|
| | 249 | </itemizedlist> |
|---|
| | 250 | |
|---|
| | 251 | <para> Lancer ce script une par heure ou une fois par jour peut vous aider |
|---|
| | 252 | à détecter les symptomes précurseurs de certains problÚmes, avant même |
|---|
| | 253 | que cela conduise à une dégradation des performances. </para> |
|---|
| | 254 | </sect2> |
|---|
| | 255 | |
|---|
| | 256 | <sect2><title>Scripts de test de la réplication</title> |
|---|
| | 257 | |
|---|
| | 258 | <para>Dans le répertoire <filename>tools</filename> on peut trouver 4 |
|---|
| | 259 | scripts qui peuvent être utilisés pour surveiller des instances &slony1; : |
|---|
| | 260 | |
|---|
| | 261 | <itemizedlist> |
|---|
| | 262 | |
|---|
| | 263 | <listitem><para> <command>test_slony_replication</command> est un script |
|---|
| | 264 | Perl auquel vous pouvez passer les informations de connexion |
|---|
| | 265 | d'un noeud &slony1;. Il test alors la table <xref linkend="table.sl-path"/> |
|---|
| | 266 | et d'autres informations sur ce noeud afin de déterminer la forme de |
|---|
| | 267 | l'ensemble de réplication choisi.</para> |
|---|
| | 268 | |
|---|
| | 269 | <para> Ensuite il injecte des requêtes de test dans la table nommée |
|---|
| | 270 | <envar>slony_test</envar> qui est définie comme ci-dessous, et |
|---|
| | 271 | qui doit être ajoutée à l'ensemble des tables répliquées : |
|---|
| 327 | | <listitem><para> See also the <xref linkend="slonymrtg"/> |
|---|
| 328 | | discussion. </para></listitem> |
|---|
| 329 | | |
|---|
| 330 | | </itemizedlist> |
|---|
| 331 | | </sect2> |
|---|
| 332 | | <sect2><title> Log Files</title> |
|---|
| 333 | | |
|---|
| 334 | | <indexterm><primary>log files</primary></indexterm> |
|---|
| 335 | | |
|---|
| 336 | | <para><xref linkend="slon"/> daemons generate some more-or-less verbose |
|---|
| 337 | | log files, depending on what debugging level is turned on. You might |
|---|
| 338 | | assortedly wish to: |
|---|
| 339 | | |
|---|
| 340 | | <itemizedlist> |
|---|
| 341 | | |
|---|
| 342 | | <listitem><para> Use a log rotator like |
|---|
| 343 | | <productname>Apache</productname> |
|---|
| 344 | | <application>rotatelogs</application> to have a sequence of log files |
|---|
| 345 | | so that no one of them gets too big;</para></listitem> |
|---|
| 346 | | |
|---|
| 347 | | <listitem><para> Purge out old log files, |
|---|
| 348 | | periodically.</para></listitem> |
|---|
| 349 | | |
|---|
| 350 | | </itemizedlist> |
|---|
| 351 | | </para> |
|---|
| 352 | | </sect2> |
|---|
| 353 | | |
|---|
| 354 | | <sect2><title>mkservice </title> |
|---|
| 355 | | <indexterm><primary>mkservice for BSD </primary></indexterm> |
|---|
| 356 | | |
|---|
| 357 | | <sect3><title>slon-mkservice.sh</title> |
|---|
| 358 | | |
|---|
| 359 | | <para> Create a slon service directory for use with svscan from |
|---|
| 360 | | daemontools. This uses multilog in a pretty basic way, which seems to |
|---|
| 361 | | be standard for daemontools / multilog setups. If you want clever |
|---|
| 362 | | logging, see logrep below. Currently this script has very limited |
|---|
| 363 | | error handling capabilities.</para> |
|---|
| 364 | | |
|---|
| 365 | | <para> For non-interactive use, set the following environment |
|---|
| 366 | | variables. <envar>BASEDIR</envar> <envar>SYSUSR</envar> |
|---|
| | 369 | <listitem><para> Voir également la discussion sur <xref linkend="slonymrtg"/>. </para></listitem> |
|---|
| | 370 | |
|---|
| | 371 | </itemizedlist> |
|---|
| | 372 | </sect2> |
|---|
| | 373 | <sect2><title> Fichiers de log</title> |
|---|
| | 374 | |
|---|
| | 375 | <indexterm><primary>fichiers de log</primary></indexterm> |
|---|
| | 376 | |
|---|
| | 377 | <para>Les démons <xref linkend="slon"/> génÚre des fichiers de logs plus |
|---|
| | 378 | ou moins verbeux, selon le niveau de debug activé. Dans ce cas vous pouvez : |
|---|
| | 379 | |
|---|
| | 380 | <itemizedlist> |
|---|
| | 381 | |
|---|
| | 382 | <listitem><para> Utiliser un programme de rotations de logs comme |
|---|
| | 383 | <application>rotatelogs</application> d'<productname>Apache</productname> |
|---|
| | 384 | pour avoir une sécancer de fichiers de logs et évite d'avoir des fichiers |
|---|
| | 385 | trop gros;</para></listitem> |
|---|
| | 386 | |
|---|
| | 387 | <listitem><para> Purgez réguliÚrement les vieux fichiers de log.</para></listitem> |
|---|
| | 388 | |
|---|
| | 389 | </itemizedlist> |
|---|
| | 390 | </para> |
|---|
| | 391 | </sect2> |
|---|
| | 392 | |
|---|
| | 393 | <sect2><title>service </title> |
|---|
| | 394 | <indexterm><primary>service pour BSD </primary></indexterm> |
|---|
| | 395 | |
|---|
| | 396 | <sect3><title>slon</title> |
|---|
| | 397 | |
|---|
| | 398 | <para> Ce script crée un répertoire pour le service slon qui pourra être |
|---|
| | 399 | utilisé avec la commande svscan de daemontools. Ce script utilise multilog |
|---|
| | 400 | de maniÚre trÚs basique, ce qui semble être standard pour les installations |
|---|
| | 401 | daemontools / multilog. Si vous souhaitez une gestion intelligente des logs, |
|---|
| | 402 | consultez la section logrep ci-dessous. Actuellement ce script à des possibilités |
|---|
| | 403 | de gestion d'erreurs trÚs limitées. |
|---|
| | 404 | </para> |
|---|
| | 405 | |
|---|
| | 406 | <para> Pour les usages non-interactifs, configurer les variables d'environnement |
|---|
| | 407 | suivantes : <envar>BASEDIR</envar> <envar>SYSUSR</envar> |
|---|
| 396 | | <para>This uses <command>tail -F</command> to pull data from log files allowing |
|---|
| 397 | | you to use multilog filters (by setting the CRITERIA) to create |
|---|
| 398 | | special purpose log files. The goal is to provide a way to monitor log |
|---|
| 399 | | files in near realtime for <quote>interesting</quote> data without either |
|---|
| 400 | | hacking up the initial log file or wasting CPU/IO by re-scanning the |
|---|
| 401 | | same log repeatedly. |
|---|
| 402 | | </para> |
|---|
| 403 | | |
|---|
| 404 | | <para>For non-interactive use, set the following environment |
|---|
| 405 | | variables. <envar>BASEDIR</envar> <envar>SYSUSR</envar> <envar>SOURCE</envar> |
|---|
| 406 | | <envar>EXTENSION</envar> <envar>CRITERIA</envar> If any of the above are not set, |
|---|
| 407 | | the script asks for configuration information interactively. |
|---|
| 408 | | </para> |
|---|
| 409 | | |
|---|
| 410 | | <itemizedlist> |
|---|
| 411 | | <listitem><para> |
|---|
| 412 | | <envar>BASEDIR</envar> where you want the service directory structure for the logrep |
|---|
| 413 | | to be created. This should <emphasis>not</emphasis> be the <filename>/var/service</filename> directory.</para></listitem> |
|---|
| 414 | | <listitem><para><envar>SYSUSR</envar> unix user under which the service should run.</para></listitem> |
|---|
| 415 | | <listitem><para><envar>SOURCE</envar> name of the service with the log you want to follow.</para></listitem> |
|---|
| 416 | | <listitem><para><envar>EXTENSION</envar> a tag to differentiate this logrep from others using the same source.</para></listitem> |
|---|
| 417 | | <listitem><para><envar>CRITERIA</envar> the multilog filter you want to use.</para></listitem> |
|---|
| 418 | | </itemizedlist> |
|---|
| 419 | | |
|---|
| 420 | | <para> A trivial example of this would be to provide a log file of all slon |
|---|
| 421 | | ERROR messages which could be used to trigger a nagios alarm. |
|---|
| 422 | | <command>EXTENSION='ERRORS'</command> |
|---|
| | 437 | <para>Ce script utilise <command>tail -F</command> pour extraire des données des fichiers |
|---|
| | 438 | de logs en vous permettant d'utiliser des filtres multilog (via l'option CRITERIA) afin |
|---|
| | 439 | de créer des fichiers de logs spécifiques. Le but est de fournir un moyen de surveiller |
|---|
| | 440 | les fichiers de logs en temps réel en quête de données <quote>intéressante</quote> |
|---|
| | 441 | sans devoir modifier le fichier de log initial ou gacher des ressources CPU/IO |
|---|
| | 442 | en re-scannant les logs réguliÚrement. |
|---|
| | 443 | </para> |
|---|
| | 444 | |
|---|
| | 445 | <para>Pour une utilisation non interactive, il faut configurer les variable: |
|---|
| | 446 | <envar>BASEDIR</envar> <envar>SYSUSR</envar> <envar>SOURCE</envar> |
|---|
| | 447 | <envar>EXTENSION</envar> <envar>CRITERIA</envar>. Si une seul de ces options n'est |
|---|
| | 448 | pas définie le script demande interactivement les informations de configuration. |
|---|
| | 449 | </para> |
|---|
| | 450 | |
|---|
| | 451 | <itemizedlist> |
|---|
| | 452 | <listitem><para> |
|---|
| | 453 | <envar>BASEDIR</envar> : l'emplacement où sera créée la structure du répertoire du service de logrep. |
|---|
| | 454 | Il ne faut <emphasis>pas</emphasis> que ce soit le répertoire <filename>/var/service</filename>. |
|---|
| | 455 | </para></listitem> |
|---|
| | 456 | <listitem><para><envar>SYSUSR</envar> : l'utilisateur unix qui lancera le service.</para></listitem> |
|---|
| | 457 | <listitem><para><envar>SOURCE</envar> : nom du service de log que vous voulez suivre.</para></listitem> |
|---|
| | 458 | <listitem><para><envar>EXTENSION</envar> : un tag pour différencier ce logrep de ceux qui utilisent la même source.</para></listitem> |
|---|
| | 459 | <listitem><para><envar>CRITERIA</envar> : le filtre multilog que vous voulez utiliser.</para></listitem> |
|---|
| | 460 | </itemizedlist> |
|---|
| | 461 | |
|---|
| | 462 | <para> Un exemple trivial consiste à produire un fichier de log de tous les messages d'erreur |
|---|
| | 463 | slon qui pourrait être utilisé pour déclencher une alerte nagios : |
|---|
| | 464 | <command>EXTENSION='ERRORS'</command> |
|---|