{"id":17187,"date":"2022-05-02T16:10:49","date_gmt":"2022-05-02T14:10:49","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/"},"modified":"2024-09-10T17:28:14","modified_gmt":"2024-09-10T15:28:14","slug":"how-to-upgrade-patroni","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/","title":{"rendered":"How to upgrade Patroni"},"content":{"rendered":"<p>It&#8217;s been a while since I wrote the blog post about <a href=\"https:\/\/www.dbi-services.com\/blog\/postgresql-13-and-patroni-2-0-when-parameters-change\/\" target=\"\u201d_blank\u201d\" rel=\"noopener\"> PostgreSQL 13 and Patroni 2.0<\/a>. On this blog I received a comment, if it&#8217;s possible to explain, how to upgrade from Patroni 1.6 to 2. So let&#8217;s make a short blog about the upgrade procedure of Patroni. <!--more--><\/p>\n<p>For my initial installation is used python pip, not the rpm packages. But the upgrade with pip is also really simple and straight forward. There is no need to stop Patroni. But as usual, be sure you have a backup of you database or a snapshot of your server, if applicable.<\/p>\n<p>In first step, let&#8217;s check the current version of Patroni and upgrade pip itself and the setuptools to be sure to have it on the newest version as well.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@patroni1:\/u02\/pgdata\/ [PG1] patronictl version\npatronictl version 1.6.4\npostgres@patroni1:\/u02\/pgdata\/ [PG1] python3 -m pip install --upgrade pip\nDefaulting to user installation because normal site-packages is not writeable\nCollecting pip\n  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 1.7 MB 2.0 MB\/s\nInstalling collected packages: pip\nSuccessfully installed pip-21.3.1\npostgres@patroni1:\/u02\/pgdata\/ [PG1] python3 -m pip install --upgrade --user setuptools\nRequirement already satisfied: setuptools in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (45.2.0)\nCollecting setuptools\n  Downloading setuptools-59.6.0-py3-none-any.whl (952 kB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 952 kB 1.6 MB\/s\nInstalling collected packages: setuptools\n  Attempting uninstall: setuptools\n    Found existing installation: setuptools 45.2.0\n    Uninstalling setuptools-45.2.0:\n      Successfully uninstalled setuptools-45.2.0\nSuccessfully installed setuptools-59.6.0\npostgres@patroni3:\/u01\/app\/postgres\/product\/ [PG1]\n<\/pre>\n<p>Afterwards we upgrade Patroni itself. Which is also done using python pip with &#8211;upgrade option.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@patroni1:\/u02\/pgdata\/ [PG1]  python3 -m pip install --upgrade  --user patroni[etcd]\nRequirement already satisfied: patroni[etcd] in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (1.6.4)\nCollecting patroni[etcd]\n  Downloading patroni-2.1.3-py3-none-any.whl (222 kB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 222 kB 1.6 MB\/s\nRequirement already satisfied: psutil&gt;=2.0.0 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (5.7.0)\nRequirement already satisfied: six&gt;=1.7 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (1.14.0)\nRequirement already satisfied: urllib3!=1.21,&gt;=1.19.1 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (1.25.8)\nCollecting ydiff&gt;=1.2.0\n  Downloading ydiff-1.2.tar.gz (42 kB)\n     |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 42 kB 2.1 MB\/s\n  Preparing metadata (setup.py) ... done\nRequirement already satisfied: click&gt;=4.1 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (7.0)\nRequirement already satisfied: PyYAML in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (5.3)\nRequirement already satisfied: prettytable&gt;=0.7 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (0.7.2)\nRequirement already satisfied: python-dateutil in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (2.8.1)\nRequirement already satisfied: python-etcd=0.4.3 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from patroni[etcd]) (0.4.5)\nRequirement already satisfied: dnspython&gt;=1.13.0 in \/home\/postgres\/.local\/lib\/python3.6\/site-packages (from python-etcd=0.4.3-&gt;patroni[etcd])                                                                                                                                                            (1.16.0)\nUsing legacy 'setup.py install' for ydiff, since package 'wheel' is not installed.\nInstalling collected packages: ydiff, patroni\n    Running setup.py install for ydiff ... done\n  Attempting uninstall: patroni\n    Found existing installation: patroni 1.6.4\n    Uninstalling patroni-1.6.4:\n      Successfully uninstalled patroni-1.6.4\nSuccessfully installed patroni-2.1.3 ydiff-1.2\npostgres@patroni3:\/u01\/app\/postgres\/product\/ [PG1] \n<\/pre>\n<p>To be sure everything works as expected, check the version in the last step and the cluster itself<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres@patroni1:\/u02\/pgdata\/ [PG1]  patronictl list\n+ Cluster: PG1 (7093128570847303467) -+---------+----+-----------+\n| Member   | Host           | Role    | State   | TL | Lag in MB |\n+----------+----------------+---------+---------+----+-----------+\n| patroni1 | 192.168.22.111 | Leader  | running |  4 |           |\n| patroni2 | 192.168.22.112 | Replica | running |  4 |         0 |\n| patroni3 | 192.168.22.113 | Replica | running |  4 |         0 |\n+----------+----------------+---------+---------+----+-----------+\n\npostgres@patroni1:\/u02\/pgdata\/ [PG1] patroni --version\npatroni 2.1.3\n<\/pre>\n<p>Once this this is finished successfully on one node, you can go on with the other nodes in the cluster.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a while since I wrote the blog post about PostgreSQL 13 and Patroni 2.0. On this blog I received a comment, if it&#8217;s possible to explain, how to upgrade from Patroni 1.6 to 2. So let&#8217;s make a short blog about the upgrade procedure of Patroni.<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[84,1543,2602],"type_dbi":[],"class_list":["post-17187","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-high-availability","tag-patroni","tag-postgresql-2"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to upgrade Patroni - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to upgrade Patroni\" \/>\n<meta property=\"og:description\" content=\"It&#8217;s been a while since I wrote the blog post about PostgreSQL 13 and Patroni 2.0. On this blog I received a comment, if it&#8217;s possible to explain, how to upgrade from Patroni 1.6 to 2. So let&#8217;s make a short blog about the upgrade procedure of Patroni.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-02T14:10:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-10T15:28:14+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"headline\":\"How to upgrade Patroni\",\"datePublished\":\"2022-05-02T14:10:49+00:00\",\"dateModified\":\"2024-09-10T15:28:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\"},\"wordCount\":185,\"commentCount\":0,\"keywords\":[\"High availability\",\"Patroni\",\"postgresql\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\",\"name\":\"How to upgrade Patroni - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2022-05-02T14:10:49+00:00\",\"dateModified\":\"2024-09-10T15:28:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to upgrade Patroni\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"caption\":\"Open source Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to upgrade Patroni - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/","og_locale":"en_US","og_type":"article","og_title":"How to upgrade Patroni","og_description":"It&#8217;s been a while since I wrote the blog post about PostgreSQL 13 and Patroni 2.0. On this blog I received a comment, if it&#8217;s possible to explain, how to upgrade from Patroni 1.6 to 2. So let&#8217;s make a short blog about the upgrade procedure of Patroni.","og_url":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/","og_site_name":"dbi Blog","article_published_time":"2022-05-02T14:10:49+00:00","article_modified_time":"2024-09-10T15:28:14+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Open source Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"headline":"How to upgrade Patroni","datePublished":"2022-05-02T14:10:49+00:00","dateModified":"2024-09-10T15:28:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/"},"wordCount":185,"commentCount":0,"keywords":["High availability","Patroni","postgresql"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/","url":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/","name":"How to upgrade Patroni - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-05-02T14:10:49+00:00","dateModified":"2024-09-10T15:28:14+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-upgrade-patroni\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to upgrade Patroni"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","caption":"Open source Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17187"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17187\/revisions"}],"predecessor-version":[{"id":34679,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17187\/revisions\/34679"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17187"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=17187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}