{"id":215,"date":"2017-07-01T14:55:41","date_gmt":"2017-07-01T14:55:41","guid":{"rendered":"http:\/\/renaudguezennec.eu\/?p=215"},"modified":"2025-08-17T20:11:32","modified_gmt":"2025-08-17T20:11:32","slug":"mettre-jour-postgresql-sur-debian-stretch","status":"publish","type":"post","link":"http:\/\/renaudguezennec.eu\/index.php\/2017\/07\/01\/mettre-jour-postgresql-sur-debian-stretch\/","title":{"rendered":"Mettre \u00e0 jour Postgresql sur debian Stretch"},"content":{"rendered":"<p>Stretch<\/p>\n<p>Nous allons voir comment mettre \u00e0 jour votre base de donn\u00e9es postgresql apr\u00e8s l\u2019update de Jessie \u00e0 Stretch.<br \/>\nLa version de jessie \u00e9tait 9.4. La version pour Stretch est 9.6.<\/p>\n<p>Les commandes suivantes sont ex\u00e9cut\u00e9es en root. Vous pouvez bien s\u00fbr utiliser sudo.<\/p>\n<h2>Lister les clusters postgresql install\u00e9s sur votre machine:<\/h2>\n<p><code># pg_lsclusters<\/code><\/p>\n<p>Si votre installation de postgresql date de Jessie vous aurez un truc comme cela.<br \/>\n<code><br \/>\n<\/code><\/p>\n<p>[pastacode lang=&#8221;bash&#8221; manual=&#8221;Ver%20Cluster%20Port%20Status%20Owner%20Data%20directory%20Log%20file%0A9.4%20main%20%20%20%205432%20online%20postgres%20%2Fvar%2Flib%2Fpostgresql%2F9.4%2Fmain%20%2Fvar%2Flog%2Fpostgresql%2Fpostgresql-9.4-main.log%0A9.6%20main%20%20%20%205433%20online%20postgres%20%2Fvar%2Flib%2Fpostgresql%2F9.6%2Fmain%20%2Fvar%2Flog%2Fpostgresql%2Fpostgresql-9.6-main.log&#8221; message=&#8221;&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]<\/p>\n<p>&nbsp;<\/p>\n<p>Si vous n\u2019avez pas fait la mise \u00e0 jour de votre cluster apr\u00e8s la mise \u00e0 jour de wheezy vers jessie. Vous devriez voir un truc dans ce style la.<\/p>\n<p>[pastacode lang=&#8221;bash&#8221; manual=&#8221;Ver%20Cluster%20Port%20Status%20Owner%20Data%20directory%20Log%20file%0A9.1%20main%20%20%20%205432%20online%20postgres%20%2Fvar%2Flib%2Fpostgresql%2F9.1%2Fmain%20%2Fvar%2Flog%2Fpostgresql%2Fpostgresql-9.1-main.log%0A9.4%20main%20%20%20%205433%20online%20postgres%20%2Fvar%2Flib%2Fpostgresql%2F9.4%2Fmain%20%2Fvar%2Flog%2Fpostgresql%2Fpostgresql-9.4-main.log%0A9.6%20main%20%20%20%205434%20online%20postgres%20%2Fvar%2Flib%2Fpostgresql%2F9.6%2Fmain%20%2Fvar%2Flog%2Fpostgresql%2Fpostgresql-9.6-main.log&#8221; message=&#8221;&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]<\/p>\n<p>Le port par d\u00e9faut de postgresql est le <strong>5432<\/strong>.\u00a0 Le cluster ayant 5432 comme port est votre cluster courant.<\/p>\n<p>Normalement Debian installe la nouvelle version de postgresql \u00e0 la mise \u00e0 jour de version et il cr\u00e9e un nouveau cluster dans la foul\u00e9e.<br \/>\nSi ce n\u2019est pas le cas, vous pouvez l\u2019installer par cette ligne:<\/p>\n<p><code># apt-get install postgresql-9.6<\/code><\/p>\n<h2>Supprimer le cluster postgresql 9.6 cr\u00e9\u00e9<\/h2>\n<p>Installer une nouvelle version de postgresql sur debian cr\u00e9e un cluster principal (main) qui emp\u00eache la commande <strong>pg_upgradecluster<\/strong> de fonctionner.<\/p>\n<p>Il faut donc supprimer cette instance dans le but d\u2019obtenir une base de donn\u00e9es propre.<br \/>\nFaite tr\u00e8s attention, ne vous tromper pas dans la commande.<br \/>\nNe supprimer surtout pas votre vieille base de donn\u00e9es. C\u2019est elle qui contient toutes vos donn\u00e9es. \ud83d\ude42<\/p>\n<p>Nous d\u00e9truisons la nouvelle; la vide.<\/p>\n<p><code># pg_dropcluster --stop 9.6 main<\/code><\/p>\n<h2>Mettre \u00e0 jour la vieille base vers le nouveau format<\/h2>\n<p>La syntaxe est la suivante:<\/p>\n<p><code># pg_upgradecluster -v NouvelleVersion AncienneVersion main<\/code><\/p>\n<p>La fonction va cr\u00e9er un nouvelle base main dans le format <strong>NouvelleVersion<\/strong>.<br \/>\nPour ensuite, copier les donn\u00e9es de <strong>AncienneVersion<\/strong> vers <strong>NouvelleVersion<\/strong>.<br \/>\nCela prendra un peu de temps.<\/p>\n<p>[pastacode lang=&#8221;bash&#8221; manual=&#8221;%23%20pg_upgradecluster%20-v%209.6%209.4%20main%0AStopping%20old%20cluster&#8230;%0ANotice%3A%20extra%20pg_ctl%2Fpostgres%20options%20given%2C%20bypassing%20systemctl%20for%20stop%20operation%0ADisabling%20connections%20to%20the%20old%20cluster%20during%20upgrade&#8230;%0ARestarting%20old%20cluster%20with%20restricted%20connections&#8230;%0ARedirecting%20start%20request%20to%20systemctl%0ACreating%20new%20cluster%209.6%2Fmain%20&#8230;%0Aconfig%20%2Fetc%2Fpostgresql%2F9.6%2Fmain%0Adata%20%2Fvar%2Flib%2Fpostgresql%2F9.6%2Fmain%0Alocale%20en_US.UTF-8%0Asocket%20%2Fvar%2Frun%2Fpostgresql%0Aport%205434%0ADisabling%20connections%20to%20the%20new%20cluster%20during%20upgrade&#8230;%0ARedirecting%20start%20request%20to%20systemctl%0ARoles%2C%20databases%2C%20schemas%2C%20ACLs&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20pbf&#8230;%0AAnalyzing%20database%20pbf&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20template1&#8230;%0AAnalyzing%20database%20template1&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20livres&#8230;%0AAnalyzing%20database%20livres&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20cmdline&#8230;%0AAnalyzing%20database%20cmdline&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20systemtest&#8230;%0AAnalyzing%20database%20systemtest&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20creatures&#8230;%0AAnalyzing%20database%20creatures&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20articles&#8230;%0AAnalyzing%20database%20articles&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20postgres&#8230;%0AAnalyzing%20database%20postgres&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20campagnes&#8230;%0AAnalyzing%20database%20campagnes&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20animations&#8230;%0AAnalyzing%20database%20animations&#8230;%0AFixing%20hardcoded%20library%20paths%20for%20stored%20procedures&#8230;%0AUpgrading%20database%20asso_member&#8230;%0AAnalyzing%20database%20asso_member&#8230;%0ARe-enabling%20connections%20to%20the%20old%20cluster&#8230;%0ARe-enabling%20connections%20to%20the%20new%20cluster&#8230;%0ACopying%20old%20configuration%20files&#8230;%0ACopying%20old%20start.conf&#8230;%0ACopying%20old%20pg_ctl.conf&#8230;%0ACopying%20old%20server.crt&#8230;%0ACopying%20old%20server.key&#8230;%0AStopping%20target%20cluster&#8230;%0ARedirecting%20stop%20request%20to%20systemctl%0AStopping%20old%20cluster&#8230;%0ARedirecting%20stop%20request%20to%20systemctl%0ADisabling%20automatic%20startup%20of%20old%20cluster&#8230;%0AConfiguring%20old%20cluster%20to%20use%20a%20different%20port%20(5434)&#8230;%0AStarting%20target%20cluster%20on%20the%20original%20port&#8230;%0ARedirecting%20start%20request%20to%20systemctl%0ASuccess.%20Please%20check%20that%20the%20upgraded%20cluster%20works.%20If%20it%20does%2C%0Ayou%20can%20remove%20the%20old%20cluster%20with%0A%0Apg_dropcluster%209.4%20main&#8221; message=&#8221;&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]<\/p>\n<h2>Supprimer l\u2019ancienne version<\/h2>\n<p>Si la copie s\u2019est bien pass\u00e9e. Vous pouvez supprimer l\u2019ancienne version. Elle est maintenant enti\u00e8rement copi\u00e9 dans le cluster main 9.6.<\/p>\n<p><code># pg_dropcluster 9.4 main<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Stretch Nous allons voir comment mettre \u00e0 jour votre base de donn\u00e9es postgresql apr\u00e8s l\u2019update de Jessie \u00e0 Stretch. La version de jessie \u00e9tait 9.4. La version pour Stretch est 9.6. Les commandes suivantes sont ex\u00e9cut\u00e9es en root. Vous pouvez bien s\u00fbr utiliser sudo. Lister les clusters postgresql install\u00e9s sur votre machine: # pg_lsclusters Si [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":217,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[31,80],"tags":[57,55,56],"class_list":["post-215","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","category-fr","tag-debian","tag-postgresql","tag-update"],"_links":{"self":[{"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":4,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"predecessor-version":[{"id":220,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/posts\/215\/revisions\/220"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/media\/217"}],"wp:attachment":[{"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/renaudguezennec.eu\/index.php\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}