Ad Widget

Collapse

How to make a full backup?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kiri
    Junior Member
    • Mar 2019
    • 4

    #1

    How to make a full backup?

    Hi! Long story short: I have a Zabbix Server running on version 3.4 and I need to update it to 4.0, therefore, a backup is mandatory.
    The problem is, I don't have a single clue on how to do it since before last friday I had never EVER used or tried Zabbix or CentOS (the OS we're using is CentOS 7).

    I'm a fast learner, and now I know how to use the main Zabbix features and everything I've learned so far (and that was a lot for a week, actually) came from Zabbix documentation and CentOS tutorials on the internet.
    So, I know I won't get a full tutorial here (but I would appreaciate it), but could someone please point me to some tutorial/documentation/link/book teaching me EVERYTHING I need to:

    1. Make a full backup ON CENTOS (with hosts, templates, triggers, etc) so if I mess up I may rollback (commands and explanation would be nice)
    2. If I do mess up, restore the old version of Zabbix


    Two more things: I'm extremely sorry if I sound rude, I'm just a desperate guy trying to learn and do his work hehe
    And also, will I need to update EVERY SINGLE AGENT or will Zabbix Server 4 work with Zabbix Agent 3.4 hosts?

    Thank you VERY VERY much for your attention and (hopefully) patience.
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hello and welcome to Zabbix forums!

    Yes, before upgrade a full backup is needed. Once you have started the upgrade process, there is no way of going back if the database conversion has been started. Backup is the only way then.

    You need to backup your whole database. They way how to do it depends on the database engine you have (MySQL, PostgreSQL, anything else). Then more precise suggestions can be mage for each. But regardless of the engine a full backup will do.

    Additionally you may want to backup your /etc/zabbix directory just in case.

    When all is done, open two SSH sessions to your Zabbix where in one you do "tail -f zabbix_server.log" while in the other run the commands to update Zabbix packages or compile the sources (whichever method has been used to install Zabbix).

    Update all Zabbix components, and then start zabbix-server service. Carefully watch as the log file rolls, see for any errors and then search how to fix them, if any. Otherwise you end up with half updated database and two choices - fix it or recover the backup.

    You don't need to update agents at the same time, they will work with the new version with no issues. You can later at your own pace update them if you wish to use any of the agent items introduced in 4.0 though.

    Good luck updating

    Comment

    • Kiri
      Junior Member
      • Mar 2019
      • 4

      #3
      Originally posted by ingus.vilnis
      Hello and welcome to Zabbix forums!

      Yes, before upgrade a full backup is needed. Once you have started the upgrade process, there is no way of going back if the database conversion has been started. Backup is the only way then.

      You need to backup your whole database. They way how to do it depends on the database engine you have (MySQL, PostgreSQL, anything else). Then more precise suggestions can be mage for each. But regardless of the engine a full backup will do.

      Additionally you may want to backup your /etc/zabbix directory just in case.

      When all is done, open two SSH sessions to your Zabbix where in one you do "tail -f zabbix_server.log" while in the other run the commands to update Zabbix packages or compile the sources (whichever method has been used to install Zabbix).

      Update all Zabbix components, and then start zabbix-server service. Carefully watch as the log file rolls, see for any errors and then search how to fix them, if any. Otherwise you end up with half updated database and two choices - fix it or recover the backup.

      You don't need to update agents at the same time, they will work with the new version with no issues. You can later at your own pace update them if you wish to use any of the agent items introduced in 4.0 though.

      Good luck updating
      Hi, thanks for replying! I've got some questions...
      I have a MySQL database (It's actually MariaDB, but as far as I know, it's the same, right?).
      Should I look into how to make a backup and recover Zabbix with the said backup? Could you point towards a guide or something?
      And how should I backup /etc/Zabbix? As mentioend, I'm literally an infant at Linux for now hehe

      Why should I use two different SSH sessions for my server? Is it to keep track on the log? (I'm just assuming that because of of the "tail" command")

      My agents are probably using 3.x or older, won't I have any issues? I read that I should change something about LogFiles on the server if I'm using differente server and agent versions.

      Comment

      • ingus.vilnis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2014
        • 908

        #4
        mysqldump is the command you should use.

        This manual looks good enough describing the basics of it. https://www.linode.com/docs/database...ql-or-mariadb/

        Code:
        cp /etc/zabbix /etc/zabbix.backup
        This should do for that directory. You can remove that backup directory later after everything is successful.

        Those two SSH sessions are just to show you instantly how the DB upgrade is happening. Otherwise users often start the service and then have no clue at all why it is failing, and in the worst case start executing absolutely wrong steps to troubleshoot it.

        Leave the agents, should be all fine there.

        But before you start, have a reading in the upgrade notes too.


        Comment

        • Kiri
          Junior Member
          • Mar 2019
          • 4

          #5
          Originally posted by ingus.vilnis
          mysqldump is the command you should use.

          This manual looks good enough describing the basics of it. https://www.linode.com/docs/database...ql-or-mariadb/

          Code:
          cp /etc/zabbix /etc/zabbix.backup
          This should do for that directory. You can remove that backup directory later after everything is successful.

          Those two SSH sessions are just to show you instantly how the DB upgrade is happening. Otherwise users often start the service and then have no clue at all why it is failing, and in the worst case start executing absolutely wrong steps to troubleshoot it.

          Leave the agents, should be all fine there.

          But before you start, have a reading in the upgrade notes too.
          https://www.zabbix.com/documentation...rade_notes_400
          Thank you very much! I spent the past few hours reading about it and you've been great to my learning!

          Just a few more things so I don't need to open another topic...
          I set up an Azure Lab so I could test the upgrade process before trying for real, and yesterday I actually updated Zabbix 3.4.9 to 4.0 JUST by using yum upgrade and it surprisingly worked...
          Now, I only had a local host (server and agent on the same machine) and nothing to loose, but... Could this have worked on the real server, which have about 100 hosts? I mean, it might have been just luck, but is this a (very risk) way of doing it?

          Also, are agents actually meant to be compatible with newer servers? Is this an actual feature or just something that happens?

          And one last thing (I'm sorry for taking so much of your time), I tried to install an agent on my Windows desktop, I set up everything as it should but Zabbix didn't recognize my desktop... I guess I may have to use NAT to allow my windows to communicate with my server, right?

          Comment

          • ingus.vilnis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Mar 2014
            • 908

            #6
            Well Upgrade is kind of supposed to work without issues and it has nothing to do with luck. It upgrades successfully if there are no errors in the database or any additional modifications like database structure changes manually added etc.

            About 100 hosts is not a big system at all but sure the larger the database, the more time it may take to upgrade. During this time of course Zabbix is not available.

            Agents of older versions are indeed compatible with newer versions of Zabbix server, that is officially supported. Not really vice versa though but there are edge cases. However if you have Zabbix proxies (looks like you don't at the moment) then they would also need to be upgraded right after the Zabbix server, otherwise they would not work (properly or at all).

            About agents on windows. Most likely your Zabbix server in the cloud can not reach to your Windows host that is behind some routers and firewalls elsewhere. But that is not a problem if 1) your agent gan get through to your Zabbix server and 2) all items you monitor on that Windows are with type "Zabbix agent (active)", otherwise it will not work. And 3) the Hostname setting in zabbix_agentd.conf file on Windows must exactly match the Host name field for this host as defined in Zabbix web interface. Otherwise the agent will not be recognized. IP and DNS names won't matter in this case. And last but not least 4) the ServerActive setting in agent config file must be set to the exact IP or DNS name of your Zabbix server (not the HTTP URL).

            Start with these steps. NAT will also do but I think for cloud like environments you will not want to configure NAT per each of your servers behind other networks.

            Hope this helps.

            Comment

            • Kiri
              Junior Member
              • Mar 2019
              • 4

              #7
              Originally posted by ingus.vilnis
              Well Upgrade is kind of supposed to work without issues and it has nothing to do with luck. It upgrades successfully if there are no errors in the database or any additional modifications like database structure changes manually added etc.

              About 100 hosts is not a big system at all but sure the larger the database, the more time it may take to upgrade. During this time of course Zabbix is not available.

              Agents of older versions are indeed compatible with newer versions of Zabbix server, that is officially supported. Not really vice versa though but there are edge cases. However if you have Zabbix proxies (looks like you don't at the moment) then they would also need to be upgraded right after the Zabbix server, otherwise they would not work (properly or at all).

              About agents on windows. Most likely your Zabbix server in the cloud can not reach to your Windows host that is behind some routers and firewalls elsewhere. But that is not a problem if 1) your agent gan get through to your Zabbix server and 2) all items you monitor on that Windows are with type "Zabbix agent (active)", otherwise it will not work. And 3) the Hostname setting in zabbix_agentd.conf file on Windows must exactly match the Host name field for this host as defined in Zabbix web interface. Otherwise the agent will not be recognized. IP and DNS names won't matter in this case. And last but not least 4) the ServerActive setting in agent config file must be set to the exact IP or DNS name of your Zabbix server (not the HTTP URL).

              Start with these steps. NAT will also do but I think for cloud like environments you will not want to configure NAT per each of your servers behind other networks.

              Hope this helps.
              Got it! Thank you very much for your attention, it surely helped me a lot!
              I'll take some time to fully understand every step for the update process and I'll try it again, if you don't hear me crying for help until friday, it means everything went well hehe
              Again, thank you for your time and kindness!

              Comment

              • ingus.vilnis
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Mar 2014
                • 908

                #8
                Sure, have fun learning and in the end tell how it went.

                Cheers!

                Comment

                • jackzcooper
                  Junior Member
                  • Jan 2021
                  • 1

                  #9
                  I saw a guide somewhere that could help you. I'll look for it

                  Comment

                  Working...