{"id":614,"date":"2020-11-17T17:58:26","date_gmt":"2020-11-17T09:58:26","guid":{"rendered":"https:\/\/www.yinyubo.cn\/?p=614"},"modified":"2022-05-17T09:30:30","modified_gmt":"2022-05-17T01:30:30","slug":"timescaledb-2","status":"publish","type":"post","link":"https:\/\/www.yinyubo.com\/?p=614","title":{"rendered":"timescaledb\u5347\u7ea7"},"content":{"rendered":"<h1>\u80cc\u666f<\/h1>\n<p>\u4f7f\u7528docker\u5b89\u88c5\u7684timescaledb\u4e0epostgresQL\u6570\u636e\u5e93\u3002\u76ee\u524d\u6211\u4eec\u9700\u8981\u5347\u7ea7docker\u955c\u50cf\u4ee5\u53ca\u76ee\u524d\u6b63\u5728\u4f7f\u7528\u7684\u6570\u636e\u5e93\u3002\u5355\u7eaf\u7684\u66f4\u6362docker\u955c\u50cf\u662f\u884c\u4e0d\u901a\u7684\uff0c\u8bf7\u6309\u7167\u5982\u4e0b\u65b9\u5f0f\u8fdb\u884c\u5347\u7ea7\u3002<br \/>\n\u539f\u7248\u672c\u662ftimescale\/timescaledb-postgis:1.4.0-pg11<br \/>\n\u65b0\u7248\u672c\u662ftimescale\/timescaledb-postgis:1.7.4-pg11<\/p>\n<h1>\u64cd\u4f5c\u6b65\u9aa4<\/h1>\n<p>1.\u62c9\u53d6\u6700\u65b0\u7684\u955c\u50cf<\/p>\n<pre class=\"lang:python decode:true\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker pull timescale\/timescaledb:1.7.4-pg11\n<\/code><\/pre>\n<p>2.\u68c0\u67e5\u8001\u5bb9\u5668\u6302\u8f7d\u7684\u6570\u636e\u76ee\u5f55<\/p>\n<pre class=\"lang:python decode:true  EnlighterJSRAW\" data-enlighter-language=\"golang\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">$ docker inspect timescaledb --format='{{range .Mounts }}{{.Source}}{{end}}'\n\/path\/to\/data<\/code><\/pre>\n<p>3.\u5220\u9664\u8001\u5bb9\u5668<\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker stop timescaledb\ndocker rm timescaledb<\/code><\/pre>\n<p>4.\u4f7f\u7528\u6302\u8f7d\u7684\u6570\u636e\u76ee\u5f55\u548c\u65b0\u62c9\u53d6\u7684\u955c\u50cf\uff0c\u521b\u5efa\u65b0\u5bb9\u5668<\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker run -v \/path\/to\/data:\/var\/lib\/postgresql\/data -d --name timescaledb -p 5432:5432 timescale\/timescaledb\n<\/code><\/pre>\n<p><span style=\"color: #ff0000;\"><strong>5.\u66f4\u65b0template1\u7684timescaledb\u63d2\u4ef6\uff08\u91cd\u8981\uff09<\/strong><\/span><br \/>\n\u5982\u679c\u4e0d\u66f4\u65b0<span style=\"color: #ff0000;\"><strong>template1<\/strong><span style=\"color: #000000;\">\u7684\u8bdd\uff0c\u540e\u7eed\u521b\u5efa\u7684\u6240\u6709database\u8fd8\u662f\u8001\u76841.4.0\u63d2\u4ef6<\/span><\/span><\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker exec -it timescaledb bash\nsu postgres\npsql template1\nALTER EXTENSION timescaledb UPDATE;<\/code><\/pre>\n<p><span style=\"color: #ff0000;\"><strong>6.\u66f4\u65b0\u5df2\u7ecf\u5b58\u5728\u7684database\u7684timescaledb\u63d2\u4ef6\uff08\u91cd\u8981\uff09<\/strong><\/span><br \/>\n\u5bf9\u6240\u6709\u201c\u5df2\u7ecf\u5b58\u5728\u7684\u6570\u636e\u5e93\u201d\u8fdb\u884c\u63d2\u4ef6\u66f4\u65b0\uff0c\u4e0d\u7136\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u8fde\u63a5\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<br \/>\nERROR: could not access file &#8220;$libdir\/timescaledb-1.4.2&#8221;: No such file or directory<\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker exec -it timescaledb bash\nsu postgres\npsql \u5df2\u7ecf\u5b58\u5728\u7684\u6570\u636e\u5e93\nALTER EXTENSION timescaledb UPDATE;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u4f7f\u7528docker\u5b89\u88c5\u7684timescaledb\u4e0epostgresQL\u6570\u636e\u5e93\u3002\u76ee\u524d\u6211\u4eec\u9700\u8981\u5347\u7ea7docker\u955c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-k8s","category-influxdb"],"_links":{"self":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=614"}],"version-history":[{"count":1,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/614\/revisions"}],"predecessor-version":[{"id":869,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/614\/revisions\/869"}],"wp:attachment":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}