{"id":320439,"date":"2021-03-29T09:00:58","date_gmt":"2021-03-29T09:00:58","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320439"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320439","title":{"rendered":"\u041a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e Zabbix \u043d\u0430 TimescaleDB"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kb\/1t\/ej\/kb1tejvkg4hckea_7kl9twu6lj4.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/post\/513470\/\">\u041a\u0430\u043a \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Zabbix \u0441 MySQL \u043d\u0430 PostgreSQL \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c downtime<\/a> \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441 Zabbix \u0441 MySQL \u043d\u0430 PostgreSQL, \u0432\u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2014 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0411\u0414 \u043d\u0430 TimescaleDB, \u0442.\u043a. \u0440\u0430\u0434\u0438 \u043d\u0435\u0435 \u0432\u0441\u0435 \u0438 \u0437\u0430\u0442\u0435\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>  <\/p>\n<p>\u0423 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 <a href=\"https:\/\/www.zabbix.com\/documentation\/5.0\/manual\/appendix\/install\/timescaledb\" rel=\"nofollow noopener noreferrer\">\u043c\u0430\u043d\u0443\u0430\u043b<\/a>?<br \/>  \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0441\u043a\u0440\u044b\u0442\u0430 \u0432 downtime. \u0412 \u043c\u0430\u043d\u0443\u0430\u043b\u0435 \u044f\u0441\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<p>  <\/p>\n<blockquote><p>The migration of existing history and trend data may take a lot of time. Zabbix server and frontend must be down for the period of migration.<br \/>  <a name=\"habracut\"><\/a>  <\/p><\/blockquote>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>Zabbix 5.0<\/li>\n<li>\u0421\u0423\u0411\u0414 PostgreSQL 12<\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043f\u0430\u0442\u0447 <a href=\"https:\/\/www.zabbix.com\/documentation\/5.0\/manual\/installation\/upgrade_notes_500\" rel=\"nofollow noopener noreferrer\">ENABLING EXTENDED RANGE OF NUMERIC (FLOAT) VALUES<\/a><\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d TimescaleDB 1.7 (\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 2.0 \u043f\u043e\u043a\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042f \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u0438\u0433\u0440\u0430\u043b\u0441\u044f \u0441 \u0442\u044e\u043d\u0438\u043d\u0433\u043e\u043c PostgreSQL, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0441 PostgreSQL. \u0418\u0441\u043f\u044b\u0442\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u2014 24 CPU, 64 GB RAM. \u041d\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438 \u043c\u043e\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0432 ~350 \u0413\u0431 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0430 15 \u0447\u0430\u0441\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u0448\u0435\u043b \u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/docs.timescale.com\/latest\/getting-started\/migrating-data#same-db\" rel=\"nofollow noopener noreferrer\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e TimescaleDB \u043f\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0438 \u043d\u0430\u0448\u0435\u043b \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043a &quot;Faster Method&quot;:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0442\u0438\u043c \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0433\u0438\u043f\u0435\u0440\u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, history<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0430\u0440\u043e\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b<br \/> \n<pre><code class=\"pgsql\">CREATE TABLE history_new (LIKE history INCLUDING DEFAULTS INCLUDING CONSTRAINTS EXCLUDING INDEXES);<\/code><\/pre>\n<\/li>\n<li>\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0433\u0438\u043f\u0435\u0440\u0442\u0430\u0431\u043b\u0438\u0446\u0443<br \/> \n<pre><code class=\"pgsql\">SELECT create_hypertable('history_new', 'clock', chunk_interval =&gt; 86400);<\/code><\/pre>\n<\/li>\n<li>\u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 history \u0432 history_new<br \/> \n<pre><code class=\"pgsql\">INSERT INTO history_new SELECT * FROM history;<\/code><\/pre>\n<\/li>\n<li>\u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 history<br \/> \n<pre><code class=\"pgsql\">DROP TABLE IF EXISTS history;<\/code><\/pre>\n<\/li>\n<li>\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c history_new \u0432 history<br \/> \n<pre><code class=\"pgsql\">ALTER TABLE IF EXISTS history_new RENAME TO history;<\/code><\/pre>\n<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 (\u043a\u0430\u043a \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441\u0445\u0435\u043c\u044b \u0411\u0414 schema.sql)<br \/> \n<pre><code class=\"pgsql\">CREATE INDEX history_1 in history (itemid,clock);<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446:<\/p>\n<p>  <\/p>\n<ul>\n<li>history<\/li>\n<li>history_log<\/li>\n<li>history_str<\/li>\n<li>history_text<\/li>\n<li>history_uint<\/li>\n<li>trends<\/li>\n<li>trends_uint<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<br \/>  \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 github \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438:<br \/>  <a href=\"https:\/\/github.com\/niklep\/zabbix_timescaledb_scripts\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/niklep\/zabbix_timescaledb_scripts<\/a><\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 finish.sql \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0433\u0438\u043f\u0435\u0440\u0442\u0430\u0431\u043b\u0438\u0446\u044b TimescaleDB \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043d\u044f\u043b\u0430 5 \u0447\u0430\u0441\u043e\u0432, \u0447\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 15.<br \/>  PROFIT.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/549428\/\"> https:\/\/habr.com\/ru\/post\/549428\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kb\/1t\/ej\/kb1tejvkg4hckea_7kl9twu6lj4.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/post\/513470\/\">\u041a\u0430\u043a \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Zabbix \u0441 MySQL \u043d\u0430 PostgreSQL \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c downtime<\/a> \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441 Zabbix \u0441 MySQL \u043d\u0430 PostgreSQL, \u0432\u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2014 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0411\u0414 \u043d\u0430 TimescaleDB, \u0442.\u043a. \u0440\u0430\u0434\u0438 \u043d\u0435\u0435 \u0432\u0441\u0435 \u0438 \u0437\u0430\u0442\u0435\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>  <\/p>\n<p>\u0423 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 <a href=\"https:\/\/www.zabbix.com\/documentation\/5.0\/manual\/appendix\/install\/timescaledb\" rel=\"nofollow noopener noreferrer\">\u043c\u0430\u043d\u0443\u0430\u043b<\/a>?<br \/>  \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0441\u043a\u0440\u044b\u0442\u0430 \u0432 downtime. \u0412 \u043c\u0430\u043d\u0443\u0430\u043b\u0435 \u044f\u0441\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<p>  <\/p>\n<blockquote><p>The migration of existing history and trend data may take a lot of time. Zabbix server and frontend must be down for the period of migration.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320439","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320439"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320439\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}