Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19164

update zabbix from 2.4 to 5.2

    XMLWordPrintable

Details

    • Incident report
    • Status: Confirmed
    • Trivial
    • Resolution: Unresolved
    • 5.0.9
    • None
    • Server (S)

    Description

      Hello,
      I've upgraded from 2.4 to 5.0.9
      Upgrade to port the server from Debian wheezy to Debian buster.
      Algorithm:
      1) dump database on server_old
      2) installing Zabbix 5.0.9 on Server_new with a new empty reference database
      3) creating a new empty database on the Server_new server, importing data with a script
      # cat /root/zabbix_import.sh
      #/bin/bash
      MUSER="zabbix"
      MPASS="zabbix"
      MDB="zabbix"

      LIST=$(ls /root/full/)

      cd /root/full/
      #echo $LIST

      for i in $LIST
      do
      {{ echo "import $i"}}
      {{ zcat $i | mysql -u$MUSER -p$MPASS $MDB}}
      {{ echo "import done!"}}
      done

      4) During the import process, the host_inventory table could not be imported, due to an error
      {{Row size too large (> 8126). Changing some columns to }}
      {{TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored }}
      inline.
      It was solved by adding the line SET SESSION innodb_strict_mode = 0; to the data import script

      5) zabbix did not start. According to the logs, there is a problem with the encoding. Changed encoding using utf8_convert.sql procedure
      DELIMITER $$
      CREATE PROCEDURE zbx_convert_utf8 (
      )
      BEGIN
      declare cmd varchar(255) default "";
      declare finished integer default 0;
      {{declare cur_command cursor for }}
      SELECT command
      FROM
      {{ (/* This 'select' statement deals with 'text' type columns to prevent}}
      {{ their automatic conversion into 'mediumtext' type.}}
      {{ The goal is to produce statements like}}
      {{ ALTER TABLE zabbix.hosts MODIFY COLUMN description text CHARACTER SET utf8 COLLATE utf8_bin not null;}}
      {{ */}}
      {{ SELECT table_name AS sort1,}}
      {{ 'A' AS sort2,}}
      {{ CONCAT('ALTER TABLE ', table_schema, '.', table_name,}}
      {{ ' MODIFY COLUMN ', column_name, ' ', column_type,}}
      {{ ' CHARACTER SET utf8 COLLATE utf8_bin',}}
      {{ case}}
      {{ when column_default is null then ''}}
      {{ else concat(' default ', column_default, ' ')}}
      {{ end,}}
      {{ case}}
      {{ when is_nullable = 'no' then ' not null '}}
      {{ else ''}}
      {{ end,}}
      {{ ';') AS command}}
      {{ FROM information_schema.columns}}
      {{ WHERE table_schema = @ZABBIX_DATABASE }}
      {{ AND column_type = 'text'}}
      {{ UNION}}
      {{ /* This 'select' statement deals with setting character set and collation for}}
      {{ each table and converting varchar fields on a per-table basis.}}
      {{ It is necessary to process all tables (even those with numeric-only columns)}}
      {{ otherwise in future Zabbix upgrades text (e.g. varchar) columns may be added}}
      {{ to these tables or numeric columns can be turned into text ones and}}
      {{ the old character set/collation can reappear again.}}
      {{ The goal is to produce statements like}}
      {{ ALTER TABLE zabbix.hosts CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;}}
      {{ */}}
      {{ SELECT table_name AS sort1,}}
      {{ 'B' AS sort2,}}
      {{ CONCAT('ALTER TABLE ', table_schema, '.', table_name,}}
      {{ ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;') AS command}}
      {{ FROM information_schema.tables}}
      {{ WHERE table_schema = @ZABBIX_DATABASE) s}}
      /* Sorting is important: 'MODIFY COLUMN' statements should precede 'CONVERT TO' ones
      {{ for each table. */}}
      ORDER BY sort1, sort2;
      declare continue handler for not found set finished = 1;
      open cur_command;
      cmd_loop: loop
      fetch cur_command into cmd;
      if finished = 1 then
      leave cmd_loop;
      end if;
      SET @value = cmd;
      PREPARE stmt FROM @value;
      EXECUTE stmt;
      DEALLOCATE PREPARE stmt;
      end loop cmd_loop;
      close cur_command;
      END$$
      DELIMITER ;

      script usage
      MariaDB [mysql]> use zabbix
      MariaDB [zabbix]> SET @ZABBIX_DATABASE = 'zabbix';
      MariaDB [zabbix]> CALL zbx_convert_utf8();
      MariaDB [zabbix]> set innodb_strict_mode = ON;
      MariaDB [zabbix]> drop procedure zbx_convert_utf8;

      zabbix started up and works. But the logs periodically have errors
      6) compared the structure of the resulting database with the database created during the installation of a clean installation of zabbix 5.2 fixed minor differences in structure.

      Now zabbix works, but sometimes errors appear in the logs.
      zabbix_server [1223]: ERROR file:dbconfig.c,line:10344 Something impossible has just happened.
      {{ 1223:20210324:112438.718 === Backtrace: ===}}
      {{ 1223:20210324:112438.718 13: /usr/sbin/zabbix_server: trapper #3 [processing data](zbx_backtrace+0x3f) [0x56163c2321be]}}
      {{ 1223:20210324:112438.718 12: /usr/sbin/zabbix_server: trapper #3 [processing data](+0x1adc62) [0x56163c20dc62]}}
      {{ 1223:20210324:112438.718 11: /usr/sbin/zabbix_server: trapper #3 [processing data](DCget_status+0x4a) [0x56163c20e2dd]}}
      {{ 1223:20210324:112438.718 10: /usr/sbin/zabbix_server: trapper #3 [processing data](+0x81bba) [0x56163c0e1bba]}}
      {{ 1223:20210324:112438.718 9: /usr/sbin/zabbix_server: trapper #3 [processing data](+0x81f41) [0x56163c0e1f41]}}
      {{ 1223:20210324:112438.718 8: /usr/sbin/zabbix_server: trapper #3 [processing data](+0x829af) [0x56163c0e29af]}}
      {{ 1223:20210324:112438.718 7: /usr/sbin/zabbix_server: trapper #3 [processing data](+0x82edc) [0x56163c0e2edc]}}
      {{ 1223:20210324:112438.718 6: /usr/sbin/zabbix_server: trapper #3 [processing data](trapper_thread+0x276) [0x56163c0e3176]}}
      {{ 1223:20210324:112438.718 5: /usr/sbin/zabbix_server: trapper #3 [processing data](zbx_thread_start+0x37) [0x56163c240f15]}}
      {{ 1223:20210324:112438.718 4: /usr/sbin/zabbix_server: trapper #3 [processing data](MAIN_ZABBIX_ENTRY+0xb2d) [0x56163c0a974f]}}
      {{ 1223:20210324:112438.718 3: /usr/sbin/zabbix_server: trapper #3 [processing data](daemon_start+0x2ff) [0x56163c231dca]}}
      {{ 1223:20210324:112438.718 2: /usr/sbin/zabbix_server: trapper #3 [processing data](main+0x2f5) [0x56163c0a8bd7]}}
      {{ 1223:20210324:112438.718 1: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f01d33ee09b]}}
      {{ 1223:20210324:112438.718 0: /usr/sbin/zabbix_server: trapper #3 [processing data](_start+0x2a) [0x561}}

      {{ How to resolve an issue with errors}}

      Attachments

        Activity

          People

            zabbix.dev Zabbix Development Team
            alexeym aleksey mishagin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: