Ad Widget

Collapse

Migration from Zabbix 5 to Zabbix 6

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AyazP
    Junior Member
    • Jan 2020
    • 5

    #1

    Migration from Zabbix 5 to Zabbix 6


    Hi guys,

    I wanted to move from Zabbix 5 to Zabbix 6 as my old Zabbix 5 enviroment is on CentOS 7. So I made a backup of the DB, installed CentOS 9 Stream and installed Zabbix. I then restored the backup and then put the DB password into the zabbix-server.conf and now I'm getting permission issues connecting to the db.

    Zabbix GUI says permission denied, Zabbix server log says, [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local server through socket '/var/lib/mysql/mysql.sock'.

    In DB Zabbix

    MariaDB [zabbix]> show grants for zabbix@localhost;
    +---------------------------------------------------------------------------------------------------------------+
    | Grants for zabbix@localhost |
    +---------------------------------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO `zabbix`@`localhost` IDENTIFIED BY PASSWORD '**************' |
    | GRANT ALL PRIVILEGES ON `zabbix`.* TO `zabbix`@`localhost` |
    +---------------------------------------------------------------------------------------------------------------+

    What am I doing wrong?

    Thanks,

    Ayaz

  • Answer selected by vijayk at 22-09-2023, 14:18.
    vijayk
    Senior Member
    • May 2023
    • 305

    Did you tried with disable SELinux?

    Comment

    • vijayk
      Senior Member
      • May 2023
      • 305

      #2
      Its permission issue. Please refer the link https://stackoverflow.com/questions/...sql-mysql-sock

      Comment

      • AyazP
        Junior Member
        • Jan 2020
        • 5

        #3
        Originally posted by vijayk
        Its permission issue. Please refer the link https://stackoverflow.com/questions/...sql-mysql-sock
        How can I troubleshoot this? As it's a vanilla setup with a restored DB so unsure whereelse to look.

        I've also tried 127.0.0.1 and re-doing the permissions again and I still have the same problem.

        Comment

        • vijayk
          Senior Member
          • May 2023
          • 305

          #4
          Did you tried with disable SELinux?

          Comment

          • RichardvD
            Junior Member
            • Aug 2023
            • 14

            #5
            Also check if the DBName is correct in /etc/zabbix/zabbix_server.conf and if it's the same as the restored DB (check in /var/lib/mysql)

            Comment

            • AyazP
              Junior Member
              • Jan 2020
              • 5

              #6
              Originally posted by vijayk
              Did you tried with disable SELinux?
              This was the solution, SELinux was blocking zabbix-mysql.

              Now I am on issue number #2,

              6536:20230922:131447.775 Starting Zabbix Server. Zabbix 6.0.21 (revision 9624968c6b8).
              6536:20230922:131447.775 ****** Enabled features ******
              6536:20230922:131447.775 SNMP monitoring: YES
              6536:20230922:131447.775 IPMI monitoring: YES
              6536:20230922:131447.775 Web monitoring: YES
              6536:20230922:131447.775 VMware monitoring: YES
              6536:20230922:131447.775 SMTP authentication: YES
              6536:20230922:131447.775 ODBC: YES
              6536:20230922:131447.775 SSH support: YES
              6536:20230922:131447.775 IPv6 support: YES
              6536:20230922:131447.775 TLS support: YES
              6536:20230922:131447.775 ******************************
              6536:20230922:131447.775 using configuration file: /etc/zabbix/zabbix_server.conf
              6536:20230922:131447.777 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]
              6536:20230922:131447.778 cannot use database "zabbix": database is not a Zabbix database


              Do I just drop the users table?

              Thanks for the assistance once again

              Comment

              • cyber
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Dec 2006
                • 4806

                #7
                How can you drop something, that does not exist (according to the error message) ?

                And no, dropping any tables does not do any good. If you restored your v5 DB to new platform, then first start of the server should do all the upgrade tasks for you. Currently it seems, that it cannot find your DB... Make sure you point your server to correct DB, with correct user etc...

                Comment

                • RichardvD
                  Junior Member
                  • Aug 2023
                  • 14

                  #8
                  How did you perform your DB backup and restore?

                  What I used for 5 to 6 migration is:
                  mysqldump -u root -p <DB> --single-transaction > dbdump.sql
                  mysql -u root -p < dbdump.sql

                  This gives you a complete Zabbix DB. Then starting zabbix-server wil convert the version 5 DB to version 6.
                  Tip! Do a SET GLOBAL log_bin_trust_function_creators = 0;
                  alter table items engine='InnoDB';

                  Comment

                  • AyazP
                    Junior Member
                    • Jan 2020
                    • 5

                    #9
                    So after a few changes, I was able to get things working as far as the DB is being read and working in that kind of way. The GUI still says permission denied but in the zabbix_server.log I can see enteries of it firing alerts for issues etc.

                    It was a combination of SELinux Policies, DB Restore seemed to have missed the User table for a unknown reason.

                    Comment


                    • RichardvD
                      RichardvD commented
                      Editing a comment
                      Did you also adjust /etc/zabbix/web/zabbix.config.php voor DBName etc.?
                  Working...