{"id":96930,"date":"2024-10-20T13:33:18","date_gmt":"2024-10-20T05:33:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/96930\/"},"modified":"2024-10-20T13:33:19","modified_gmt":"2024-10-20T05:33:19","slug":"postgresql%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8d%e5%95%9f%e8%a9%b3%e8%a7%a3-postgres%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8d%e5%95%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/96930\/","title":{"rendered":"PostgreSQL\u6578\u64da\u5eab\u91cd\u555f\u8a73\u89e3 (postgres\u6578\u64da\u5eab\u91cd\u555f)"},"content":{"rendered":"<h1 id=\"postgresql%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8d%e5%95%9f%e8%a9%b3%e8%a7%a3-postgres%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8d%e5%95%9f-asBobCporT\">PostgreSQL\u6578\u64da\u5eab\u91cd\u555f\u8a73\u89e3 (postgres\u6578\u64da\u5eab\u91cd\u555f)<\/h1>\n<p>PostgreSQL\u662f\u4e00\u500b\u5f37\u5927\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u96a8\u8457\u6578\u64da\u5eab\u7684\u904b\u884c\uff0c\u53ef\u80fd\u6703\u51fa\u73fe\u9700\u8981\u91cd\u555f\u7684\u60c5\u6cc1\uff0c\u4f8b\u5982\u914d\u7f6e\u66f4\u6539\u3001\u6027\u80fd\u512a\u5316\u6216\u6545\u969c\u6392\u9664\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39PostgreSQL\u6578\u64da\u5eab\u7684\u91cd\u555f\u904e\u7a0b\u53ca\u5176\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e9%87%8d%e5%95%9fpostgresql%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-asBobCporT\">\u70ba\u4ec0\u9ebc\u9700\u8981\u91cd\u555fPostgreSQL\u6578\u64da\u5eab\uff1f<\/h2>\n<p>\u91cd\u555fPostgreSQL\u6578\u64da\u5eab\u7684\u539f\u56e0\u6709\u591a\u7a2e\uff0c\u4e3b\u8981\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u914d\u7f6e\u66f4\u6539\uff1a<\/strong>\u7576\u4fee\u6539\u4e86PostgreSQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u5982postgresql.conf\uff09\u5f8c\uff0c\u901a\u5e38\u9700\u8981\u91cd\u555f\u6578\u64da\u5eab\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/li>\n<li><strong>\u6027\u80fd\u512a\u5316\uff1a<\/strong>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u91cd\u555f\u6578\u64da\u5eab\u53ef\u4ee5\u91cb\u653e\u8cc7\u6e90\uff0c\u6539\u5584\u6027\u80fd\u3002<\/li>\n<li><strong>\u6545\u969c\u6392\u9664\uff1a<\/strong>\u5982\u679c\u6578\u64da\u5eab\u51fa\u73fe\u7570\u5e38\u884c\u70ba\uff0c\u91cd\u555f\u53ef\u80fd\u662f\u89e3\u6c7a\u554f\u984c\u7684\u4e00\u7a2e\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<h2 id=\"postgresql%e7%9a%84%e9%87%8d%e5%95%9f%e6%96%b9%e5%bc%8f-asBobCporT\">PostgreSQL\u7684\u91cd\u555f\u65b9\u5f0f<\/h2>\n<p>PostgreSQL\u63d0\u4f9b\u4e86\u5e7e\u7a2e\u91cd\u555f\u6578\u64da\u5eab\u7684\u65b9\u5f0f\uff0c\u4e3b\u8981\u5305\u62ec\uff1a<\/p>\n<h3 id=\"1-%e4%bd%bf%e7%94%a8pg_ctl%e5%91%bd%e4%bb%a4-asBobCporT\">1. \u4f7f\u7528pg_ctl\u547d\u4ee4<\/h3>\n<p>pg_ctl\u662f\u4e00\u500b\u7528\u65bc\u7ba1\u7406PostgreSQL\u4f3a\u670d\u5668\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u4f7f\u7528pg_ctl\u91cd\u555f\u6578\u64da\u5eab\u7684\u57fa\u672c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre><code>pg_ctl restart -D \/path\/to\/your\/data\/directory<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c<code>-D<\/code>\u9078\u9805\u6307\u5b9a\u4e86\u6578\u64da\u76ee\u9304\u7684\u8def\u5f91\u3002\u78ba\u4fdd\u5728\u57f7\u884c\u6b64\u547d\u4ee4\u6642\uff0c\u60a8\u64c1\u6709\u8db3\u5920\u7684\u6b0a\u9650\u3002<\/p>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8systemctl%e5%91%bd%e4%bb%a4-asBobCporT\">2. \u4f7f\u7528systemctl\u547d\u4ee4<\/h3>\n<p>\u5982\u679c\u60a8\u7684PostgreSQL\u662f\u4f5c\u70ba\u7cfb\u7d71\u670d\u52d9\u904b\u884c\u7684\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528systemctl\u547d\u4ee4\u4f86\u91cd\u555f\u6578\u64da\u5eab\uff1a<\/p>\n<pre><code>sudo systemctl restart postgresql<\/code><\/pre>\n<p>\u9019\u500b\u547d\u4ee4\u6703\u505c\u6b62\u4e26\u91cd\u65b0\u555f\u52d5PostgreSQL\u670d\u52d9\uff0c\u9069\u7528\u65bc\u5927\u591a\u6578Linux\u767c\u884c\u7248\u3002<\/p>\n<h3 id=\"3-%e4%bd%bf%e7%94%a8sql%e5%91%bd%e4%bb%a4-asBobCporT\">3. \u4f7f\u7528SQL\u547d\u4ee4<\/h3>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u901a\u904eSQL\u547d\u4ee4\u4f86\u91cd\u555f\u6578\u64da\u5eab\u3002\u96d6\u7136PostgreSQL\u672c\u8eab\u4e0d\u652f\u6301\u76f4\u63a5\u7684\u91cd\u555f\u547d\u4ee4\uff0c\u4f46\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u91cd\u65b0\u52a0\u8f09\u914d\u7f6e\uff1a<\/p>\n<pre><code>SELECT pg_reload_conf();<\/code><\/pre>\n<p>\u9019\u500b\u547d\u4ee4\u6703\u91cd\u65b0\u52a0\u8f09\u914d\u7f6e\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u5b8c\u5168\u91cd\u555f\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"%e9%87%8d%e5%95%9fpostgresql%e7%9a%84%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-asBobCporT\">\u91cd\u555fPostgreSQL\u7684\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u91cd\u555fPostgreSQL\u6578\u64da\u5eab\u4e4b\u524d\uff0c\u61c9\u8003\u616e\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li><strong>\u5099\u4efd\u6578\u64da\uff1a<\/strong>\u5728\u9032\u884c\u4efb\u4f55\u91cd\u555f\u64cd\u4f5c\u4e4b\u524d\uff0c\u5efa\u8b70\u5148\u5099\u4efd\u6578\u64da\uff0c\u4ee5\u9632\u6b62\u610f\u5916\u6578\u64da\u4e1f\u5931\u3002<\/li>\n<li><strong>\u901a\u77e5\u7528\u6236\uff1a<\/strong>\u5982\u679c\u6578\u64da\u5eab\u6b63\u5728\u88ab\u591a\u500b\u7528\u6236\u4f7f\u7528\uff0c\u61c9\u63d0\u524d\u901a\u77e5\u4ed6\u5011\uff0c\u4ee5\u907f\u514d\u696d\u52d9\u4e2d\u65b7\u3002<\/li>\n<li><strong>\u6aa2\u67e5\u65e5\u8a8c\uff1a<\/strong>\u91cd\u555f\u5f8c\uff0c\u6aa2\u67e5PostgreSQL\u7684\u65e5\u8a8c\u6587\u4ef6\uff0c\u4ee5\u78ba\u4fdd\u6c92\u6709\u932f\u8aa4\u767c\u751f\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-asBobCporT\">\u7e3d\u7d50<\/h2>\n<p>\u91cd\u555fPostgreSQL\u6578\u64da\u5eab\u662f\u4e00\u500b\u91cd\u8981\u7684\u7ba1\u7406\u4efb\u52d9\uff0c\u7121\u8ad6\u662f\u70ba\u4e86\u61c9\u7528\u914d\u7f6e\u66f4\u6539\u9084\u662f\u89e3\u6c7a\u6027\u80fd\u554f\u984c\u3002\u4e86\u89e3\u5982\u4f55\u6b63\u78ba\u5730\u91cd\u555f\u6578\u64da\u5eab\u4ee5\u53ca\u6ce8\u610f\u4e8b\u9805\uff0c\u53ef\u4ee5\u5e6b\u52a9\u60a8\u66f4\u6709\u6548\u5730\u7ba1\u7406\u6578\u64da\u5eab\u7cfb\u7d71\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u904b\u884c\u60a8\u7684PostgreSQL\u6578\u64da\u5eab\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684\u670d\u52d9\uff0c\u78ba\u4fdd\u60a8\u7684\u6578\u64da\u5eab\u904b\u884c\u9806\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u8a0ePostgreSQL\u6578\u64da\u5eab\u91cd\u555f\u7684\u6b65\u9a5f\u3001\u6ce8\u610f\u4e8b\u9805\u53ca\u6700\u4f73\u5be6\u8e10\uff0c\u78ba\u4fdd\u6578\u64da\u5b89\u5168\u8207\u7cfb\u7d71\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-96930","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=96930"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96930\/revisions"}],"predecessor-version":[{"id":96931,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96930\/revisions\/96931"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=96930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=96930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=96930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}