{"id":4809,"date":"2019-09-13T20:22:18","date_gmt":"2019-09-14T00:22:18","guid":{"rendered":"https:\/\/microdevsys.com\/wp\/?p=4809"},"modified":"2019-09-15T19:43:27","modified_gmt":"2019-09-15T23:43:27","slug":"fatal-remaining-connection-slots-are-reserved-for-non-replication-superuser-connections","status":"publish","type":"post","link":"https:\/\/microdevsys.com\/wp\/fatal-remaining-connection-slots-are-reserved-for-non-replication-superuser-connections\/","title":{"rendered":"FATAL:  remaining connection slots are reserved for non-replication superuser connections"},"content":{"rendered":"<p>\n\tGetting this?\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">FATAL: &nbsp;remaining connection slots are reserved for non-replication superuser connections<\/span>\n<\/p>\n<p>\n\tFix that by updating the Patroni configuration like like so:\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">[root@psql01 log]# patronictl -c \/etc\/patroni.yml edit-config postgres<br \/>\n\t&#8212;<br \/>\n\t+++<br \/>\n\t@@ -1,9 +1,10 @@<br \/>\n\t&nbsp;loop_wait: 10<br \/>\n\t&nbsp;maximum_lag_on_failover: 1048576<br \/>\n\t&nbsp;postgresql:<br \/>\n\t+ &nbsp;parameters:<br \/>\n\t&#8211; &nbsp;max_connections: 256<br \/>\n\t+ &nbsp; &nbsp;max_connections: 256<br \/>\n\t&#8211; &nbsp;max_replication_slots: 64<br \/>\n\t+ &nbsp; &nbsp;max_replication_slots: 64<br \/>\n\t&#8211; &nbsp;max_wal_senders: 32<br \/>\n\t+ &nbsp; &nbsp;max_wal_senders: 32<br \/>\n\t&nbsp; &nbsp;use_pg_rewind: true<br \/>\n\t&nbsp;retry_timeout: 10<br \/>\n\t&nbsp;ttl: 30<\/span>\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">Apply these changes? [y\/N]: y<br \/>\n\tConfiguration changed<br \/>\n\t[root@psql01 log]#<br \/>\n\t[root@psql01 log]#<br \/>\n\t[root@psql01 log]# patronictl -c \/etc\/patroni.yml restart postgres<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\t| Cluster &nbsp;| &nbsp; &nbsp;Member &nbsp; | &nbsp; &nbsp; &nbsp;Host &nbsp; &nbsp; | &nbsp;Role &nbsp;| &nbsp;State &nbsp;| Lag in MB |<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\t| postgres | postgresql0 | 192.168.0.108 | Leader | running | &nbsp; &nbsp; &nbsp; 0.0 |<br \/>\n\t| postgres | postgresql1 | 192.168.0.124 | &nbsp; &nbsp; &nbsp; &nbsp;| running | &nbsp; &nbsp; &nbsp; 0.0 |<br \/>\n\t| postgres | postgresql2 | 192.168.0.118 | &nbsp; &nbsp; &nbsp; &nbsp;| running | &nbsp; &nbsp; &nbsp; 0.0 |<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\tAre you sure you want to restart members postgresql0, postgresql1, postgresql2? [y\/N]: y<br \/>\n\tRestart if the PostgreSQL version is less than provided (e.g. 9.5.2) &nbsp;[]:<br \/>\n\tWhen should the restart take place (e.g. 2015-10-01T14:30) &nbsp;[now]:<br \/>\n\tSuccess: restart on member postgresql0<br \/>\n\tSuccess: restart on member postgresql1<br \/>\n\tSuccess: restart on member postgresql2<br \/>\n\t[root@psql01 log]# sudo su &#8211; postgres<br \/>\n\tLast login: Sat Sep 14 09:15:34 EDT 2019 on pts\/0<br \/>\n\t-bash-4.2$ psql -h psql-c01 -p 5432 -W<br \/>\n\tPassword:<br \/>\n\tpsql (10.5)<br \/>\n\tType &quot;help&quot; for help.<\/span>\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">postgres=#<br \/>\n\tpostgres=#<br \/>\n\tpostgres=#<br \/>\n\tpostgres=# show max_connections; show &nbsp;max_replication_slots;<br \/>\n\t&nbsp;max_connections<br \/>\n\t&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\t&nbsp;256<br \/>\n\t(1 row)<\/span>\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">&nbsp;max_replication_slots<br \/>\n\t&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\t&nbsp;64<br \/>\n\t(1 row)<\/span>\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">postgres=#<\/span><br \/>\n\t&nbsp;\n<\/p>\n<p>\n\tKeep in mind that cluster name above is your scope from the config file:\n<\/p>\n<p style=\"margin-left: 40px;\">\n\t<span style=\"font-family:courier new,courier,monospace;\">[root@psql01 patroni]# cat \/etc\/patroni.yml<br \/>\n\tscope: postgres<\/span>\n<\/p>\n<p>\n\tAlternately, update the PostgresSQL settings with the above, if you&#39;re not running Patroni.&nbsp; Verify status:\n<\/p>\n<p>\n\t<span style=\"font-family:courier new,courier,monospace;\"><u><font color=\"#000119\" style=\"background-color: rgb(255, 255, 255);\">[<\/font><\/u><font color=\"#000119\" style=\"background-color: rgb(255, 255, 255);\">root@psql01 ~]# patronictl -c \/etc\/patroni.yml list<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\t| Cluster&nbsp; |&nbsp;&nbsp;&nbsp; Member&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Host&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; Role&nbsp; |&nbsp; State&nbsp; | Lag in MB |<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\t| postgres | postgresql0 | 192.168.0.108 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | running |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0 |<br \/>\n\t| postgres | postgresql1 | 192.168.0.124 | Leader | running |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0 |<br \/>\n\t| postgres | postgresql2 | 192.168.0.118 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | running |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0 |<br \/>\n\t+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n\t[root@psql01 ~]#<\/font><\/span><br \/>\n\t&nbsp;\n<\/p>\n<p>\n\tCheers,<br \/>\n\tTK\n<\/p>\n<p>\n\t<strong>REF:<\/strong> My post on the project page:&nbsp;<a href=\"https:\/\/github.com\/zalando\/patroni\/issues\/1177\" rel=\"external nofollow\">https:\/\/github.com\/zalando\/patroni\/issues\/1177<\/a><\/p>\n\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>Getting this? FATAL: &nbsp;remaining connection slots are reserved for non-replication superuser connections Fix that by updating the Patroni configuration like like so: [root@psql01 log]# patronictl -c \/etc\/patroni.yml edit-config postgres &#8212; +++ @@ -1,9 +1,10 @@ &nbsp;loop_wait: 10 &nbsp;maximum_lag_on_failover: 1048576 &nbsp;postgresql: + &nbsp;parameters: &#8211; &nbsp;max_connections: 256 + &nbsp; &nbsp;max_connections: 256 &#8211; &nbsp;max_replication_slots: 64 + &nbsp; &nbsp;max_replication_slots: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4809","post","type-post","status-publish","format-standard","hentry","category-unix-linux-admin-stuff"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/posts\/4809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/comments?post=4809"}],"version-history":[{"count":5,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/posts\/4809\/revisions"}],"predecessor-version":[{"id":4814,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/posts\/4809\/revisions\/4814"}],"wp:attachment":[{"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/media?parent=4809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/categories?post=4809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microdevsys.com\/wp\/wp-json\/wp\/v2\/tags?post=4809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}