Ad Widget

Collapse

Zabbix new install 6.0 LTS with a 5.0 LTS DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Diego_K
    Junior Member
    • Dec 2023
    • 2

    #1

    Zabbix new install 6.0 LTS with a 5.0 LTS DB

    Hello,

    I have a Zabbix with version 5.0.xx LTS (Server and DB) and i would like to make a new set of Debian 12 servers with Zabbix 6.0.xx LTS but i want to keep the historical from the data base. is it possible to transfer the DB ? i´ve tried to find documentation but i only found the general upgrade or the new installation.

    thanks for the help

  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    Here's how I do it for mysql.
    1. Build new server with a mysql version that is upgrade compatible with the old server. Usually this is 1 version, say 5.6 to 5.7. Don't start mysql yet.
    2. Briefly stop your old zabbix server and mysql. Copy the entire /var/lib/mysql directory structure to the new server. I use rsync. You can restart the DB and Zabbix when the copy finishes. You can also use whatever backup/restore procedure you like, I use innodbackuipex from Percona, so I can make a "cold" backup of the database while zabbix is running.
    3. Start mysql and ensure that the mysql upgrade is successful.
    See https://dev.mysql.com/doc/refman/8.0/en/upgrading.html

    Then you can install the new zabbix server bits, don't do the DB creation. When you start zabbix, it should do the upgrade process from 5.0 to 6.0.

    If it doesn't work, you try again as often as you like, you haven't done anything to the old server.

    Comment

    • Diego_K
      Junior Member
      • Dec 2023
      • 2

      #3
      Originally posted by LenR
      Here's how I do it for mysql.
      1. Build new server with a mysql version that is upgrade compatible with the old server. Usually this is 1 version, say 5.6 to 5.7. Don't start mysql yet.
      2. Briefly stop your old zabbix server and mysql. Copy the entire /var/lib/mysql directory structure to the new server. I use rsync. You can restart the DB and Zabbix when the copy finishes. You can also use whatever backup/restore procedure you like, I use innodbackuipex from Percona, so I can make a "cold" backup of the database while zabbix is running.
      3. Start mysql and ensure that the mysql upgrade is successful.
      See https://dev.mysql.com/doc/refman/8.0/en/upgrading.html

      Then you can install the new zabbix server bits, don't do the DB creation. When you start zabbix, it should do the upgrade process from 5.0 to 6.0.

      If it doesn't work, you try again as often as you like, you haven't done anything to the old server.
      If it doesn't work, you try again as often as you like, you haven't done anything to the old server.[/QUOTE]



      Thanks for your answer i really appreciate it.

      sorry for asking again, after the 3 steps and i run the install the new zabbix 6.0 server bits, if i don´t do the DB creation (because i already did the copy on the step 2) , how the system will update the DB from version 5.0 to 6.0 ? or that happens when i start Zabbix? i´m lost there because this is precisely the step i´m not sure what to do , i don´t know if the DB won´t be compatible and all the Historical will be gone.

      Thanks again and have a great week.

      D​

      Comment

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

        #4
        Originally posted by Diego_K
        sorry for asking again, after the 3 steps and i run the install the new zabbix 6.0 server bits, if i don´t do the DB creation (because i already did the copy on the step 2) , how the system will update the DB from version 5.0 to 6.0 ? or that happens when i start Zabbix? i´m lost there because this is precisely the step i´m not sure what to do , i don´t know if the DB won´t be compatible and all the Historical will be gone.

        D​
        yes... during first startup of new server, it connects to your "old" db, finds it to be of old version, converts it to new, adds, whatever is needed, and then your new server is ready... Nothing is lost...

        Comment

        • LenR
          Senior Member
          • Sep 2009
          • 1005

          #5
          The secret is in a zabbix db table called dbversion that contains one row :-)

          Comment

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

            #6
            Originally posted by LenR
            The secret is in a zabbix db table called dbversion that contains one row :-)
            Not only... For example, if you create a DB with "new" schema, and upload data from "old"... it will accept it, as all the tables and columns exist and you will have old version number in that table... But upon starting of conversions, it fails, saying that some tables already exist (the ones that conversion is supposed to create, but you have already created them before..) and cannot continue. That's why it is important to have your "old" db schema in place, that corresponds to version...

            Comment

            Working...