Ad Widget

Collapse

Migrate from 2.08 to 3.0.2 on a new server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fbasurte
    Junior Member
    • Jul 2013
    • 10

    #1

    Migrate from 2.08 to 3.0.2 on a new server

    Hi all

    I am trying to migrate Zabbix version on a new server. I followe this steps
    - Install new Centos 7
    - Install binaries 3.02 on new server
    - dump DB from all zabbix 2.08 server
    - copy DB to new server
    - Import DB to new server
    - Start Zabbix server on new server

    My results are that I couldn't login using LDAP. So I change authentication_type to '0'.
    I can login but I see everything in 'text' mode, and I receive SQL error on every attempt to see items, maps, etc.

    My question is if I did it correctly, or I need to upgarde it, step by step 2.0 -->2.2-->2.4 --> 3.0
    Thanks in advance for any help or light on this

    kiko.-
  • Linwood
    Senior Member
    • Dec 2013
    • 398

    #2
    My GUESS is that you have some inconsistencies in your setup that you should explore before worrying about the upgrade version per se; I THINK you can go from 2.x to 3.x in one step.

    But the LDAP issue and lack of database login sound more like a mis-match in your zabbix_server.conf file between the new and old and database. My suggestion is take that file, and also any web server setup files, and compare the old and new. What you probably want to do with the main config files is use the one that came with the newer distribution, but go through each and every setting in it, and compare to the old, and migrate them. That way you'll have settings and documentation matching the current system, but will have updated it to be consistent. Especially check user/password for the database, and perhaps test those outside of zabbix to make sure they work with the restored database from the shell sql prompt (whatever flavor you use). Same with the web server -- ldap could be done there as well as in zabbix, but make sure the new server's setup for the zabbix folder/directory in the web configs looks the same on the new (+/- any version specific stuff like a change in php versions).

    I think if this was zabbix version related you would get a more zabbix specific error, this sounds like os/db issues.

    Comment

    • fbasurte
      Junior Member
      • Jul 2013
      • 10

      #3
      Thanks

      Thanks Linwood

      I will check your suggestions. PHP version is obviously a different one, as I am moving from an old openSuse to last CentOS distro

      Comment

      • fbasurte
        Junior Member
        • Jul 2013
        • 10

        #4
        additional info

        In case it helps you to have a better sight of the problem....If I drop the zabbix DB create, and create it again using create.sql.gz, then everything is shown OK

        So, it seems to be a DB problem. However I don't know where to begin looking at. The old DB is running for 6 years OK, I just made a mysqldump (with no error), SCP top the new server and import it with this command:

        mysql -u zabbix -p zabbix < /tmp/zabbix_db_dump
        Then I started the zabbix-server with the result you know
        Thanks again

        Comment

        • fbasurte
          Junior Member
          • Jul 2013
          • 10

          #5
          example of SQL error

          When browsing into the GUI, this is an sql error example:

          Error in query [SELECT DISTINCT t.triggerid,t.priority,t.state,t.description,t.error,t.value,t.lastchange,t.expr ession FROM triggers t,functions f,items i,hosts_groups hg WHERE NOT EXISTS (SELECT NULL FROM functions f,items i,hosts_groups hgg LEFT JOIN rights r ON r.id=hgg.groupid AND r.groupid IN ('7','12') WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.hostid=hgg.hostid GROUP BY i.hostid HAVING MAX(permission)<'2' OR MIN(permission) IS NULL OR MIN(permission)=0) AND hg.hostid=i.hostid AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND hg.groupid BETWEEN '2' AND '10' AND NOT EXISTS (SELECT NULL FROM functions f,items i,hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.hostid=h.hostid AND (i.status<>0 OR h.status<>0)) AND t.status=0 AND t.value='1' AND t.flags IN ('0','4') ORDER BY t.lastchange DESC] [Unknown column 't.state' in 'field list']

          Comment

          • Linwood
            Senior Member
            • Dec 2013
            • 398

            #6
            Yes, it is sounding more like it didn't upgrade the database.

            If you query the database directly for:

            select * from dbversion

            it may indicate what version it thinks it is, whether it even tried to update.

            I looked (as you probably already have) and it does say:

            Direct upgrade to Zabbix 3.0 is possible from Zabbix 2.4.x, 2.2.x and 2.0.x.

            You are starting the zabbix_server service before you try to hit it from the web? I think that performs the actual upgrade of the database.

            You might also run through the setup web (did it automatically?) to see if it's happy, or is that also a place it fails? I think you can get to it manually by http://server/zabbix/setup.php if it's not coming up. Since the first parts of it do not require database access at all, if it's not coming up you might look at the web server setup and/or the frontend software location and ownership. If it comes up, it will at least check prerequisites, etc.

            Though I suspect you already did that with the initial 3.0.2 install, so that might not be helpful.

            Sorry... beyond what I know to suggest. Hopefully someone else will drop in.

            Comment

            • fbasurte
              Junior Member
              • Jul 2013
              • 10

              #7
              dbversion
              MariaDB [zabbix]> select * from dbversion;
              +-----------+----------+
              | mandatory | optional |
              +-----------+----------+
              | 3000000 | 3000000 |
              +-----------+----------+
              1 row in set (0.00 sec)

              ======================================
              I tried again http://server/zabbix/setup.php and I was able to go thrugh the setup process, but in text mode, no image is displayed
              However before imprting DB, I was able to go through the setup process correctly (seeing all the images)

              Comment

              • Linwood
                Senior Member
                • Dec 2013
                • 398

                #8
                I'm clueless, sorry.

                How important is your history? A painful possibility it start with 3.0 fresh, import all the templates (and key in value maps and macros, which is tedious), then import your hosts and start fresh. You'd obviously also need actions, scripts, etc. all done by hand as well.

                Or... can you do a copy of the old system to experiment with, and try upgrading it in place? If it upgrades and runs successfully on 3.0.x, you at least then have a copy to compare against the new 3.0.x system with a known good database, and maybe can look closely to see where it is running amok.

                But, apologies for lack of any real help, hopefully someone else will drop by.

                Comment

                • fbasurte
                  Junior Member
                  • Jul 2013
                  • 10

                  #9
                  is possible that column name has changed in version 3?
                  For instance, I see that table trigger has a column called 'status', but frontend is quering for 'state' column
                  C below

                  =======================================

                  Error in query [SELECT DISTINCT t.triggerid,t.priority,t.state,t.description,t.error,t.value,t.lastchange,t.expr ession FROM triggers t,functions f,items i,hosts_groups hg WHERE NOT EXISTS (SELECT NULL FROM functions f,items i,hosts_groups hgg LEFT JOIN rights r ON r.id=hgg.groupid AND r.groupid IN ('7','12') WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.hostid=hgg.hostid GROUP BY i.hostid HAVING MAX(permission)<'2' OR MIN(permission) IS NULL OR MIN(permission)=0) AND hg.hostid=i.hostid AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND hg.groupid BETWEEN '2' AND '10' AND NOT EXISTS (SELECT NULL FROM functions f,items i,hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.hostid=h.hostid AND (i.status<>0 OR h.status<>0)) AND t.status=0 AND t.value='1' AND t.flags IN ('0','4') ORDER BY t.lastchange DESC] [Unknown column 't.state' in 'field list']
                  ==========================================
                  MariaDB [zabbix]> select * from triggers limit 5;
                  +-----------+-------------+-----------------------------------------------------+-----+--------+-------+----------+------------+----------+-------+------------+------+-------------+-------+
                  | triggerid | expression | description | url | status | value | priority | lastchange | comments | error | templateid | type | value_flags | flags |
                  +-----------+-------------+-----------------------------------------------------+-----+--------+-------+----------+------------+----------+-------+------------+------+-------------+-------+
                  | 10001 | {12135}<20M | Lack of free memory on server {HOSTNAME} | | 0 | 0 | 3 | 0 | | | NULL | 0 | 0 | 0 |

                  Comment

                  • herta
                    Senior Member
                    • Sep 2011
                    • 101

                    #10
                    When I migrated to a new server, I first moved the entire zabbix environment as it was. I verified that it ran properly and then started the upgrade process.

                    There are differences in the database structure between versions and going about it as described will ensure that the database gets upgraded as well.
                    Last edited by herta; 13-05-2016, 12:01.

                    Comment

                    • fbasurte
                      Junior Member
                      • Jul 2013
                      • 10

                      #11
                      Thank you Herta!!


                      Apart from moving manual scripts that I developed, could you help me on identifying the 'zabbix environment' folders/files to be copied to the new server.

                      I am a bit lost on this. I don't know if I need to overwrite php files, etc...and the order I must do the different actions

                      Thanks again for your patience

                      Comment

                      • herta
                        Senior Member
                        • Sep 2011
                        • 101

                        #12
                        That question is less trivial than you might think.

                        We're on Ubuntu and I initially installed 2.2 from Ubuntu packages. The directory layout was different from a previous 1.8 installation which I installed from Zabbix packages.

                        CentOS also seems to offer its own packages. See https://www.zabbix.com/documentation..._from_packages (click the correct version beneath the 'Zabbix Documentation' header).

                        If you are unsure about where everything is, perhaps you can install the same version as you currently have on your new server. When it is up and running, replace the database by a restore of your old one and fixe the config files (I'd assume they'd be in /etc/zabbix).

                        Then upgrade from there.

                        Comment

                        • fbasurte
                          Junior Member
                          • Jul 2013
                          • 10

                          #13
                          Tahnks to everybody, for the help,
                          I repeated the process:
                          - stop zabix-server
                          - drop DB
                          - create DB
                          - add zabbix user
                          - import DB
                          - start zabbix-server

                          I am now able to see the frontend OK
                          :-)

                          The weird thing now is that it says that zabbix server is not running, although it is running. And I see nothing extrabge in zabbix-server log.
                          May be something related to the port

                          Comment

                          Working...