{"id":89,"date":"2013-11-21T17:49:17","date_gmt":"2013-11-21T08:49:17","guid":{"rendered":"http:\/\/knowhow.hirohiro716.com\/?p=89"},"modified":"2021-06-24T18:21:54","modified_gmt":"2021-06-24T09:21:54","slug":"postgresql%e3%81%a7%e3%81%ae%e3%82%b9%e3%83%88%e3%83%aa%e3%83%bc%e3%83%9f%e3%83%b3%e3%82%b0%e3%83%ac%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/weblog.hirohiro716.com\/?p=89","title":{"rendered":"PostgreSQL\u30b9\u30c8\u30ea\u30fc\u30df\u30f3\u30b0\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8a2d\u5b9a(Windows)"},"content":{"rendered":"<h4>2\u53f0\u69cb\u6210<\/h4>\n<p>\nhost\uff1asv1\u3000ip\uff1a192.168.0.100\u3000\u7565\u79f0\uff1a\u30d7\u30e9\u30a4\u30de\u30ea<br \/>\nhost\uff1asv2\u3000ip\uff1a192.168.0.101\u3000\u7565\u79f0\uff1a\u30bb\u30ab\u30f3\u30c0\u30ea\n<\/p>\n<p style=\"margin-top:1em;\">\n\u307e\u305a\u306f\u4e21\u30db\u30b9\u30c8\u306bPostgreSQL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u672c\u624b\u9806\u4f5c\u6210\u6642\u306fVer9.2\u3092\u4f7f\u7528\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b8c\u4e86\u5f8c\u306b\u4e21\u7aef\u672b\u3067\u5171\u901a\u306e\u7ba1\u7406\u8005\u6a29\u9650\u3092\u6301\u3064\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30b5\u30fc\u30d3\u30b9\u5b9f\u884c\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u305d\u308c\u306b\u5909\u66f4\u3059\u308b\u3002\n<\/p>\n<h4>\u30d7\u30e9\u30a4\u30de\u30ea\u3067\u306e\u4f5c\u696d<\/h4>\n<p>\n\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8d77\u52d5\u3057\u3001PostgreSQL\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u3001bin\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncd &quot;c:\\Program Files\\PostgreSQL\\9.2\\bin&quot;\r\n<\/pre>\n<p style=\"margin-top:2em;\">\n\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7528\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncreateuser -P -E -U postgres --replication rep_user\r\n<\/pre>\n<p style=\"margin-top:2.5em;\">\n\u4f5c\u6210\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u30922\u56de\u5165\u529b\u3057\u3001\u6700\u5f8c\u306bpostgres\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3002\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u753b\u9762\u306f\u9589\u3058\u305a\u306b\u6b21\u3078\u3002\n<\/p>\n<p style=\"margin-top:2em;\">\n\u5916\u90e8\u304b\u3089\u306e\u901a\u4fe1\u3092\u8a31\u53ef\u3059\u308b\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u300cdata\u300d\u306b\u3042\u308b\u300cpg_hba.conf\u300d\u306e\u6700\u5f8c\u306b\u4e0b\u8a18\u306e\u884c\u3092\u8ffd\u52a0\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhost    replication    rep_user    192.168.0.0\/24    md5\r\n<\/pre>\n<p style=\"margin-top:2em;\">\npostgresql.conf\u306e\u4e0b\u8a188\u884c\u3092\u7de8\u96c6\u3059\u308b\u3002<br \/>\n\u203bsynchronous_commit\u306f\u30b7\u30b9\u30c6\u30e0\u8981\u4ef6\u306b\u3088\u3063\u3066\u5909\u66f4\u3057\u305f\u65b9\u304c\u826f\u3044\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nlisten_addresses = '*'\r\nwal_level = hot_standby\r\nfsync = on\r\nsynchronous_commit = off\r\nwal_sync_method = fsync\r\nmax_wal_senders = 2  \u203b\u30d7\u30e9\u30a4\u30de\u30ea\u3092\u542b\u3093\u3060\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306e\u6570\u3092\u5165\u308c\u308b\r\nwal_keep_segments = 32  \u203b8\uff5e32\u304c\u76ee\u5b89\u3089\u3057\u3044\r\nsynchronous_standby_names = '*'\r\n<\/pre>\n<p style=\"margin-top:2em;\">\n\u3064\u3044\u3067\u306b\u4e0b\u8a18\u8a2d\u5b9a\u5024\u304c\u30b7\u30b9\u30c6\u30e0\u8981\u4ef6\u306b\u5408\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmax_connections = 300  \u203b\u540c\u6642\u63a5\u7d9a\u6570\r\nshared_buffers = 1024MB  \u203b\u7269\u7406\u30e1\u30e2\u30ea\u306e1\/4\u7a0b\u5ea6\r\nwork_mem = 8MB  \u203b\u7269\u7406\u30e1\u30e2\u30ea\u306e1\/500\u7a0b\u5ea6\u3060\u304c\u6700\u59278MB\r\neffective_cache_size = 2048MB  \u203b\u7269\u7406\u30e1\u30e2\u30ea\u306e1\/2\u7a0b\u5ea6\r\n<\/pre>\n<p style=\"margin-top:2em;\">\npostgresql\u30b5\u30fc\u30d3\u30b9\u3092\u518d\u8d77\u52d5\u3002OS\u518d\u8d77\u52d5\u3067\u3082\u3088\u3044\u3002\n<\/p>\n<h4 style=\"margin-top:2em;\">\u30bb\u30ab\u30f3\u30c0\u30ea\u3067\u306e\u4f5c\u696d<\/h4>\n<p>\npostgresql\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3057\u305f\u72b6\u614b\u3067\u3001PostgreSQL\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u300cdata\u300d\u30d5\u30a9\u30eb\u30c0\u5185\u3092\u7a7a\u306b\u3057\u3066\u304a\u304f\u3002\n<\/p>\n<p style=\"margin-top:2em;\">\n\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8d77\u52d5\u3057\u3001PosgreSQL\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u3001bin\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u79fb\u52d5\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncd &quot;c:\\Program Files\\PostgreSQL\\9.2\\bin&quot;\r\n<\/pre>\n<p style=\"margin-top:2em;\">\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30d7\u30e9\u30a4\u30de\u30ea\u304b\u3089\u30d9\u30fc\u30b9\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\npg_basebackup -h 192.168.0.100 -p 5432 -U rep_user -D &quot;c:\\Program Files\\PostgreSQL\\9.2\\data&quot; -x -c fast -P\r\n<\/pre>\n<p style=\"margin-top:2em;\">\n\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u300cdata\u300d\u306b\u3042\u308b\u300cpostgresql.conf\u300d\u3092\u7de8\u96c6\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhot_standby = on\r\n<\/pre>\n<p style=\"margin-top:2.5em;\">\npostgresql\u30b5\u30fc\u30d3\u30b9\u3092\u518d\u8d77\u52d5\u3002OS\u518d\u8d77\u52d5\u3067\u3082\u3088\u3044\u3002\n<\/p>\n<p style=\"margin-top:2em;\">\n\u540c\u3058\u5834\u6240\u306b\u300crecovery.conf\u300d\u3092\u65b0\u898f\u4f5c\u6210\u3001\u5185\u5bb9\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nstandby_mode = 'on'\r\nprimary_conninfo = 'host=192.168.0.100 port=5432 user=rep_user password=&#x5B;pass] application_name=sv2'\r\nrecovery_target_timeline = 'latest'\r\ntrigger_file = 'C:\\\\\\pgsql\\\\failover-trigger'\r\nrecovery_end_command = ''\r\n<\/pre>\n<p style=\"margin-bottom:2em;\">\npostgresql\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3057\u3001\u30ed\u30b0\u3067\u6b63\u5e38\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2\u53f0\u69cb\u6210 host\uff1asv1\u3000ip\uff1a192.168.0.100\u3000\u7565\u79f0\uff1a\u30d7\u30e9\u30a4\u30de\u30ea host\uff1asv2\u3000ip\uff1a192.168.0.101\u3000\u7565\u79f0\uff1a\u30bb\u30ab\u30f3\u30c0\u30ea \u307e\u305a\u306f\u4e21\u30db\u30b9\u30c8\u306bPostgreSQL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u672c\u624b\u9806\u4f5c\u6210\u6642\u306fVe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,14],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-postgresql","category-windows"],"views":5827,"_links":{"self":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":18,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":1761,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions\/1761"}],"wp:attachment":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}