{"id":12696,"date":"2024-05-06T17:42:50","date_gmt":"2024-05-06T09:42:50","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=12696"},"modified":"2024-06-19T10:24:15","modified_gmt":"2024-06-19T02:24:15","slug":"harbor-db%e5%ae%b9%e5%99%a8%e7%89%88%e6%9c%acpostgresql%e6%96%ad%e7%94%b5%e5%90%8e%e9%87%8d%e5%90%af%e7%8a%b6%e6%80%81%e4%b8%80%e7%9b%b4%e6%98%afrestarting","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/12696","title":{"rendered":"\u5357\u5927\u901a\u7528GCDW\u6280\u672f\u6808 harbor-db\u5bb9\u5668\u7248\u672cpostgresql\u65ad\u7535\u540e\u91cd\u542f\u72b6\u6001\u4e00\u76f4\u662fRestarting"},"content":{"rendered":"<p>harbor\u5185\u7f6e\u4e86postgresql 13\uff0c\u56e0\u4e3a\u5176\u8fd0\u884c\u5728\u5bb9\u5668docker\u5185\uff0c\u53d1\u751f\u6545\u969c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u5df2\u7ecf\u4e0d\u80fd\u901a\u8fc7docker run\u767b\u5f55\u4e86\u3002\u672c\u6587\u5c31\u662f\u5728\u5bbf\u4e3b\u673a\u5f02\u5e38\u65ad\u7535\u540e\u53d1\u751f\u6545\u969c\uff0c\u5bfc\u81f4\u670d\u52a1\u65e0\u6cd5\u542f\u52a8\uff0cinvalid primary checkpoint record\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2c454b7cdae\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2c454b7cdae\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E7%8E%B0%E8%B1%A1\" >Phenomenon<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E5%88%86%E6%9E%90%E8%BF%87%E7%A8%8B\" >\u5206\u6790\u8fc7\u7a0b<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E6%9F%A5%E7%9C%8Bpostgresql%E7%9A%84%E6%97%A5%E5%BF%97\" >\u67e5\u770bpostgresql\u7684\u65e5\u5fd7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E6%9F%A5%E6%89%BEpg_resetwal%E5%B7%A5%E5%85%B7\" >\u67e5\u627epg_resetwal\u5de5\u5177<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#pg_resetwal%E7%BB%B4%E4%BF%AE\" >pg_resetwal\u7ef4\u4fee<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E9%87%8D%E5%90%AFharbor%E6%9C%8D%E5%8A%A1\" >\u91cd\u542fharbor\u670d\u52a1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E5%A6%82%E6%9E%9C%E6%8A%A5replication_checkpoint_has_wrong_magic_324508367_instead_of_307747550\" >\u5982\u679c\u62a5replication checkpoint has wrong magic 324508367 instead of 307747550<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/12696\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E7%8E%B0%E8%B1%A1\"><\/span>Phenomenon<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5bbf\u4e3b\u673a\u65ad\u7535\u91cd\u542f\u4e86\uff0c\u518d\u6b21\u542f\u52a8harbor\u540e\uff0c\u53d1\u73b0harbor-db\u72b6\u6001\u4e00\u76f4\u662fRestarting...<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@mdw harbor]# docker-compose  ps\nNAME                IMAGE                                COMMAND                  SERVICE             CREATED             STATUS                            PORTS\nharbor-core         goharbor\/harbor-core:v2.8.2          \"\/harbor\/entrypoint.\u2026\"   core                2 minutes ago       Up 7 seconds (health: starting)\nharbor-db           goharbor\/harbor-db:v2.8.2            \"\/docker-entrypoint.\u2026\"   postgresql          2 minutes ago       <span class=\"has-inline-color has-luminous-vivid-orange-color\">Restarting <\/span>(1) 49 seconds ago\n\u3002\u3002\u3002\u3002\u3002<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%86%E6%9E%90%E8%BF%87%E7%A8%8B\"><\/span>\u5206\u6790\u8fc7\u7a0b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8Bpostgresql%E7%9A%84%E6%97%A5%E5%BF%97\"><\/span>\u67e5\u770bpostgresql\u7684\u65e5\u5fd7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53d1\u73b0invalid primary checkpoint record \u9519\u8bef<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>tail  \/var\/log\/harbor\/postgresql.log\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.515 UTC &#91;1] LOG:  starting PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.0, 64-bit\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.515 UTC &#91;1] LOG:  listening on IPv4 address \"0.0.0.0\", port 5432\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.515 UTC &#91;1] LOG:  listening on IPv6 address \"::\", port 5432\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.517 UTC &#91;1] LOG:  listening on Unix socket \"\/run\/postgresql\/.s.PGSQL.5432\"\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.521 UTC &#91;8] LOG:  database system was interrupted; last known up at 2024-04-23 09:46:52 UTC\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.597 UTC &#91;8] LOG:  <span class=\"has-inline-color has-luminous-vivid-orange-color\">invalid primary checkpoint record<\/span>\nMay  6 15:54:30 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:30.597 UTC &#91;8] PANIC:  could not locate a valid checkpoint record\nMay  6 15:54:31 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:31.419 UTC &#91;1] LOG:  startup process (PID 8) was terminated by signal 6: Aborted\nMay  6 15:54:31 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:31.419 UTC &#91;1] LOG:  aborting startup due to startup process failure\nMay  6 15:54:31 172.22.0.1 postgresql&#91;234137]: 2024-05-06 07:54:31.463 UTC &#91;1] LOG:  database system is shut down<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E6%89%BEpg_resetwal%E5%B7%A5%E5%85%B7\"><\/span>\u67e5\u627epg_resetwal\u5de5\u5177<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u73b0\u6210\u7684PG13, \u90a3\u4e48\u53ef\u4ee5\u4ece\u5bb9\u5668\u5185\u90e8\u770b\u770b\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>&#91;root@mdw harbor]# find \/ -name pg_resetwal\n\/var\/lib\/docker\/overlay2\/967167c094b2eedecfac2671c11a307414b15d23ace87880cfc24151934afed9\/diff\/etc\/alternatives\/pg_resetwal\n\/var\/lib\/docker\/overlay2\/967167c094b2eedecfac2671c11a307414b15d23ace87880cfc24151934afed9\/diff\/usr\/bin\/pg_resetwal\n\/var\/lib\/docker\/overlay2\/967167c094b2eedecfac2671c11a307414b15d23ace87880cfc24151934afed9\/diff\/usr\/pgsql\/13\/bin\/pg_resetwal\n\/var\/lib\/docker\/overlay2\/de59cc480d55a185dba6a93723e38e31316735da79a62827a1c26e1a82517a0c\/merged\/etc\/alternatives\/pg_resetwal\n\/var\/lib\/docker\/overlay2\/de59cc480d55a185dba6a93723e38e31316735da79a62827a1c26e1a82517a0c\/merged\/usr\/bin\/pg_resetwal\n\/var\/lib\/docker\/overlay2\/de59cc480d55a185dba6a93723e38e31316735da79a62827a1c26e1a82517a0c\/merged\/usr\/pgsql\/13\/bin\/pg_resetwal<\/code><\/pre>\n\n\n\n<p>\u4ece\u51e0\u4e2a\u91cc\u627e\u80fd\u7528\u7684\uff0c\u4e00\u4e9b\u662flink \u4e14\u62a5\u9519\u7684\u5c31\u7b97\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"pg_resetwal%E7%BB%B4%E4%BF%AE\"><\/span>pg_resetwal\u7ef4\u4fee<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u8be5\u5de5\u5177\u4e0d\u80fd\u7528root\u8fd0\u884c\uff0c\u6240\u4ee5\u8981\u5207\u6362\u5230\u968f\u610f\u4e00\u4e2a\u7528\u6237\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su - XXXXX<\/code><\/pre>\n\n\n\n<p>pg\u7684\u672c\u5730\u6302\u8f7d\u6587\u4ef6\u76ee\u5f55\uff0c\u53ef\u4ee5\u5728harbor\u7684docker-compose.yml\u91cc\u627e\u5230<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>  postgresql:\n    image: goharbor\/harbor-db:v2.8.2\n    container_name: harbor-db\n    restart: always\n    cap_drop:\n      - ALL\n    cap_add:\n      - CHOWN\n      - DAC_OVERRIDE\n      - SETGID\n      - SETUID\n    volumes:\n      - <span class=\"has-inline-color has-luminous-vivid-orange-color\">\/data\/database<\/span>:\/var\/lib\/postgresql\/data:z<\/code><\/pre>\n\n\n\n<p>\u8be5\u76ee\u5f55\u73b0\u6709\u7684\u6743\u9650\u7559\u4e00\u4e0b\uff0c\u7136\u540e\u6539\u6210\u6211\u4eec\u5207\u6362\u7684\u7528\u6237<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>chown -R XXX:XXX \/data\/database<\/code><\/pre>\n\n\n\n<p>\u8fd0\u884c\u4fee\u590d\u547d\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>XXXX\/pg_resetwal -f \/data\/database\/pg13\/<\/code><\/pre>\n\n\n\n<p>\u524d\u9762\u627e\u5230\u7684\u5de5\u5177\uff0c\u5982\u679c\u5f53\u524d\u7528\u6237\u6ca1\u6709\u6743\u9650\uff0c\u53ef\u4ee5\u5728root\u4e0b\u590d\u5236\u4e00\u4efd\u8fc7\u6765\uff0c\u672c\u5730\u8fd0\u884c\u3002<\/p>\n\n\n\n<p>\u4fee\u590d\u540e\uff0c\u8bb0\u5f97\u5c06\u76ee\u5f55\u5c5e\u4e3b\u6062\u590d<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>chown -R OLDXXX:OLDXXX \/data\/database<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%87%8D%E5%90%AFharbor%E6%9C%8D%E5%8A%A1\"><\/span>\u91cd\u542fharbor\u670d\u52a1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compost up -d<\/code><\/pre>\n\n\n\n<p>\u786e\u8ba4\u670d\u52a1\u662f\u5426\u5df2\u7ecf\u6b63\u5e38\u4e86<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A6%82%E6%9E%9C%E6%8A%A5replication_checkpoint_has_wrong_magic_324508367_instead_of_307747550\"><\/span>\u5982\u679c\u62a5replication checkpoint has wrong magic 324508367 instead of 307747550<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5c31\u628acheckpoing\u6587\u4ef6\u5220\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>cd \/data\/database\/pg13\/pg_logical\/\nrm replorigin_checkpoint<\/code><\/pre>\n\n\n\n<p>\u518d\u542f\u52a8\u770b\u770b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5bb9\u5668\u7248pg, \u56e0\u4e3a\u6ca1\u6709\u526f\u672c\uff0c\u6240\u4ee5\u6570\u636e\u5b89\u5168\u4f9d\u8d56\u672c\u5730\u78c1\u76d8\u6587\u4ef6\u3002\u5982\u679c\u8fd0\u884c\u5728\u4e3b\u673a\u4e0a\uff0c\u547d\u4ee4\u90fd\u662f\u73b0\u6210\u7684\uff0c\u53ef\u8fd0\u884c\u5728\u5bb9\u5668\u4e0a\uff0c\u5c31\u7ed5\u4e86\u51e0\u9053\u5f2f\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>harbor\u5185\u7f6e\u4e86postgresql 13\uff0c\u56e0\u4e3a\u5176\u8fd0\u884c\u5728\u5bb9\u5668docker\u5185\uff0c\u53d1\u751f\u6545\u969c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u5df2\u7ecf\u4e0d\u80fd\u901a\u8fc7docker run\u767b\u5f55\u4e86\u3002\u672c\u6587\u5c31\u662f\u5728\u5bbf\u4e3b\u673a\u5f02\u5e38\u65ad\u7535\u540e\u53d1\u751f\u6545\u969c\uff0c\u5bfc\u81f4\u670d\u52a1\u65e0\u6cd5\u542f\u52a8\uff0cinvalid primary checkpoint record\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12696","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=12696"}],"version-history":[{"count":4,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12696\/revisions"}],"predecessor-version":[{"id":12741,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12696\/revisions\/12741"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=12696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=12696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=12696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}