Ad Widget

Collapse

Database grows strongly after upgrade to Zabbix 6

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • d.roeper
    Junior Member
    • Feb 2022
    • 17

    #16
    Hello,

    i have the solution

    Code:
    ALTER TABLE IF EXISTS history_str RENAME TO history_str_old;
    CREATE TABLE history_str (LIKE history_str_old INCLUDING DEFAULTS INCLUDING CONSTRAINTS EXCLUDING INDEXES);
    ALTER TABLE history_str ADD PRIMARY KEY (itemid,clock,ns);
    SELECT create_hypertable('history_str', 'clock', chunk_time_interval => 86400);
    INSERT INTO history_str SELECT * FROM history_str_old;
    DROP TABLE IF EXISTS history_str_old;
    CREATE INDEX history_str_1 on history_str (itemid,clock);
    ALTER TABLE history_str owner to zabbix;
    
    ALTER TABLE IF EXISTS history RENAME TO history_old;
    CREATE TABLE history (LIKE history_old INCLUDING DEFAULTS INCLUDING CONSTRAINTS EXCLUDING INDEXES);
    ALTER TABLE history ADD PRIMARY KEY (itemid,clock,ns);
    SELECT create_hypertable('history', 'clock', chunk_time_interval => 86400);
    INSERT INTO history SELECT * FROM history_old;
    DROP TABLE IF EXISTS history_old;
    CREATE INDEX history_1 on history (itemid,clock);
    ALTER TABLE history owner to zabbix;
    
    ALTER TABLE IF EXISTS history_text RENAME TO history_text_old;
    CREATE TABLE history_text (LIKE history_text_old INCLUDING DEFAULTS INCLUDING CONSTRAINTS EXCLUDING INDEXES);
    ALTER TABLE history_text ADD PRIMARY KEY (itemid,clock,ns);
    SELECT create_hypertable('history_text', 'clock', chunk_time_interval => 86400);
    INSERT INTO history_text SELECT * FROM history_text_old;
    DROP TABLE IF EXISTS history_text_old;
    CREATE INDEX history_text_1 on history_text (itemid,clock);
    ALTER TABLE history_text owner to zabbix;
    
    ALTER TABLE IF EXISTS history_log RENAME TO history_log_old;
    CREATE TABLE history_log (LIKE history_log_old INCLUDING DEFAULTS INCLUDING CONSTRAINTS EXCLUDING INDEXES);
    ALTER TABLE history_log ADD PRIMARY KEY (itemid,clock,ns);
    SELECT create_hypertable('history_log', 'clock', chunk_time_interval => 86400);
    INSERT INTO history_log SELECT * FROM history_log_old;
    DROP TABLE IF EXISTS history_log_old;
    CREATE INDEX history_log_1 on history_log (itemid,clock);
    ALTER TABLE history_log owner to zabbix;
    After that, the server log are clean and my Database are unter 120GB
    Last edited by d.roeper; 18-07-2022, 09:15.

    Comment

    Working...