| 8 | | <title>A Task-Oriented View of &slony1;</title> |
|---|
| 9 | | |
|---|
| 10 | | <indexterm><primary>adding objects to replication</primary></indexterm> |
|---|
| 11 | | |
|---|
| 12 | | <para>You may discover that you have missed replicating things that |
|---|
| 13 | | you wish you were replicating.</para> |
|---|
| 14 | | |
|---|
| 15 | | <para>This can generally be fairly easily remedied. This section |
|---|
| 16 | | attempts to provide a <quote>task-oriented</quote> view of how to use |
|---|
| 17 | | &slony1;; in effect, to answer the question <quote>How do I do |
|---|
| 18 | | <emphasis>X</emphasis> with &slony1;?</quote>, for various values of |
|---|
| 19 | | <emphasis>X</emphasis>.</para> |
|---|
| 20 | | |
|---|
| 21 | | <para>You cannot directly use <xref linkend="slonik"/> <xref |
|---|
| 22 | | linkend="stmtsetaddtable"/> or <xref linkend="stmtsetaddsequence"/> in |
|---|
| 23 | | order to add tables and sequences to a replication set that is |
|---|
| 24 | | presently replicating; you must instead create a new replication set. |
|---|
| 25 | | Once it is identically subscribed (e.g. - the set of providers and |
|---|
| 26 | | subscribers is <emphasis>entirely identical</emphasis> to that for the |
|---|
| 27 | | set it is to merge with), the sets may be merged together using <xref |
|---|
| | 8 | <title>Une vue des taches &slony1;</title> |
|---|
| | 9 | |
|---|
| | 10 | <indexterm><primary>ajouter des objets à la réplication</primary></indexterm> |
|---|
| | 11 | |
|---|
| | 12 | <para>Vous découvrirez peut-être que vous avez oubliez des choses que |
|---|
| | 13 | vous vouliez répliquer.</para> |
|---|
| | 14 | |
|---|
| | 15 | <para>En général, on peut trÚs aisément y remédier. Cette section propose |
|---|
| | 16 | une <quote>tour d'horizon</quote> des moyens pour répondre à la |
|---|
| | 17 | question <quote>Comment réaliser la tache <emphasis>X</emphasis> avec &slony1;?</quote>, pour différente valeur de <emphasis>X</emphasis>.</para> |
|---|
| | 18 | |
|---|
| | 19 | <para>On ne peut pas utiliser directement les commandes |
|---|
| | 20 | <xref linkend="slonik"/> <xref linkend="stmtsetaddtable"/> |
|---|
| | 21 | ou <xref linkend="stmtsetaddsequence"/> pour ajouter des |
|---|
| | 22 | tables et des séquences à un ensemble de réplication en |
|---|
| | 23 | cours de fonctionnement; on doit au contraire créer un nouvel |
|---|
| | 24 | ensemble de réplication. Un fois que ce nouvel ensemble est répliqué |
|---|
| | 25 | à l'identique ( c'est à dire les fournisseurs et abonnés sont |
|---|
| | 26 | <emphasis>entiÚrement identiques</emphasis> à ceux de l'ensemble que |
|---|
| | 27 | l'on veut compléter), les deux ensembles peuvent être fusionnés |
|---|
| | 28 | avec la commande <xref |
|---|
| 30 | | <para>Up to and including 1.0.2, there was a potential problem where |
|---|
| 31 | | if <xref linkend="stmtmergeset"/> is issued while other |
|---|
| 32 | | subscription-related events are pending, it is possible for things to |
|---|
| 33 | | get pretty confused on the nodes where other things were pending. |
|---|
| 34 | | This problem was resolved in 1.0.5. Up until 1.2.1, there was still a |
|---|
| 35 | | problem where <xref linkend="stmtmergeset"/> could be requested before |
|---|
| 36 | | all the subscriptions were complete, which would <quote>muss things |
|---|
| 37 | | up</quote> on nodes where subscription activity was still under |
|---|
| 38 | | way. </para> |
|---|
| 39 | | |
|---|
| 40 | | <para> Note that if you add nodes, you will need to add both <xref |
|---|
| 41 | | linkend="stmtstorepath"/> statements to indicate how nodes communicate |
|---|
| 42 | | with one another, and <xref linkend="stmtstorelisten"/> statements to |
|---|
| 43 | | configuration the <quote>communications network</quote> that results |
|---|
| 44 | | from that. See <xref linkend="listenpaths"/> for more details on the |
|---|
| 45 | | latter.</para> |
|---|
| 46 | | |
|---|
| 47 | | <para>It is suggested that you be very deliberate when adding such |
|---|
| 48 | | things. For instance, submitting multiple subscription requests for a |
|---|
| 49 | | particular set in one <xref linkend="slonik"/> script often turns out |
|---|
| 50 | | quite badly. If it is <emphasis>truly</emphasis> necessary to |
|---|
| 51 | | automate this, you'll probably want to |
|---|
| 52 | | submit <xref linkend="stmtwaitevent"/> requests in between subscription |
|---|
| 53 | | requests in order that the <xref linkend="slonik"/> script wait for one |
|---|
| 54 | | subscription to complete processing before requesting the next |
|---|
| 55 | | one.</para> |
|---|
| 56 | | |
|---|
| 57 | | <para>But in general, it is likely to be easier to cope with complex |
|---|
| 58 | | node reconfigurations by making sure that one change has been |
|---|
| 59 | | successfully processed before going on to the next. It's way easier |
|---|
| 60 | | to fix one thing that has broken than to piece things together after |
|---|
| 61 | | the interaction of five things that have all broken.</para> |
|---|
| 62 | | |
|---|
| 63 | | <para> Here are a set of <quote>recipes</quote> for how to do various |
|---|
| 64 | | sorts of modifications to replication configuration:</para> |
|---|
| 65 | | |
|---|
| 66 | | <sect2><title> Adding a table to replication </title> |
|---|
| 67 | | |
|---|
| 68 | | <indexterm><primary> adding a table to replication </primary></indexterm> |
|---|
| 69 | | |
|---|
| 70 | | <para> &slony1; does not allow you to add a table to a replication set |
|---|
| 71 | | that is already being replicated. In principle, it would certainly be |
|---|
| 72 | | <emphasis>possible;</emphasis> what would happen is that the |
|---|
| 73 | | SET_ADD_TABLE event would lead to the relevant code from the |
|---|
| 74 | | SUBSCRIBE_SET event being invoked to initialize the table. That would, |
|---|
| 75 | | regrettably, significantly complicate the logic of all of these |
|---|
| 76 | | components, so this is not permitted. </para> |
|---|
| 77 | | |
|---|
| 78 | | <para>Instead, what you must do is thus:</para> |
|---|
| 79 | | |
|---|
| 80 | | <itemizedlist> |
|---|
| 81 | | <listitem><para> Add the new table on each node. </para> |
|---|
| 82 | | |
|---|
| 83 | | <para> In principle, <xref linkend="stmtddlscript"/> could be used for |
|---|
| 84 | | this, but the fact that this leads to <link linkend="locking"> Locking |
|---|
| 85 | | Issues </link> and requires altering <emphasis>all</emphasis> tables |
|---|
| 86 | | in some existing replication set, on <emphasis>all</emphasis> nodes, |
|---|
| 87 | | makes <xref linkend="stmtddlscript"/> an unattractive approach on a |
|---|
| 88 | | busy system. This breaks the &slony1; feature that you <quote>don't |
|---|
| 89 | | have to interrupt normal activity to introduce replication.</quote> |
|---|
| | 31 | <para>Jusqu'Ã la version 1.0.2 (incluse), il existait des risques |
|---|
| | 32 | potentiels si <xref linkend="stmtmergeset"/> était lancée alors |
|---|
| | 33 | que d'autres événements de type abonnement étaient en attente; |
|---|
| | 34 | des confusions pouvaient se produire sur les noeuds ayant ces |
|---|
| | 35 | événements en attente. |
|---|
| | 36 | |
|---|
| | 37 | Ce problÚme fut résolu avec la version 1.0.5. Jusqu'à la version 1.2.1, |
|---|
| | 38 | il existait toujours un problÚme avec <xref linkend="stmtmergeset"/>, |
|---|
| | 39 | si la commande était lancée avant que tous les abonnements soient complets, |
|---|
| | 40 | des <quote>perturbations</quote> pouvaient apparaitre sur les noeuds |
|---|
| | 41 | où l'activité d'abonnement n'était pas terminée. </para> |
|---|
| | 42 | |
|---|
| | 43 | <para> Notez que si vous ajoutez des noeuds, vous devez également ajouter |
|---|
| | 44 | les déclarations <xref linkend="stmtstorepath"/> pour indiquer comment |
|---|
| | 45 | les noeuds communiquent entre eux, et les déclarations <xref linkend="stmtstorelisten"/> |
|---|
| | 46 | pour configurer le <quote>réseau de communications</quote> correspondant. |
|---|
| | 47 | Voir le chapitre <xref linkend="listenpaths"/> pour plus de détails. |
|---|
| 92 | | <para> Instead, you may add the table via |
|---|
| 93 | | <application>psql</application> on each node. |
|---|
| 94 | | |
|---|
| 95 | | </para> </listitem> |
|---|
| 96 | | |
|---|
| 97 | | <listitem><para> Create a new replication set <xref linkend="stmtcreateset"/> |
|---|
| | 50 | <para>Il est conseillé d'être trÚs prudent lorsque l'on ajoute des noeuds et des |
|---|
| | 51 | voies de communications. Par exemple, soumettre de multiples demandes |
|---|
| | 52 | d'abonnements à un ensemble donné dans un script <xref linkend="slonik"/> |
|---|
| | 53 | finit mal, en général. Si il est <emphasis>vraiment</emphasis> nécessaire |
|---|
| | 54 | d'automatiser cette étape, il est préférable de soumettre des requêtes |
|---|
| | 55 | <xref linkend="stmtwaitevent"/> entre chaque requête d'abonnement pour |
|---|
| | 56 | que le script <xref linkend="slonik"/> attende qu'un abonnement soit |
|---|
| | 57 | complet avant de lancer le suivant..</para> |
|---|
| | 58 | |
|---|
| | 59 | <para>Mais en général, il est plus facile de gérer les reconfigurations |
|---|
| | 60 | complexes en s'assurant qu'un changement a été parfaitement réussi avant |
|---|
| | 61 | de passer au suivant. Il est beaucoup plus simple de corriger un problÚme |
|---|
| | 62 | unique que de réparer les dégats provoqués par l'interaction erronée de cing commandes |
|---|
| | 63 | successives.<</para> |
|---|
| | 64 | |
|---|
| | 65 | <para> Voici un ensemble de <quote>recettes</quote> pour réaliser |
|---|
| | 66 | différentes modifications sur la configuration de la réplication :</para> |
|---|
| | 67 | |
|---|
| | 68 | <sect2><title> Ajouter une table dans le cluster de réplication </title> |
|---|
| | 69 | |
|---|
| | 70 | <indexterm><primary> ajouter une table dans le cluster de réplication </primary></indexterm> |
|---|
| | 71 | |
|---|
| | 72 | <para> &slony1; ne vous permet pas d'ajouter une table dans un ensemblde de |
|---|
| | 73 | qui est déjà en cours de réplication. En principe, c'est certainement |
|---|
| | 74 | <emphasis>possible</emphasis>; mais cela implique l'événement SET_ADD_TABLE |
|---|
| | 75 | produise le code adéquat à partir de l'événement SUBSCRIBE_SET invoqué |
|---|
| | 76 | pour analyser la table. Cela compliquerait de maniÚre significative et regrettable |
|---|
| | 77 | la logique de tous ces composants, donc ce n'est pas permis. </para> |
|---|
| | 78 | |
|---|
| | 79 | <para>En contrepartie, vous devez procéder de la maniÚre suivante :</para> |
|---|
| | 80 | |
|---|
| | 81 | <itemizedlist> |
|---|
| | 82 | <listitem><para> Ajouter la nouvelle table sur chaque noeud. </para> |
|---|
| | 83 | |
|---|
| | 84 | <para> En principe, le script <xref linkend="stmtddlscript"/> peut être |
|---|
| | 85 | utilisé pour cela, mais en réalité ce provoque des <link linkend="locking"> |
|---|
| | 86 | problÚmes d'inter-blocages </link> et cela nécessite la modification de |
|---|
| | 87 | <emphasis>toutes</emphasis> les tables dans l'ensemble de réplication |
|---|
| | 88 | existant, sur <emphasis>tous</emphasis> les noeuds, ce qui fait que |
|---|
| | 89 | <xref linkend="stmtddlscript"/> est une approche peu attrayante sur un |
|---|
| | 90 | serveur chargé. Ceci brise la rÚgle de &slony1; qui dit qu' <quote>il n'est pas |
|---|
| | 91 | nécessaire d'interrompre l'activité normale pour ajouter la réplication.</quote> |
|---|
| | 92 | </para> |
|---|
| | 93 | |
|---|
| | 94 | <para> A contrario, vous pouvez ajouter la table via |
|---|
| | 95 | <application>psql</application> sur chaque noeud. |
|---|
| | 96 | |
|---|
| | 97 | <n/para> </listitem> |
|---|
| | 98 | |
|---|
| | 99 | <listitem><para> Créer un nouvel ensemble de réplication avec <xref linkend="stmtcreateset"/> |
|---|
| 100 | | Add the table to the new set <xref linkend="stmtsetaddtable"/> |
|---|
| 101 | | </para></listitem> |
|---|
| 102 | | |
|---|
| 103 | | <listitem><para> Request subscription <xref |
|---|
| 104 | | linkend="stmtsubscribeset"/> for this new set. If there are several |
|---|
| 105 | | nodes, you will need to <xref linkend="stmtsubscribeset"/> once for |
|---|
| 106 | | each node that should subscribe. </para></listitem> |
|---|
| 107 | | |
|---|
| 108 | | <listitem><para> If you wish to know, deterministically, that each |
|---|
| 109 | | subscription has completed, you'll need to submit the following sort |
|---|
| 110 | | of slonik script for each subscription: |
|---|
| | 102 | Ajouter la table dans le nouvel ensemble avec <xref linkend="stmtsetaddtable"/> |
|---|
| | 103 | </para></listitem> |
|---|
| | 104 | |
|---|
| | 105 | <listitem><para> Demander l'abonnement de ce nouvel ensemble avec <xref |
|---|
| | 106 | linkend="stmtsubscribeset"/>. Si il existe plusieurs noeuds, vous devez |
|---|
| | 107 | utiliser <xref linkend="stmtsubscribeset"/> une fois pour chaque noeud |
|---|
| | 108 | que vous voulez abonner. </para></listitem> |
|---|
| | 109 | |
|---|
| | 110 | <listitem><para> Si vous voulez savoir de maniÚre déterministe, si |
|---|
| | 111 | un abonnement est complet, vous devez soumettre pour chaque abonnement |
|---|
| | 112 | un script slonik qui ressemble à cela : |
|---|
| 127 | | <sect2><title> How to add columns to a replicated table </title> |
|---|
| 128 | | |
|---|
| 129 | | <indexterm><primary> adding columns to a replicated table </primary></indexterm> |
|---|
| 130 | | |
|---|
| 131 | | <para> This also answers the question <quote>How do I rename columns |
|---|
| 132 | | on a replicated table?</quote>, and, more generally, other questions |
|---|
| 133 | | to the effect of <quote>How do I modify the definitions of replicated |
|---|
| 134 | | tables?</quote></para> |
|---|
| 135 | | |
|---|
| 136 | | <para>If you change the <quote>shape</quote> of a replicated table, |
|---|
| 137 | | this needs to take place at exactly the same point in all of the |
|---|
| 138 | | <quote>transaction streams</quote> on all nodes that are subscribed to |
|---|
| 139 | | the set containing the table.</para> |
|---|
| 140 | | |
|---|
| 141 | | <para> Thus, the way to do this is to construct an SQL script |
|---|
| 142 | | consisting of the DDL changes, and then submit that script to all of |
|---|
| 143 | | the nodes via the Slonik command <xref |
|---|
| 144 | | linkend="stmtddlscript"/>.</para> |
|---|
| 145 | | |
|---|
| 146 | | <para> Alternatively, if you have the <link linkend="altperl"> altperl |
|---|
| 147 | | scripts </link> installed, you may use |
|---|
| 148 | | <command>slonik_execute_script</command> for this purpose: </para> |
|---|
| 149 | | |
|---|
| 150 | | <para> <command> slonik_execute_script [options] set# |
|---|
| | 130 | <sect2><title> Comment ajouter une colonne dans une table répliquée </title> |
|---|
| | 131 | |
|---|
| | 132 | <indexterm><primary> ajouter des colonnes dans une table </primary></indexterm> |
|---|
| | 133 | |
|---|
| | 134 | <para> Cette réponse est la même que pour la question <quote>Comment |
|---|
| | 135 | renommer des colonnes dans une table répliquée ?</quote>, et plus généralement |
|---|
| | 136 | au autres questions du type <quote>Comment modifier la définition |
|---|
| | 137 | de tables répliquées ?</quote></para> |
|---|
| | 138 | |
|---|
| | 139 | <para>Si vous changez la <quote>shape</quote> d'une table répliquée, vous devez le |
|---|
| | 140 | faire au même instant dans le <quote>flux de transaction</quote> sur tous les noeuds |
|---|
| | 141 | qui sont abonnés à l'ensemble qui contient la table.</para> |
|---|
| | 142 | |
|---|
| | 143 | <para> Ainsi, la méthode pour consiste à construire un script SQL |
|---|
| | 144 | composé des changements DDL et de le soumettre à tous les noeuds |
|---|
| | 145 | via la commande Slonik <xref linkend="stmtddlscript"/>.</para> |
|---|
| | 146 | |
|---|
| | 147 | <para> Il existe une alternative, si vous avec installé les <link linkend="altperl"> |
|---|
| | 148 | scripts altperl</link>, vous pouvez utiliser <command>slonik_execute_script</command> |
|---|
| | 149 | pour cela : </para> |
|---|
| | 150 | |
|---|
| | 151 | <para> <command> slonik_execute_script [options] numero_de_l_ensemble |
|---|
| 153 | | <para> See <command>slonik_execute_script -h</command> for further |
|---|
| 154 | | options; note that this uses <xref linkend="stmtddlscript"/> |
|---|
| 155 | | underneath. </para> |
|---|
| 156 | | |
|---|
| 157 | | <para> There are a number of <quote>sharp edges</quote> to note...</para> |
|---|
| 158 | | |
|---|
| 159 | | <itemizedlist> |
|---|
| 160 | | <listitem><para> You absolutely <emphasis>must not</emphasis> include |
|---|
| 161 | | transaction control commands, particularly <command>BEGIN</command> |
|---|
| 162 | | and <command>COMMIT</command>, inside these DDL scripts. &slony1; |
|---|
| 163 | | wraps DDL scripts with a <command>BEGIN</command>/<command>COMMIT</command> |
|---|
| 164 | | pair; adding extra transaction control will mean that parts of the DDL |
|---|
| 165 | | will commit outside the control of &slony1; </para></listitem> |
|---|
| 166 | | |
|---|
| 167 | | <listitem><para> Before version 1.2, it was necessary to be |
|---|
| 168 | | exceedingly restrictive about what you tried to process using |
|---|
| | 154 | <para> Tapez la commande <command>slonik_execute_script -h</command> pour |
|---|
| | 155 | plus d'information; notez que ce script utilise <xref linkend="stmtddlscript"/>. |
|---|
| | 156 | </para> |
|---|
| | 157 | |
|---|
| | 158 | <para> Il y a de nombreux <quote>points délicats</quote> à noter...</para> |
|---|
| | 159 | |
|---|
| | 160 | <itemizedlist> |
|---|
| | 161 | <listitem><para> Vous <emphasis>ne devez absolument jamais</emphasis> inclure |
|---|
| | 162 | des commandes de controle de transaction, notamment <command>BEGIN</command> |
|---|
| | 163 | et <command>COMMIT</command>, à l'intérieur de ces scripts. &slony1; |
|---|
| | 164 | encapsule les scripts DDL avec une paire <command>BEGIN</command>/<command>COMMIT</command> |
|---|
| | 165 | ; ajouter de opérateur de controle de transaction supplémentaire |
|---|
| | 166 | implique que des parties des ordres DDL seront <quote>committés</quote> |
|---|
| | 167 | en dehors du controle de &slony1; </para></listitem> |
|---|
| | 168 | |
|---|
| | 169 | <listitem><para> Avant la version 1.2, il était nécessaire d'être |
|---|
| | 170 | extrêmement restrictif sur ce qu'on envoyait au script |
|---|
| 171 | | <para> You could not have anything <command>'quoted'</command> in the |
|---|
| 172 | | script, as this would not be stored and forwarded properly. As of |
|---|
| 173 | | 1.2, quoting is now handled properly. </para> |
|---|
| 174 | | |
|---|
| 175 | | <para> If you submitted a series of DDL statements, the later ones |
|---|
| 176 | | could not make reference to objects created in the earlier ones, as |
|---|
| 177 | | the entire set of statements was submitted as a single query, where |
|---|
| 178 | | the query plan was based on the state of the database at |
|---|
| 179 | | the <emphasis>beginning,</emphasis> before any modifications had been |
|---|
| 180 | | made. As of 1.2, if there are 12 SQL statements, they are each |
|---|
| 181 | | submitted individually, so that <command> alter table x add column c1 |
|---|
| 182 | | integer; </command> may now be followed by <command> alter table x |
|---|
| | 173 | <para> Il était interdit de placer du texte <command>'entre quotes'</command> |
|---|
| | 174 | dans le script, car cela l'empéchait d'être stocké et transmis correctement |
|---|
| | 175 | . A partir de la version 1.2, les quotes sont correctement prises en compte. </para> |
|---|
| | 176 | |
|---|
| | 177 | <para> Si vous soumettez une séries d'order DDL, les derniers |
|---|
| | 178 | ne peuvent pas faire référence aux objets créés par les premiers, |
|---|
| | 179 | car tous les ordres sont soumis dans un requête unique, |
|---|
| | 180 | dont le plan d'execution est basé sur l'état de la base de donnée |
|---|
| | 181 | au <emphasis>début</emphasis>, avant que les modifications ne soient |
|---|
| | 182 | effectuées. à partir de la version 1.2, il y a 12 ordres SQL, chacun est soumis |
|---|
| | 183 | individuellement, ainsi la commande <command> alter table x add column c1 |
|---|
| | 184 | integer; </command> peut désormais être suivie par <command> alter table x |
|---|
| 188 | | <sect2><title> How to remove replication for a node</title> |
|---|
| 189 | | |
|---|
| 190 | | <para> You will want to remove the various &slony1; components |
|---|
| 191 | | connected to the database(s).</para> |
|---|
| 192 | | |
|---|
| 193 | | <para> We will just consider, for now, doing this to one node. If you |
|---|
| 194 | | have multiple nodes, you will have to repeat this as many times as |
|---|
| 195 | | necessary.</para> |
|---|
| 196 | | |
|---|
| 197 | | <para> Components to be Removed: </para> |
|---|
| 198 | | <itemizedlist> |
|---|
| 199 | | |
|---|
| 200 | | <listitem><para> Log Triggers / Update Denial Triggers |
|---|
| 201 | | |
|---|
| 202 | | </para></listitem> |
|---|
| 203 | | <listitem><para> The <quote>cluster</quote> schema containing &slony1; |
|---|
| 204 | | tables indicating the state of the node as well as various stored |
|---|
| 205 | | functions |
|---|
| 206 | | </para></listitem> |
|---|
| 207 | | <listitem><para> &lslon; process that manages the node </para></listitem> |
|---|
| 208 | | <listitem><para> Optionally, the SQL and pl/pgsql scripts and &slony1; |
|---|
| 209 | | binaries that are part of the &postgres; build. (Of course, this would |
|---|
| 210 | | make it challenging to restart replication; it is unlikely that you |
|---|
| 211 | | truly need to do this...) |
|---|
| 212 | | </para></listitem> |
|---|
| 213 | | </itemizedlist> |
|---|
| 214 | | |
|---|
| 215 | | <para> How To Conveniently Handle Removal</para> |
|---|
| 216 | | <itemizedlist> |
|---|
| 217 | | |
|---|
| 218 | | <listitem><para> You may use the Slonik <xref linkend="stmtdropnode"/> |
|---|
| 219 | | command to remove the node from the cluster. This will lead to the |
|---|
| 220 | | triggers and everything in the cluster schema being dropped from the |
|---|
| 221 | | node. The <xref linkend="slon"/> process will automatically die |
|---|
| 222 | | off.</para></listitem> |
|---|
| 223 | | |
|---|
| 224 | | <listitem><para> In the case of a failed node (where you |
|---|
| 225 | | used <xref linkend="stmtfailover"/> to switch to another node), you may |
|---|
| 226 | | need to use <xref linkend="stmtuninstallnode"/> to drop out the |
|---|
| 227 | | triggers and schema and functions.</para> |
|---|
| 228 | | |
|---|
| 229 | | <para> If the node failed due to some dramatic hardware failure |
|---|
| 230 | | (<emphasis>e.g.</emphasis> disk drives caught fire), there may not be |
|---|
| 231 | | a database left on the failed node; it would only be expected to |
|---|
| 232 | | survive if the failure was one involving a network failure where |
|---|
| 233 | | the <emphasis>database</emphasis> was fine, but you were forced to |
|---|
| 234 | | drop it from replication due to (say) some persistent network outage. |
|---|
| 235 | | </para></listitem> |
|---|
| 236 | | |
|---|
| 237 | | <listitem><para> If the above things work out particularly badly, you |
|---|
| 238 | | could submit the SQL command <command>DROP SCHEMA "_ClusterName" |
|---|
| 239 | | CASCADE;</command>, which will drop out &slony1; functions, tables, |
|---|
| 240 | | and triggers alike. That is generally less suitable |
|---|
| 241 | | than <xref linkend="stmtuninstallnode"/>, because that command not only |
|---|
| 242 | | drops the schema and its contents, but also removes any columns |
|---|
| 243 | | previously added in using <xref linkend= "stmttableaddkey"/>. |
|---|
| | 190 | <sect2><title> Comment supprimer la réplication sur un noeud</title> |
|---|
| | 191 | |
|---|
| | 192 | <para> Vous devez supprimer les différents composants &slony1; |
|---|
| | 193 | connectés à la base.</para> |
|---|
| | 194 | |
|---|
| | 195 | <para> Considérons, un instant, que nous faisons cela pour un noeud. |
|---|
| | 196 | Si vous avez de multiples noeuds, vous devrez répéter ces étapes |
|---|
| | 197 | autant de fois que nécessaire.</para> |
|---|
| | 198 | |
|---|
| | 199 | <para> Les composants à retirer : </para> |
|---|
| | 200 | <itemizedlist> |
|---|
| | 201 | |
|---|
| | 202 | <listitem><para>Triggers de logs / Triggers de blocage de mises à jour |
|---|
| | 203 | |
|---|
| | 204 | </para></listitem> |
|---|
| | 205 | <listitem><para> Le schéma <quote>cluster</quote> contenant les tables &slony1; |
|---|
| | 206 | qui indiquent l'état du noeud et diverses procédures stockées |
|---|
| | 207 | </para></listitem> |
|---|
| | 208 | <listitem><para> Le processus &lslon; qui gÚre le noeud </para></listitem> |
|---|
| | 209 | <listitem><para> Accessoirement, les scripts SQL, les scripts pl/pgsql, |
|---|
| | 210 | et les binaires &slony1; qui font partie de la compilation de &postgres;. |
|---|
| | 211 | (Bien sûr, cela complique la tache si vous souhaitez redémarrer la réplication; |
|---|
| | 212 | il est peu probable que vous ayez besoin de supprimer ces fichiers...) |
|---|
| | 213 | </para></listitem> |
|---|
| | 214 | </itemizedlist> |
|---|
| | 215 | |
|---|
| | 216 | <para> Comment effectuer facilement la suppression</para> |
|---|
| | 217 | <itemizedlist> |
|---|
| | 218 | |
|---|
| | 219 | <listitem><para> Vous pouvez utiliser la commande Slonik <xref linkend="stmtdropnode"/> |
|---|
| | 220 | pour supprimer un noeud du cluster. Ceci provoquera la suppression |
|---|
| | 221 | des triggers et tout ce qui se trouve dans schéma cluster. |
|---|
| | 222 | Le processus <xref linkend="slon"/> sera automatiquement mourrir.</para></listitem> |
|---|
| | 223 | |
|---|
| | 224 | <listitem><para> Dans le cas d'un noeud en échec ( lorsque vous avez utilisé |
|---|
| | 225 | la commande <xref linkend="stmtfailover"/> pour basculer sur un autre noeud |
|---|
| | 226 | ), vous devrez peut-être utiliser <xref linkend="stmtuninstallnode"/> |
|---|
| | 227 | pour supprimer les triggers, le schéma et les fonctions.</para> |
|---|
| | 228 | |
|---|
| | 229 | <para> Si le noeud est en échec à cause d'une panne matérielle dramatique |
|---|
| | 230 | (<emphasis>par exemple</emphasis> si vos disques ont pris feu), |
|---|
| | 231 | il est possible qu'il n'y ait plus de traces de la base de données sur le noeud; |
|---|
| | 232 | En général, la base ne survive que lorsque la panne matérielle est un |
|---|
| | 233 | problÚme de réseau qui n'endommage pas les données mais qui vous oblige à |
|---|
| | 234 | supprimer le noeud à cause de coupures réseau persitantes. |
|---|
| | 235 | </para></listitem> |
|---|
| | 236 | |
|---|
| | 237 | <listitem><para> Si les opérations ci-dessus se sont particuliÚrement |
|---|
| | 238 | mal passée. vous pouvez lancer la commande SQL |
|---|
| | 239 | <command>DROP SCHEMA "Nom_du_cluster" CASCADE;</command>, |
|---|
| | 240 | qui supprime toutes les fonctions, les tables et les triggers de |
|---|
| | 241 | &slony1;. En général, c'est une opération moins pratique que |
|---|
| | 242 | <xref linkend="stmtuninstallnode"/>, car cette commande |
|---|
| | 243 | ne se contente pas de supprimer le schéma et son contenu, elle |
|---|
| | 244 | supprime également toutes les colonnes ajoutées avec la |
|---|
| | 245 | commande <xref linkend= "stmttableaddkey"/>. |
|---|
| 254 | | <sect2><title> Adding A Node To Replication</title> |
|---|
| 255 | | |
|---|
| 256 | | <para>Things are not fundamentally different whether you are adding a |
|---|
| 257 | | brand new, fresh node, or if you had previously dropped a node and are |
|---|
| 258 | | recreating it. In either case, you are adding a node to |
|---|
| 259 | | replication. </para> |
|---|
| 260 | | |
|---|
| 261 | | <para>The needful steps are thus... </para> |
|---|
| 262 | | <itemizedlist> |
|---|
| 263 | | |
|---|
| 264 | | <listitem><para> Determine the node number and any relevant DSNs for |
|---|
| 265 | | the new node. Use &postgres; command <command>createdb</command> to |
|---|
| 266 | | create the database; add the table definitions for the tables that are |
|---|
| 267 | | to be replicated, as &slony1; does not automatically propagate that |
|---|
| 268 | | information. |
|---|
| | 256 | <sect2><title> Ajouter un noeud dans le cluster de réplication</title> |
|---|
| | 257 | |
|---|
| | 258 | <para>Les choses ne sont pas fondamentalement différentes entre l'ajout |
|---|
| | 259 | d'un noeud flambant neuf et la restauration d'un noeud qu'on supprimé, puis reconstruit |
|---|
| | 260 | . Dans les deux cas, vous ajouter un noeud dans le cluster de réplication. |
|---|
| | 261 | </para> |
|---|
| | 262 | |
|---|
| | 263 | <para>Les étapes nécessaires sont ... </para> |
|---|
| | 264 | <itemizedlist> |
|---|
| | 265 | |
|---|
| | 266 | <listitem><para> Déterminer le numéro du noeud et les DSNs adéquates |
|---|
| | 267 | pour le noeuds. Utilisez la commande &postgres; <command>createdb</command> |
|---|
| | 268 | pour créer la base; ajoutez les définitions des tables que vous voulez |
|---|
| | 269 | répliquer, car &slony1; ne propage pas automatiquement cette information. |
|---|
| 278 | | <listitem><para> If the node had been a failed node, you may need to |
|---|
| 279 | | issue the <xref linkend="slonik"/> |
|---|
| 280 | | command <xref linkend="stmtdropnode"/> in order to get rid of its |
|---|
| 281 | | vestiges in the cluster, and to drop out the schema that &slony1; |
|---|
| 282 | | creates. |
|---|
| 283 | | </para></listitem> |
|---|
| 284 | | |
|---|
| 285 | | <listitem><para> Issue the slonik |
|---|
| 286 | | command <xref linkend="stmtstorenode"/> to establish the new node. |
|---|
| 287 | | </para></listitem> |
|---|
| 288 | | |
|---|
| 289 | | <listitem><para> At this point, you may start a &lslon; daemon against |
|---|
| 290 | | the new node. It may not know much about the other nodes yet, so the |
|---|
| 291 | | logs for this node may be pretty quiet. |
|---|
| 292 | | </para></listitem> |
|---|
| 293 | | |
|---|
| 294 | | <listitem><para> Issue the slonik |
|---|
| 295 | | command <xref linkend="stmtstorepath"/> to indicate |
|---|
| 296 | | how <xref linkend="slon"/> processes are to communicate with the new |
|---|
| 297 | | node. In &slony1; version 1.1 and later, this will then automatically |
|---|
| 298 | | generate <link linkend="listenpaths"> listen path </link> entries; in |
|---|
| 299 | | earlier versions, you will need to |
|---|
| 300 | | use <xref linkend="stmtstorelisten"/> to generate them manually. |
|---|
| 301 | | </para></listitem> |
|---|
| 302 | | |
|---|
| 303 | | <listitem><para> At this point, it is an excellent idea to run |
|---|
| 304 | | the <filename>tools</filename> |
|---|
| 305 | | script <command>test_slony_state-dbi.pl</command>, which rummages |
|---|
| | 279 | <listitem><para> Si le noeud était un noeud en échec, vous devez lancer |
|---|
| | 280 | la commande <xref linkend="slonik"/> <xref linkend="stmtdropnode"/> |
|---|
| | 281 | afin de vous débarasser de ses vestiges dans le cluster et de supprimer |
|---|
| | 282 | le schéma que &slony1; a créé. |
|---|
| | 283 | </para></listitem> |
|---|
| | 284 | |
|---|
| | 285 | <listitem><para> Lancer la commande slonik <xref linkend="stmtstorenode"/> |
|---|
| | 286 | pour établir le nouveau noeud. |
|---|
| | 287 | </para></listitem> |
|---|
| | 288 | |
|---|
| | 289 | <listitem><para> à cet instant, vous pouvez lancer le démon &lslon; sur le nouveau |
|---|
| | 290 | noeud. Il ne connaitra rien des autres noeuds, donc les logs de ce noeud seront |
|---|
| | 291 | particuliÚrement calmes. |
|---|
| | 292 | </para></listitem> |
|---|
| | 293 | |
|---|
| | 294 | <listitem><para> Lancer la commande slonik <xref linkend="stmtstorepath"/> |
|---|
| | 295 | pour indiquer comment les processus <xref linkend="slon"/> doivent |
|---|
| | 296 | communiquer avec le nouveau noeud. |
|---|
| | 297 | Dans la version 1.1 et suivante, cette commande génÚre automatiquement |
|---|
| | 298 | des lignes de la table des <link linkend="listenpaths">voies d'écoute</link>; |
|---|
| | 299 | Dans les versions précédentes vous devez utiliser <xref linkend="stmtstorelisten"/> |
|---|
| | 300 | pour les générer manuellement. |
|---|
| | 301 | </para></listitem> |
|---|
| | 302 | |
|---|
| | 303 | <listitem><para> A cet instant, lancer le script |
|---|
| | 304 | <command>test_slony_state-dbi.pl</command> est une excellente idée, which rummages |
|---|