id: 71c9d526879e4522ae093317e7d177d2
parent_id: 
item_type: 1
item_id: c1f29f9051e741858e2ce92d1664e315
item_updated_time: 1764345475094
title_diff: "[{\"diffs\":[[1,\"PGPool-II+PG流复制实现HA主备切换\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":23}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>PGPool-II+PG流复制实现HA主备切换</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"7081\\\"></a>\\\r\\\n<h1>PGPool-II+PG流复制实现HA主备切换</h1>\\\r\\\n\\\r\\\n<div><span>\\\n  <div style=\\\"--en-clipped-content:article\\\">\\\n<div><br/></div><div style=\\\"font-size: 16px; display:block; min-width: 100%; position: relative;\\\"> <div style=\\\"font-family:sans-serif;text-size-adjust:100%;\\\"><div style=\\\"font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:14px;line-height:2;color:rgb(85, 85, 85);background:rgb(255, 255, 255);\\\"><div><span><div><div><div><div><div><div style=\\\"opacity:1;\\\">\\\n    \\\n\\\n    \\\n\\\n    \\\n\\\n    \\\n      <div style=\\\"display:block;opacity:1;transform:translateY(0px);\\\">\\\n\\\n        \\\n        \\\n          <h1 style=\\\"padding:0px;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;margin:20px 0px 10px;word-break:break-word;position:relative;font-size:26px;font-weight:400;text-align:center;\\\"><span style=\\\"font-size:26px;font-weight:400;line-height:1.5;font-family:Lato, PingFang SC, Microsoft YaHei, sans-serif;text-align:center;display:none;\\\"></span>PGPool-II+PG流复制实现HA主备切换</h1>\\\n        \\\n\\\n        <div style=\\\"margin:3px 0px 60px;color:rgb(153, 153, 153);font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:12px;margin-top:5px;text-align:center;margin-bottom:60px;\\\">\\\n          <span>\\\n            \\\n              <span style=\\\"margin-right:3px;\\\">\\\n                <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>\\\n              </span>\\\n              \\\n                <span>发表于</span>\\\n              \\\n              <span title=\\\"创建于\\\">\\\n                2018-05-17\\\n              </span>\\\n            \\\n\\\n            \\\n\\\n            \\\n          </span>\\\n\\\n          \\\n            <span>\\\n            \\\n              <span style=\\\"margin:0px 0.5em;\\\">|</span>\\\n            \\\n              <span style=\\\"margin-right:3px;\\\">\\\n                <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>\\\n              </span>\\\n              \\\n                <span>分类于</span>\\\n              \\\n              \\\n                <span>\\\n                  <a href=\\\"https://hhyo.github.io/categories/PostgreSQL/\\\" rel=\\\"index\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\">\\\n                    <span>PostgreSQL</span>\\\n                  </a>\\\n                </span>\\\n\\\n                \\\n                \\\n              \\\n            </span>\\\n          \\\n\\\n          \\\n            \\\n              <span>\\\n                <span style=\\\"margin:0px 0.5em;\\\">|</span>\\\n                <span style=\\\"margin-right:3px;\\\">\\\n                  <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>\\\n                </span>\\\n                <a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#comments\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\">\\\n                  <span>1 Comment</span>\\\n                </a>\\\n              </span>\\\n            \\\n          \\\n\\\n          \\\n          \\\n             <span>\\\n               <span style=\\\"margin:0px 0.5em;\\\">|</span>\\\n               <span style=\\\"margin-right:3px;\\\">\\\n                 <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:inherit;\\\"></span></i>\\\n               </span>\\\n               \\\n                 <span>阅读次数:</span>\\\n               \\\n                 <span></span>\\\n             </span>\\\n          \\\n\\\n          \\\n\\\n          \\\n\\\n          \\\n              <div style=\\\"font-size:14px;margin-top:2px;\\\">\\\n                  PGPool-II+PG流复制实现HA主备切换\\\n              </div>\\\n          \\\n\\\n        </div>\\\n      </div>\\\n    \\\n\\\n    \\\n    \\\n    \\\n    <div style=\\\"font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;opacity:1;text-align:justify;display:block;transform:translateY(0px);\\\">\\\n\\\n      \\\n      \\\n\\\n      \\\n        <p style=\\\"margin:0px 0px 25px;\\\">架构图<br/><a href=\\\"https://upload-images.jianshu.io/upload_images/68979-2fe8fc73b9da8950.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/550\\\" rel=\\\"group\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\"><img src=\\\"PGPool-II+PG流复制实现HA主备切换_files/550\\\" type=\\\"image/png\\\" data-filename=\\\"550\\\" height=\\\"0\\\" style=\\\"max-width:100%;height:auto;cursor:-webkit-zoom-in;box-sizing:border-box;padding:3px;border:1px solid rgb(221, 221, 221);margin:0px;display:block;\\\" width=\\\"692\\\"/></a></p>\\\n<h1 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:24px;margin:20px 0px 10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%9F%BA%E7%A1%80%E4%BF%A1%E6%81%AF\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"基础信息\\\"></a>基础信息</h1><h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#PostgreSQL\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"PostgreSQL\\\"></a>PostgreSQL</h2><p style=\\\"margin:0px 0px 25px;\\\">版本：10.4<br/>主库db：192.168.1.15 监听端口5432<br/>备库db：192.168.1.16 监听端口5432<br/>vip：192.168.1.88</p>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#PGPool-II\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"PGPool-II\\\"></a>PGPool-II</h2><p style=\\\"margin:0px 0px 25px;\\\">版本：3.7.3</p>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E6%9C%BA%E5%99%A8%E4%BF%A1%E6%81%AF\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"机器信息\\\"></a>机器信息</h2><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"># cat /etc/redhat-release</span><br/><span style=\\\"height:20px;\\\">CentOS Linux release 7.4.1708 (Core) </span><br/><span style=\\\"height:20px;\\\"># uname -a</span><br/><span style=\\\"height:20px;\\\">Linux 192-168-1-16 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux</span><br/></pre></td></tr></tbody></table></div>\\\n<h1 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:24px;margin:20px 0px 10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%AE%89%E8%A3%85PGPool-II-RPM%E6%96%B9%E5%BC%8F\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"安装PGPool-II(RPM方式)\\\"></a>安装PGPool-II(RPM方式)</h1><h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"安装依赖\\\"></a>安装依赖</h2><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">yum -y install libmemcached-devel</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%87%86%E5%A4%87RPM%E5%8C%85\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"准备RPM包\\\"></a>准备RPM包</h2><p style=\\\"margin:0px 0px 25px;\\\"><a href=\\\"http://www.pgpool.net/yum/rpms/3.7/redhat/rhel-7-x86_64/\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" target=\\\"_blank\\\">下载地址</a></p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">pgpool-II-pg10-3.7.3-1pgdg.rhel7.x86_64.rpm</span><br/><span style=\\\"height:20px;\\\">pgpool-II-pg10-debuginfo-3.7.3-1pgdg.rhel7.x86_64.rpm</span><br/><span style=\\\"height:20px;\\\">pgpool-II-pg10-devel-3.7.3-1pgdg.rhel7.x86_64.rpm</span><br/><span style=\\\"height:20px;\\\">pgpool-II-pg10-extensions-3.7.3-1pgdg.rhel7.x86_64.rpm</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%AE%89%E8%A3%85\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"安装\\\"></a>安装</h2><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">rpm -ivh *.rpm</span><br/></pre></td></tr></tbody></table></div>\\\n<h1 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:24px;margin:20px 0px 10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AE\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置\\\"></a>配置</h1><p style=\\\"margin:0px 0px 25px;\\\">默认配置文件目录：/etc/pgpool-II</p>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AEssh%E7%A7%98%E9%92%A5\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置ssh秘钥\\\"></a>配置ssh秘钥</h2><p style=\\\"margin:0px 0px 25px;\\\">配置秘钥使master和slave的postgres用户能免密连接</p>\\\n<p style=\\\"margin:0px 0px 25px;\\\">先修改postgres的密码，在root用户下</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">passwd postgres</span><br/></pre></td></tr></tbody></table></div>\\\n<p style=\\\"margin:0px 0px 25px;\\\">在master,slave机器上都生成ssh</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">[root@localhost ~]# su - postgres</span><br/><span style=\\\"height:20px;\\\">[postgres@localhost ~]$ ssh-keygen -t rsa</span><br/><span style=\\\"height:20px;\\\">[postgres@localhost ~]$ cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys</span><br/><span style=\\\"height:20px;\\\">[postgres@localhost ~]$ chmod 600 ~/.ssh/authorized_keys</span><br/></pre></td></tr></tbody></table></div>\\\n<p style=\\\"margin:0px 0px 25px;\\\">分别将master的公钥复制到slave，slave的公钥复制到master</p>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AE%E7%B3%BB%E7%BB%9F%E5%91%BD%E4%BB%A4%E6%9D%83%E9%99%90\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置系统命令权限\\\"></a>配置系统命令权限</h2><p style=\\\"margin:0px 0px 25px;\\\">配置 ifconfig, arping 执行权限 ，执行failover_stream.sh需要用到，可以让其他普通用户执行</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">chmod u+s /sbin/ifconfig </span><br/><span style=\\\"height:20px;\\\">chmod u+s /usr/sbin</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AEpcp-conf\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置pcp.conf\\\"></a>配置pcp.conf</h2><p style=\\\"margin:0px 0px 25px;\\\">pcp.conf是配置pgpool-II自己的用户名和密码，pgpool提供pcp接口，可以查看，管理pgpool的状态，并且可以远程操作pgpool </p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"># 使用pg_md5生成密码</span><br/><span style=\\\"height:20px;\\\">pg_md5 password</span><br/><span style=\\\"height:20px;\\\">5f4dcc3b5aa765d61d8327deb882cf99</span><br/><span style=\\\"height:20px;\\\"># 添加到pcp.conf配置文件</span><br/><span style=\\\"height:20px;\\\">vim pcp.conf</span><br/><span style=\\\"height:20px;\\\"># 编辑内容如下</span><br/><span style=\\\"height:20px;\\\">postgres:5f4dcc3b5aa765d61d8327deb882cf99</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AEpool-hba-conf\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置pool_hba.conf\\\"></a>配置pool_hba.conf</h2><p style=\\\"margin:0px 0px 25px;\\\">和PostgreSQL的pg_hba.conf文件一样， Pgpool-II使用名为pool_hba.conf的配置文件支持类似的客户端认证功能，要和pg的pg_hba.conf保持一致，要么都是trust，要么都是md5验证方式</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"># TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># &quot;local&quot; is for Unix domain socket connections only</span><br/><span style=\\\"height:20px;\\\">local   all         all                               md5</span><br/><span style=\\\"height:20px;\\\"># IPv4 local connections:</span><br/><span style=\\\"height:20px;\\\">host    all         all         0.0.0.0/0          md5</span><br/><span style=\\\"height:20px;\\\">host    all         all         ::0/0              md5</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%9C%A8pgpool%E4%B8%AD%E6%B7%BB%E5%8A%A0pg%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"在pgpool中添加pg数据库的用户名和密码\\\"></a>在pgpool中添加pg数据库的用户名和密码</h2><p style=\\\"margin:0px 0px 25px;\\\">由于Pgpool-II是一个在PostgreSQL服务器和PostgreSQL数据库客户端之间工作的中间件 ，所以当客户端应用程序连接到Pgpool-II时，Pgpool-II inturn会使用相同的凭据连接到PostgreSQL服务器，以便为客户端连接提供服务。<br/>执行如下命令，会在配置目录生成pool_passwd文件</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">pg_md5 -p -m -u postgres pool_passwd</span><br/><span style=\\\"height:20px;\\\">cat pool_passwd</span><br/><span style=\\\"height:20px;\\\">postgres:md5a3556571e93b0d20722ba62be61e8c2d</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AEpgpool-conf\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置pgpool.conf\\\"></a>配置pgpool.conf</h2><p style=\\\"margin:0px 0px 25px;\\\">pgpool.conf是Pgpool-II的主要配置文件</p>\\\n<h3 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:20px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%88%9B%E5%BB%BA%E5%81%A5%E5%BA%B7%E6%A3%80%E6%9F%A5%E7%94%A8%E6%88%B7\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"创建健康检查用户\\\"></a>创建健康检查用户</h3><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">create user pgpool_healthchk with password 'xxxx';</span><br/><span style=\\\"height:20px;\\\">grant all privileges on database postgres to pgpool_healthchk;</span><br/></pre></td></tr></tbody></table></div>\\\n<h3 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:20px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#master%E9%85%8D%E7%BD%AE\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"master配置\\\"></a>master配置</h3><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/><span style=\\\"height:20px;\\\">8</span><br/><span style=\\\"height:20px;\\\">9</span><br/><span style=\\\"height:20px;\\\">10</span><br/><span style=\\\"height:20px;\\\">11</span><br/><span style=\\\"height:20px;\\\">12</span><br/><span style=\\\"height:20px;\\\">13</span><br/><span style=\\\"height:20px;\\\">14</span><br/><span style=\\\"height:20px;\\\">15</span><br/><span style=\\\"height:20px;\\\">16</span><br/><span style=\\\"height:20px;\\\">17</span><br/><span style=\\\"height:20px;\\\">18</span><br/><span style=\\\"height:20px;\\\">19</span><br/><span style=\\\"height:20px;\\\">20</span><br/><span style=\\\"height:20px;\\\">21</span><br/><span style=\\\"height:20px;\\\">22</span><br/><span style=\\\"height:20px;\\\">23</span><br/><span style=\\\"height:20px;\\\">24</span><br/><span style=\\\"height:20px;\\\">25</span><br/><span style=\\\"height:20px;\\\">26</span><br/><span style=\\\"height:20px;\\\">27</span><br/><span style=\\\"height:20px;\\\">28</span><br/><span style=\\\"height:20px;\\\">29</span><br/><span style=\\\"height:20px;\\\">30</span><br/><span style=\\\"height:20px;\\\">31</span><br/><span style=\\\"height:20px;\\\">32</span><br/><span style=\\\"height:20px;\\\">33</span><br/><span style=\\\"height:20px;\\\">34</span><br/><span style=\\\"height:20px;\\\">35</span><br/><span style=\\\"height:20px;\\\">36</span><br/><span style=\\\"height:20px;\\\">37</span><br/><span style=\\\"height:20px;\\\">38</span><br/><span style=\\\"height:20px;\\\">39</span><br/><span style=\\\"height:20px;\\\">40</span><br/><span style=\\\"height:20px;\\\">41</span><br/><span style=\\\"height:20px;\\\">42</span><br/><span style=\\\"height:20px;\\\">43</span><br/><span style=\\\"height:20px;\\\">44</span><br/><span style=\\\"height:20px;\\\">45</span><br/><span style=\\\"height:20px;\\\">46</span><br/><span style=\\\"height:20px;\\\">47</span><br/><span style=\\\"height:20px;\\\">48</span><br/><span style=\\\"height:20px;\\\">49</span><br/><span style=\\\"height:20px;\\\">50</span><br/><span style=\\\"height:20px;\\\">51</span><br/><span style=\\\"height:20px;\\\">52</span><br/><span style=\\\"height:20px;\\\">53</span><br/><span style=\\\"height:20px;\\\">54</span><br/><span style=\\\"height:20px;\\\">55</span><br/><span style=\\\"height:20px;\\\">56</span><br/><span style=\\\"height:20px;\\\">57</span><br/><span style=\\\"height:20px;\\\">58</span><br/><span style=\\\"height:20px;\\\">59</span><br/><span style=\\\"height:20px;\\\">60</span><br/><span style=\\\"height:20px;\\\">61</span><br/><span style=\\\"height:20px;\\\">62</span><br/><span style=\\\"height:20px;\\\">63</span><br/><span style=\\\"height:20px;\\\">64</span><br/><span style=\\\"height:20px;\\\">65</span><br/><span style=\\\"height:20px;\\\">66</span><br/><span style=\\\"height:20px;\\\">67</span><br/><span style=\\\"height:20px;\\\">68</span><br/><span style=\\\"height:20px;\\\">69</span><br/><span style=\\\"height:20px;\\\">70</span><br/><span style=\\\"height:20px;\\\">71</span><br/><span style=\\\"height:20px;\\\">72</span><br/><span style=\\\"height:20px;\\\">73</span><br/><span style=\\\"height:20px;\\\">74</span><br/><span style=\\\"height:20px;\\\">75</span><br/><span style=\\\"height:20px;\\\">76</span><br/><span style=\\\"height:20px;\\\">77</span><br/><span style=\\\"height:20px;\\\">78</span><br/><span style=\\\"height:20px;\\\">79</span><br/><span style=\\\"height:20px;\\\">80</span><br/><span style=\\\"height:20px;\\\">81</span><br/><span style=\\\"height:20px;\\\">82</span><br/><span style=\\\"height:20px;\\\">83</span><br/><span style=\\\"height:20px;\\\">84</span><br/><span style=\\\"height:20px;\\\">85</span><br/><span style=\\\"height:20px;\\\">86</span><br/><span style=\\\"height:20px;\\\">87</span><br/><span style=\\\"height:20px;\\\">88</span><br/><span style=\\\"height:20px;\\\">89</span><br/><span style=\\\"height:20px;\\\">90</span><br/><span style=\\\"height:20px;\\\">91</span><br/><span style=\\\"height:20px;\\\">92</span><br/><span style=\\\"height:20px;\\\">93</span><br/><span style=\\\"height:20px;\\\">94</span><br/><span style=\\\"height:20px;\\\">95</span><br/><span style=\\\"height:20px;\\\">96</span><br/><span style=\\\"height:20px;\\\">97</span><br/><span style=\\\"height:20px;\\\">98</span><br/><span style=\\\"height:20px;\\\">99</span><br/><span style=\\\"height:20px;\\\">100</span><br/><span style=\\\"height:20px;\\\">101</span><br/><span style=\\\"height:20px;\\\">102</span><br/><span style=\\\"height:20px;\\\">103</span><br/><span style=\\\"height:20px;\\\">104</span><br/><span style=\\\"height:20px;\\\">105</span><br/><span style=\\\"height:20px;\\\">106</span><br/><span style=\\\"height:20px;\\\">107</span><br/><span style=\\\"height:20px;\\\">108</span><br/><span style=\\\"height:20px;\\\">109</span><br/><span style=\\\"height:20px;\\\">110</span><br/><span style=\\\"height:20px;\\\">111</span><br/><span style=\\\"height:20px;\\\">112</span><br/><span style=\\\"height:20px;\\\">113</span><br/><span style=\\\"height:20px;\\\">114</span><br/><span style=\\\"height:20px;\\\">115</span><br/><span style=\\\"height:20px;\\\">116</span><br/><span style=\\\"height:20px;\\\">117</span><br/><span style=\\\"height:20px;\\\">118</span><br/><span style=\\\"height:20px;\\\">119</span><br/><span style=\\\"height:20px;\\\">120</span><br/><span style=\\\"height:20px;\\\">121</span><br/><span style=\\\"height:20px;\\\">122</span><br/><span style=\\\"height:20px;\\\">123</span><br/><span style=\\\"height:20px;\\\">124</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"># CONNECTIONS</span><br/><span style=\\\"height:20px;\\\">listen_addresses = '*'</span><br/><span style=\\\"height:20px;\\\">port = 9999</span><br/><span style=\\\"height:20px;\\\">pcp_listen_addresses = '*'</span><br/><span style=\\\"height:20px;\\\">pcp_port = 9898</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># - Backend Connection Settings -</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">backend_hostname0 = 'master'</span><br/><span style=\\\"height:20px;\\\">backend_port0 = 5432</span><br/><span style=\\\"height:20px;\\\">backend_weight0 = 1</span><br/><span style=\\\"height:20px;\\\">backend_data_directory0 = '/opt/PostgreSQL/data'</span><br/><span style=\\\"height:20px;\\\">backend_flag0 = 'ALLOW_TO_FAILOVER'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">backend_hostname1 = 'slave'</span><br/><span style=\\\"height:20px;\\\">backend_port1 = 5432</span><br/><span style=\\\"height:20px;\\\">backend_weight1 = 1</span><br/><span style=\\\"height:20px;\\\">backend_data_directory1 = '/opt/PostgreSQL/data'</span><br/><span style=\\\"height:20px;\\\">backend_flag1 = 'ALLOW_TO_FAILOVER'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># - Authentication -</span><br/><span style=\\\"height:20px;\\\">enable_pool_hba = on</span><br/><span style=\\\"height:20px;\\\">pool_passwd = 'pool_passwd'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># FILE LOCATIONS</span><br/><span style=\\\"height:20px;\\\">pid_file_name = '/opt/pgpool/pgpool.pid'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">replication_mode = off</span><br/><span style=\\\"height:20px;\\\">master_slave_mode = on</span><br/><span style=\\\"height:20px;\\\">master_slave_sub_mode = 'stream'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">sr_check_period = 5</span><br/><span style=\\\"height:20px;\\\">sr_check_user = 'repuser'</span><br/><span style=\\\"height:20px;\\\">sr_check_password = 'xxxx'</span><br/><span style=\\\"height:20px;\\\">sr_check_database = 'postgres'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">health_check_period = 10 # Health check period</span><br/><span style=\\\"height:20px;\\\">                                   # Disabled (0) by default</span><br/><span style=\\\"height:20px;\\\">health_check_timeout = 20</span><br/><span style=\\\"height:20px;\\\">                                   # Health check timeout</span><br/><span style=\\\"height:20px;\\\">                                   # 0 means no timeout</span><br/><span style=\\\"height:20px;\\\">health_check_user = 'pgpool_healthchk'</span><br/><span style=\\\"height:20px;\\\">                                   # Health check user</span><br/><span style=\\\"height:20px;\\\">health_check_password = 'xxxx'    </span><br/><span style=\\\"height:20px;\\\">                                   # Password for health check user</span><br/><span style=\\\"height:20px;\\\">health_check_database = 'postgres'</span><br/><span style=\\\"height:20px;\\\">#必须设置，否则primary数据库down了，pgpool不知道，不能及时切换。从库流复制还在连接数据，报连接失败。</span><br/><span style=\\\"height:20px;\\\">#只有下次使用pgpool登录时，发现连接不上，然后报错，这时候，才知道挂了，pgpool进行切换。</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">#主备切换的命令行配置</span><br/><span style=\\\"height:20px;\\\">#------------------------------------------------------------------------------</span><br/><span style=\\\"height:20px;\\\"># FAILOVER AND FAILBACK</span><br/><span style=\\\"height:20px;\\\">#------------------------------------------------------------------------------</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">failover_command = '/opt/pgpool/failover_stream.sh %H'</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">#------------------------------------------------------------------------------</span><br/><span style=\\\"height:20px;\\\"># WATCHDOG</span><br/><span style=\\\"height:20px;\\\">#------------------------------------------------------------------------------</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># - Enabling -</span><br/><span style=\\\"height:20px;\\\">use_watchdog = on</span><br/><span style=\\\"height:20px;\\\"># - Watchdog communication Settings -</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">wd_hostname = 'master'</span><br/><span style=\\\"height:20px;\\\">                                    # Host name or IP address of this watchdog</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">wd_port = 9000</span><br/><span style=\\\"height:20px;\\\">                                    # port number for watchdog service</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\"># - Virtual IP control Setting -</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">delegate_IP = '192.168.1.88'</span><br/><span style=\\\"height:20px;\\\">                                    # delegate IP address</span><br/><span style=\\\"height:20px;\\\">                                    # If this is empty, virtual IP never bring up.</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">if_cmd_path = '/sbin'</span><br/><span style=\\\"height:20px;\\\">                                    # path to the directory where if_up/down_cmd </span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">if_up_cmd = 'ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0'</span><br/><span style=\\\"height:20px;\\\">                                    # startup delegate IP command</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">if_down_cmd = 'ifconfig eth0:0 down'</span><br/><span style=\\\"height:20px;\\\">                                    # shutdown delegate IP command</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\"># -- heartbeat mode --</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">wd_heartbeat_port = 9694</span><br/><span style=\\\"height:20px;\\\">                                    # Port number for receiving heartbeat signal</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">wd_heartbeat_keepalive = 2</span><br/><span style=\\\"height:20px;\\\">                                    # Interval time of sending heartbeat signal (sec)</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">wd_heartbeat_deadtime = 30</span><br/><span style=\\\"height:20px;\\\">                                    # Deadtime interval for heartbeat signal (sec)</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">heartbeat_destination0 = 'slave'</span><br/><span style=\\\"height:20px;\\\">                                    # Host name or IP address of destination 0</span><br/><span style=\\\"height:20px;\\\">                                    # for sending heartbeat signal.</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">heartbeat_destination_port0 = 9694</span><br/><span style=\\\"height:20px;\\\">                                    # Port number of destination 0 for sending</span><br/><span style=\\\"height:20px;\\\">                                    # heartbeat signal. Usually this is the</span><br/><span style=\\\"height:20px;\\\">                                    # same as wd_heartbeat_port.</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">heartbeat_device0 = 'eth0'</span><br/><span style=\\\"height:20px;\\\">                                    # Name of NIC device (such like 'eth0')</span><br/><span style=\\\"height:20px;\\\">                                    # used for sending/receiving heartbeat</span><br/><span style=\\\"height:20px;\\\">                                    # signal to/from destination 0.</span><br/><span style=\\\"height:20px;\\\">                                    # This works only when this is not empty</span><br/><span style=\\\"height:20px;\\\">                                    # and pgpool has root privilege.</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\"># - Other pgpool Connection Settings -</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">other_pgpool_hostname0 = 'slave'                    # Host name or IP address to connect to for </span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">other_pgpool_port0 = 9999</span><br/><span style=\\\"height:20px;\\\">                                    # Port number for othet pgpool 0</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/><span style=\\\"height:20px;\\\">other_wd_port0 = 9000</span><br/><span style=\\\"height:20px;\\\">                                    # Port number for othet watchdog 0</span><br/><span style=\\\"height:20px;\\\">                                    # (change requires restart)</span><br/></pre></td></tr></tbody></table></div>\\\n<h3 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:20px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#slave%E9%85%8D%E7%BD%AE\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"slave配置\\\"></a>slave配置</h3><p style=\\\"margin:0px 0px 25px;\\\">仅列出与master不同的配置项</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">heartbeat_destination0 = 'master'</span><br/><span style=\\\"height:20px;\\\">other_pgpool_hostname0 = 'master'</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%88%9B%E5%BB%BAfailover-stream%E8%84%9A%E6%9C%AC\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"创建failover_stream脚本\\\"></a>创建failover_stream脚本</h2><p style=\\\"margin:0px 0px 25px;\\\">在master\\\\slave分别操作</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">mkdir /opt/pgpool </span><br/><span style=\\\"height:20px;\\\">chown postgres:postgres /opt/pgpool</span><br/><span style=\\\"height:20px;\\\">cd /opt/pgpool</span><br/><span style=\\\"height:20px;\\\">vim failover_stream.sh</span><br/></pre></td></tr></tbody></table></div>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/><span style=\\\"height:20px;\\\">8</span><br/><span style=\\\"height:20px;\\\">9</span><br/><span style=\\\"height:20px;\\\">10</span><br/><span style=\\\"height:20px;\\\">11</span><br/><span style=\\\"height:20px;\\\">12</span><br/><span style=\\\"height:20px;\\\">13</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">#! /bin/sh </span><br/><span style=\\\"height:20px;\\\"># Failover command for streaming replication. </span><br/><span style=\\\"height:20px;\\\"># Arguments: $1: new master hostname. </span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">PGHOME='/usr/pgsql-10'</span><br/><span style=\\\"height:20px;\\\">PGDATA='/opt/PostgreSQL/data'</span><br/><span style=\\\"height:20px;\\\">new_master=$1 </span><br/><span style=\\\"height:20px;\\\">trigger_command=&quot;$PGHOME/bin/pg_ctl promote -D $PGDATA&quot; </span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\"># Prompte standby database. </span><br/><span style=\\\"height:20px;\\\">/usr/bin/ssh -T $new_master $trigger_command </span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">exit 0;</span><br/></pre></td></tr></tbody></table></div>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">chown postgres:postgres failover_stream.sh &amp;&amp;chmod 777 failover_stream.sh</span><br/></pre></td></tr></tbody></table></div>\\\n<h1 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:24px;margin:20px 0px 10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%90%AF%E5%8A%A8\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"启动\\\"></a>启动</h1><h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%88%9B%E5%BB%BA%E7%9B%B8%E5%85%B3%E6%96%87%E4%BB%B6%E5%A4%B9\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"创建相关文件夹\\\"></a>创建相关文件夹</h2><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">mkdir /var/log/pgpool</span><br/><span style=\\\"height:20px;\\\">chown -R postgres.postgres /var/log/pgpool</span><br/><span style=\\\"height:20px;\\\">mkdir /var/run/pgpool</span><br/><span style=\\\"height:20px;\\\">chown -R postgres.postgres /var/run/pgpool</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%90%AF%E5%8A%A8-1\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"启动\\\"></a>启动</h2><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"><span style=\\\"color:rgb(142, 144, 140);\\\"># 启动</span></span><br/><span style=\\\"height:20px;\\\">systemctl start pgpool.service</span><br/><span style=\\\"height:20px;\\\"><span style=\\\"color:rgb(142, 144, 140);\\\"># 停止</span></span><br/><span style=\\\"height:20px;\\\">systemctl stop pgpool.service</span><br/></pre></td></tr></tbody></table></div>\\\n<p style=\\\"margin:0px 0px 25px;\\\">查看集群状态</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/><span style=\\\"height:20px;\\\">8</span><br/><span style=\\\"height:20px;\\\">9</span><br/><span style=\\\"height:20px;\\\">10</span><br/><span style=\\\"height:20px;\\\">11</span><br/><span style=\\\"height:20px;\\\">12</span><br/><span style=\\\"height:20px;\\\">13</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">[root@172-16-200-15 ~]# psql -h vip -p 9999 -U postgres</span><br/><span style=\\\"height:20px;\\\">用户 postgres 的口令：</span><br/><span style=\\\"height:20px;\\\">psql (10.4)</span><br/><span style=\\\"height:20px;\\\">输入 &quot;help&quot; 来获取帮助信息.</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">postgres=# show pool_nodes;</span><br/><span style=\\\"height:20px;\\\"> node_id | hostname | port | status | lb_weight |  role   | select_cnt | load_balance_node | replication_delay </span><br/><span style=\\\"height:20px;\\\">---------+----------+------+--------+-----------+---------+------------+-------------------+-------------------</span><br/><span style=\\\"height:20px;\\\"> 0       | master   | 5432 | up     | 0.500000  | primary | 0          | true              | 0</span><br/><span style=\\\"height:20px;\\\"> 1       | slave    | 5432 | up     | 0.500000  | standby | 0          | false             | 0</span><br/><span style=\\\"height:20px;\\\">(2 行记录)</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">#在slave上节点也是psql -h vip -p 9999，双pgpool使用虚拟ip，做到高可用。</span><br/></pre></td></tr></tbody></table></div>\\\n<h1 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:24px;margin:20px 0px 10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#HA%E6%B5%8B%E8%AF%95\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"HA测试\\\"></a>HA测试</h1><h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E6%A8%A1%E6%8B%9Fpgpool%E5%AE%95%E6%9C%BA\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"模拟pgpool宕机\\\"></a>模拟pgpool宕机</h2><p style=\\\"margin:0px 0px 25px;\\\">在master节点操作</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/><span style=\\\"height:20px;\\\">5</span><br/><span style=\\\"height:20px;\\\">6</span><br/><span style=\\\"height:20px;\\\">7</span><br/><span style=\\\"height:20px;\\\">8</span><br/><span style=\\\"height:20px;\\\">9</span><br/><span style=\\\"height:20px;\\\">10</span><br/><span style=\\\"height:20px;\\\">11</span><br/><span style=\\\"height:20px;\\\">12</span><br/><span style=\\\"height:20px;\\\">13</span><br/><span style=\\\"height:20px;\\\">14</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"><span style=\\\"color:rgb(142, 144, 140);\\\"># 停止pgpool</span></span><br/><span style=\\\"height:20px;\\\">systemctl stop pgpool</span><br/><span style=\\\"height:20px;\\\"><span style=\\\"color:rgb(142, 144, 140);\\\"># 访问</span></span><br/><span style=\\\"height:20px;\\\">[postgres@postgres ~]<span style=\\\"color:rgb(142, 144, 140);\\\"># psql -h vip -p 9999 -U postgres</span></span><br/><span style=\\\"height:20px;\\\">用户 postgres 的口令：</span><br/><span style=\\\"height:20px;\\\">psql (10.4)</span><br/><span style=\\\"height:20px;\\\">输入 <span style=\\\"color:rgb(113, 140, 0);\\\">&quot;help&quot;</span> 来获取帮助信息.</span><br/><span style=\\\"height:20px;\\\"></span><br/><span style=\\\"height:20px;\\\">postgres=<span style=\\\"color:rgb(142, 144, 140);\\\"># show pool_nodes;</span></span><br/><span style=\\\"height:20px;\\\"> node_id | hostname | port | status | lb_weight |  role   | select_cnt | load_balance_node | replication_delay </span><br/><span style=\\\"height:20px;\\\">---------+----------+------+--------+-----------+---------+------------+-------------------+-------------------</span><br/><span style=\\\"height:20px;\\\"> 0       | master   | 5432 | up     | 0.500000  | primary | 0          | <span style=\\\"color:rgb(245, 135, 31);\\\">true</span>              | 0</span><br/><span style=\\\"height:20px;\\\"> 1       | slave    | 5432 | up     | 0.500000  | standby | 0          | <span style=\\\"color:rgb(245, 135, 31);\\\">false</span>             | 0</span><br/><span style=\\\"height:20px;\\\">(2 行记录)</span><br/></pre></td></tr></tbody></table></div>\\\n<h2 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:22px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E6%A8%A1%E6%8B%9FPG%E4%B8%BB%E5%BA%93%E5%AE%95%E6%9C%BA\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"模拟PG主库宕机\\\"></a>模拟PG主库宕机</h2><p style=\\\"margin:0px 0px 25px;\\\">在master操作</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\"><span style=\\\"color:rgb(142, 144, 140);\\\"># 停止postgresql</span></span><br/><span style=\\\"height:20px;\\\">systemctl stop postgresql-10.service</span><br/></pre></td></tr></tbody></table></div>\\\n<h3 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:20px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E6%81%A2%E5%A4%8Dmaster%E8%8A%82%E7%82%B9\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"恢复master节点\\\"></a>恢复master节点</h3><h4 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:18px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E9%85%8D%E7%BD%AErecovery-conf\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"配置recovery.conf\\\"></a>配置recovery.conf</h4><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">find  / -name &quot;recovery.conf.sample&quot;</span><br/><span style=\\\"height:20px;\\\">cp /usr/pgsql-10/share/recovery.conf.sample $PGDATA/recovery.done</span><br/></pre></td></tr></tbody></table></div>\\\n<p style=\\\"margin:0px 0px 25px;\\\">然后在recovery.done中添加如下内容</p>\\\n<div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/><span style=\\\"height:20px;\\\">2</span><br/><span style=\\\"height:20px;\\\">3</span><br/><span style=\\\"height:20px;\\\">4</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">recovery_target_timeline = 'latest'</span><br/><span style=\\\"height:20px;\\\">standby_mode = on # 指明是否开启服务器作为一个备机。在流复制里，这个参数必须要开启。</span><br/><span style=\\\"height:20px;\\\">primary_conninfo = 'host=salve port=5432 user=repl password=xxxx' # 指明用于备服务器连接到主服务器的连接字符串。  </span><br/><span style=\\\"height:20px;\\\">trigger_file = '/opt/PostgreSQL/pg.trigger' # 指定一个触发文件让备服务器感觉到它的时候就会停止流复制（即：故障转移），不要创建这个文件。当你想主从切换的时候才需要创建它。</span><br/></pre></td></tr></tbody></table></div>\\\n<h4 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:18px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%90%AF%E5%8A%A8-2\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"启动\\\"></a>启动</h4><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">systemctl start postgresql-10.service</span><br/></pre></td></tr></tbody></table></div>\\\n<h4 style=\\\"padding:0px;font-weight:bold;line-height:1.5;font-family:Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size:18px;margin:20px 0px 10px;padding-top:10px;\\\"><a href=\\\"https://hhyo.github.io/2018/05/17/pgpool-II-install/#%E5%8A%A0%E5%85%A5%E8%8A%82%E7%82%B9\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" title=\\\"加入节点\\\"></a>加入节点</h4><div style=\\\"display:block;overflow:auto;padding:0px;font-size:13px;color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;margin:20px 0px;border-radius:1px;\\\"><table style=\\\"font-weight:inherit;font-style:inherit;font-variant:inherit;font-size:14px;table-layout:fixed;border-collapse:collapse;border-spacing:0px;margin:0px;width:auto;border:none;\\\"><tbody><tr style=\\\"background-color:rgb(249, 249, 249);\\\"><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;user-select:none;padding:0px;\\\"><pre style=\\\"background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;padding-left:10px;padding-right:10px;text-align:right;background-color:rgb(239, 242, 243);color:rgb(134, 145, 148);\\\"><span style=\\\"height:20px;\\\">1</span><br/></pre></td><td style=\\\"text-align:left;vertical-align:middle;font-weight:normal;border-bottom:3px solid rgb(221, 221, 221);border-right:1px solid rgb(238, 238, 238);border-bottom-width:1px;border:none;padding:0px;\\\"><pre style=\\\"color:rgb(77, 77, 76);background:rgb(247, 247, 247);line-height:1.6;overflow:auto;font-size:13px;font-family:consolas, Menlo, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, monospace;border:none;margin:0px;padding:10px 0px;width:100%;padding-left:10px;padding-right:10px;background-color:rgb(247, 247, 247);\\\"><span style=\\\"height:20px;\\\">pcp_attach_node -d -U postgres -h vip -p 9898 -n 0</span><br/></pre></td></tr></tbody></table></div>\\\n<p style=\\\"margin:0px 0px 25px;\\\"><strong style=\\\"font-weight:bold;\\\">参考</strong><br/>  1. <a href=\\\"http://www.pgpool.net/docs/latest/en/html/example-configs.html\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" target=\\\"_blank\\\">http://www.pgpool.net/docs/latest/en/html/example-configs.html</a><br/>  2. <a href=\\\"http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/en.html#more_switch\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" target=\\\"_blank\\\">http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/en.html#more_switch</a><br/>  3. <a href=\\\"https://www.jianshu.com/p/ef183d0a9213\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" target=\\\"_blank\\\">https://www.jianshu.com/p/ef183d0a9213</a><br/>  4. <a href=\\\"https://www.jianshu.com/p/41d857a5d743\\\" rel=\\\"noopener\\\" style=\\\"background-color:transparent;color:rgb(85, 85, 85);text-decoration:none;outline:none;border-bottom:1px solid rgb(153, 153, 153);overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);\\\" target=\\\"_blank\\\">https://www.jianshu.com/p/41d857a5d743</a></p>\\\n\\\n      \\\n    </div>\\\n    \\\n    \\\n    \\\n\\\n\\\n    \\\n      <div>\\\n        \\\n\\\n      </div>\\\n    \\\n   \\\n    \\\n\\\n    \\\n\\\n    \\\n\\\n    <div style=\\\"display:block;\\\">\\\n      \\\n        <div style=\\\"margin-top:40px;text-align:left;\\\">\\\n          \\\n            <a href=\\\"https://hhyo.github.io/tags/PostgreSQL/\\\" rel=\\\"tag\\\" style=\\\"color:rgb(85, 85, 85);text-decoration:none;outline:none;overflow-wrap:break-word;display:inline-block;margin-right:10px;font-size:13px;padding:1px 5px;background:rgb(245, 245, 245);border-bottom:none;\\\"># PostgreSQL</a>\\\n          \\\n        </div>\\\n      \\\n\\\n      \\\n      \\\n      \\\n\\\n      \\\n        <div style=\\\"display:table;width:100%;border-top:1px solid rgb(238, 238, 238);margin-top:40px;\\\">\\\n          <div style=\\\"display:table-cell;padding:10px 0px 0px;width:45%;vertical-align:top;\\\">\\\n            \\\n              <a href=\\\"https://hhyo.github.io/2018/05/17/postgresql-streaming-replication/\\\" rel=\\\"next\\\" style=\\\"background-color:transparent;text-decoration:none;outline:none;overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);position:relative;display:block;line-height:25px;font-size:14px;color:rgb(85, 85, 85);border-bottom:none;padding-left:15px;\\\" title=\\\"PostgreSQL的流复制配置\\\">\\\n                <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;text-rendering:auto;-webkit-font-smoothing:antialiased;position:absolute;top:8px;left:0px;font-size:12px;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:12px;\\\"></span></i> PostgreSQL的流复制配置\\\n              </a>\\\n            \\\n          </div>\\\n\\\n          <span style=\\\"display:table-cell;width:10%;\\\"></span>\\\n\\\n          <div style=\\\"display:table-cell;padding:10px 0px 0px;width:45%;vertical-align:top;text-align:right;\\\">\\\n            \\\n              <a href=\\\"https://hhyo.github.io/2018/05/23/proxysql-install/\\\" rel=\\\"prev\\\" style=\\\"background-color:transparent;text-decoration:none;outline:none;overflow-wrap:break-word;border-bottom-color:rgb(204, 204, 204);position:relative;display:block;line-height:25px;font-size:14px;color:rgb(85, 85, 85);border-bottom:none;padding-right:15px;\\\" title=\\\"CentOS7下使用RPM安装ProxySQL以及Cluster搭建\\\">\\\n                CentOS7下使用RPM安装ProxySQL以及Cluster搭建 <i style=\\\"display:inline-block;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1;text-rendering:auto;-webkit-font-smoothing:antialiased;position:absolute;top:8px;font-size:12px;right:0px;left:auto;font-family:FontAwesome;\\\"><span style=\\\"font-style:normal;font-variant:normal;font-weight:normal;line-height:1;font-family:FontAwesome;font-size:12px;\\\"></span></i>\\\n              </a>\\\n            \\\n          </div>\\\n        </div>\\\n      \\\n\\\n      \\\n      \\\n    </div>\\\n  </div></div></div></div></div></div></span></div></div></div></div>\\\n</div>\\\n</span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":93641}]"
metadata_diff: {"new":{"id":"c1f29f9051e741858e2ce92d1664e315","parent_id":"061de1401cfc4cfaadf6e74e015970e9","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764345748987,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T16:12:53.404Z
created_time: 2025-11-28T16:12:53.404Z
type_: 13