Ad Widget

Collapse

Help Restoring a Zabbix Server without the History & Trend Tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • morton_a
    Junior Member
    • Apr 2022
    • 3

    #1

    Help Restoring a Zabbix Server without the History & Trend Tables

    Hi,

    I was running Zabbix 5.0 on a Hyper-V VM and there is some sort of error where the history tables are stored. We want to restore the database to a new server we have setup utilizing the same versions of applications - this has already been prepared. This isn't important to us for this server, so we backed up the database without the history tables with no problem using the below command and separately backed up the config files:

    mysqldump -uroot -p --single-transaction --ignore-table=zabbix.history --ignore-table=zabbix.history_uint --ignore-table=zabbix.history_text --ignore-table=zabbix.history_log --ignore-table=zabbix.history_str --ignore-table=zabbix.trends --ignore-table=zabbix.trends_uint zabbix | gzip > zabbix_backup.sql.gz

    When we restore the database - minus the trend and history tables - we get errors in the GUI about the history tables. How do we rebuild the history tables, as I have only seen it referenced in procedures across guides, but can't seem to find the actual process.

    Any help would be much appreciated.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    As you did not back up those tables, then they are just missing now... You probably can find table creation scripts in /usr/share/doc/zabbix-server-mysql*/create.sql.gz ... At least installation manual says so..

    On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
    # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
    Zabbix is being downloaded over 4 000 000 times every year for a reason. Download and install Zabbix for free and try it yourself!

    Comment

    • morton_a
      Junior Member
      • Apr 2022
      • 3

      #3
      Hi cyber, thank you for your response. Yes, I managed to resolve this by exporting with the following commands and it all worked correctly when re-imported:


      Code:
      mysqldump --no-data zabbix > zabbix_backup.sql
      
      mysqldump --no-create-info --ignore-table=zabbix.history --ignore-table=zabbix.history_uint --ignore-table=zabbix.history_text --ignore-table=zabbix.history_log --ignore-table=zabbix.history_str --ignore-table=zabbix.trends --ignore-table=zabbix.trends_uint zabbix >> zabbix_backup.sql
      Thanks again.

      Comment

      Working...