Ad Widget

Collapse

UTF8 and zabbix 1.8 upgrade

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ataylo13
    Senior Member
    • Feb 2007
    • 122

    #1

    UTF8 and zabbix 1.8 upgrade

    I have seen some posts about the length of time the UTF conversion takes. I am hesitant to make the update in my distributed environment due to not knowing how long this upgrade could take. I have seen posts of a 20 hour conversion on a 3G database. My zabbix DB is ~110G so would this take days? If so there has to be a better (faster) way. Any help/insight here would be greatly appreciated.
    Version : 1.8.8
    Current Configuration 1 Master and 3 Child Nodes
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    You may skip historical tables having no text data: history, history_uint, trends, trends_uint. This would make transition much faster.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • ataylo13
      Senior Member
      • Feb 2007
      • 122

      #3
      Thanks for the tip. I will give that a try.
      Version : 1.8.8
      Current Configuration 1 Master and 3 Child Nodes

      Comment

      • ataylo13
        Senior Member
        • Feb 2007
        • 122

        #4
        Alexei, I noticed the upgrade script mentions it is not inteded for distributed monitoring databases... what does that mean? Should I not run it on the script on the master and child nodes?
        Version : 1.8.8
        Current Configuration 1 Master and 3 Child Nodes

        Comment

        • richlv
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2005
          • 3112

          #5
          1. if you do not need other scripts than the basic latin one, you can skip utf-8 conversion completely;

          2. the bash script is not intended and tested for distributed setup databases. it will most likely miss some required changes.
          the sql patches, official upgrade path, should support such databases, though. any problems with that should be reported (hint - test upgrade)
          Zabbix 3.0 Network Monitoring book

          Comment

          • ataylo13
            Senior Member
            • Feb 2007
            • 122

            #6
            thanks for the quick reply richlv. I was assuming that I did not need it, but I was unsure what if anything internal to zabbix relied on it.
            Version : 1.8.8
            Current Configuration 1 Master and 3 Child Nodes

            Comment

            • Samd
              Junior Member
              • Nov 2010
              • 2

              #7
              upgrade script and UTF

              Perhaps something like this will help for speeding up the UTF conversion, based on the suggestions in this thread. I will try tomorrow if the conversion takes too long.

              "upgrade" script



              =====================
              Replace this section:
              =====================


              # ******************** 2

              echo "Converting database to UTF8"

              timer start conversion to UTF8
              echo "ALTER DATABASE CHARACTER SET utf8;" | $MYSQL $MYSQLPARAMS
              for i in $(echo "show tables;" | $MYSQL -N $MYSQLPARAMS); do
              echo "... converting table $i"
              echo "ALTER TABLE $i CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" | $MYSQL $MYSQLPARAMS
              done
              echo -n " ... "
              timer stop conversion to UTF8

              ==========
              With this:
              ==========


              # ******************** 2

              excluded=( history history_uint trends trends_uint )

              function elementExists()
              {

              if [ -z "$1" ]
              then
              return
              fi

              for i in ${excluded[@]}
              do
              if [ $i == $1 ]
              then
              return 1
              fi
              done

              return 0
              }


              echo "Converting database to UTF8"

              timer start conversion to UTF8
              echo "ALTER DATABASE CHARACTER SET utf8;" | $MYSQL $MYSQLPARAMS
              for i in $(echo "show tables;" | $MYSQL -N $MYSQLPARAMS); do
              elementExists $i
              x=$?
              if [ $x == "0" ]
              then
              echo "... converting table $i"
              echo "ALTER TABLE $i CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" | $MYSQL $MYSQLPARAMS
              fi
              done
              echo -n " ... "
              timer stop conversion to UTF8

              Comment

              • richlv
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2005
                • 3112

                #8
                oh, well... a shorter (i'm lazy ) version of skipping history & trends tables for that script was committed to svn. uncommenting single line should allow to leave all history & trends tables unconverted
                Zabbix 3.0 Network Monitoring book

                Comment

                • boy01
                  Junior Member
                  • Dec 2007
                  • 24

                  #9
                  Originally posted by richlv
                  oh, well... a shorter (i'm lazy ) version of skipping history & trends tables for that script was committed to svn. uncommenting single line should allow to leave all history & trends tables unconverted
                  Did you test it?
                  Code:
                  > # skiptables="history\|history_log\|history_str\|history_text\|history_uint\|trends\|trends_uint
                  >
                  104c107
                  < for i in $(echo "show tables;" | $MYSQL -N $MYSQLPARAMS); do
                  ---
                  > for i in $(echo "show tables;" | $MYSQL -N $MYSQLPARAMS | grep -v "${skiptables:-not_skipping_any_tables}"); do
                  Maybe it does what _you_ want, but it surely isn't safe.
                  Including "history" skips also history_log, history_str,... (grep -v).
                  Or am I missing something here?
                  (There's missing "-char from end of skiptables-variable)

                  Comment

                  • richlv
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Oct 2005
                    • 3112

                    #10
                    Originally posted by boy01
                    Did you test it?
                    that would be a lot of effort, eh ?
                    attempted to improve.
                    if you have the time, evaluation of the latest version would be appreciated, thanks
                    Zabbix 3.0 Network Monitoring book

                    Comment

                    • boy01
                      Junior Member
                      • Dec 2007
                      • 24

                      #11
                      Originally posted by richlv
                      if you have the time, evaluation of the latest version would be appreciated, thanks
                      I upgraded my installation on CentOS 5.5 x86_64 w/ your script.
                      Worked ok, but maybe you should give better help for usage?
                      Fg:
                      ./upgrade --user=xxxx --password=xxxxxxx zabbix

                      I don't know what will happen if db is missing from parameters.
                      Could the script do it's job to mysql db...?

                      Comment

                      • richlv
                        Senior Member
                        Zabbix Certified Trainer
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Oct 2005
                        • 3112

                        #12
                        Originally posted by boy01
                        Worked ok, but maybe you should give better help for usage?
                        Fg:
                        ./upgrade --user=xxxx --password=xxxxxxx zabbix
                        well... that would be quite an encouragement to use it, given that it's not really supported...

                        Originally posted by boy01
                        I don't know what will happen if db is missing from parameters.
                        Could the script do it's job to mysql db...?
                        it should pass through index & utf8 parts not doing anything, then fail on the patch step
                        Zabbix 3.0 Network Monitoring book

                        Comment

                        • boy01
                          Junior Member
                          • Dec 2007
                          • 24

                          #13
                          Originally posted by richlv
                          well... that would be quite an encouragement to use it, given that it's not really supported...
                          If you don't think one should use the script maybe you shouldn't
                          include the script in the zabbix tar file, but separate downloadable file...

                          Comment

                          Working...