Ad Widget

Collapse

Zabbix database split from main server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limbooface
    Member
    • Jun 2016
    • 77

    #1

    Zabbix database split from main server

    So currently I have zabbix server, web and database all in stalled on the same vm. It looks like my database cannot coupe with this anymore. So I have decided to build a separate database vm.

    On my current centos 7.4 build I have the below installed.

    zabbix-server-mysql-4.4.10-1.el7.x86_64
    zabbix-web-4.4.10-1.el7.noarch
    zabbix-release-4.4-1.el7.noarch
    zabbix-web-mysql-4.4.10-1.el7.noarch
    zabbix-agent-4.4.10-1.el7.x86_64
    zabbix-get-4.4.10-1.el7.x86_64
    zabbix-proxy-mysql-4.4.10-1.el7.x86_64


    Is it better to install a standalone mysql database and which version do you recommend?
    Or do I just install the above mysql rpms for mariadb on the new server and then just import my backup of the database?.
    Then I would give the host full permissions on the database and then change the various configs?

    What do you recommend is the best approach?
  • eulah.dach
    Junior Member
    • Mar 2021
    • 1

    #2
    is your idea the same with this one https://www.zabbix.com/forum/zabbix-...t-the-database ?

    Comment

    • limbooface
      Member
      • Jun 2016
      • 77

      #3
      I have managed to split my database and below are the steps required if any one need help with this
      I am using the latest mariadb 10.5.9



      Installation of Mariadb



      chmod +x mariadb_repo_setup

      sudo ./mariadb_repo_setup


      yum install MariaDB-server


      systemctl start mariadb.service


      mysql_secure_installation




      Creation of zabbix table and user
      mysql -uroot -p
      password
      mysql> create database zabbix character set utf8 collate utf8_bin;
      mysql> create user zabbix@localhost identified by 'password';
      mysql> grant all privileges on zabbix.* to zabbix@localhost;
      mysql> quit;



      Make sure you take a backup of your zabbix database to import into the new one with the command below

      mysql -u username -p new_database < data-dump.sql





      To check the size of the new zabbix db to see it is copying the data to the correct database. My copy took a day.


      SELECT table_schema "databases name", sum(data_length + index_length)/1024/1024 "DВ size in MB" FROM information_schema.TABLES GROUP BY table_schema;



      Grant your zabbix server full permission to the new database

      grant all on zabbix.*to zabbix@'ip of zabbix server'identified by 'passwordyouset';


      On the zabbix server


      zabbix.conf.php
      /etc/zabbix/web/zabbix.conf.php



      $DB['TYPE'] = 'MYSQL';
      $DB['SERVER'] = 'localhost';
      $DB['PORT'] = '0';
      $DB['DATABASE'] = 'zabbix';
      $DB['USER'] = 'zabbix';
      $DB['PASSWORD'] = 'password';




      to



      $DB['TYPE'] = 'MYSQL';
      $DB['SERVER'] = 'ip of new zabbix db';
      $DB['PORT'] = '3306';
      $DB['DATABASE'] = 'zabbix';
      $DB['USER'] = 'zabbix';
      $DB['PASSWORD'] = 'password';




      zabbix_server.conf
      /etc/zabbix/zabbix_server.conf




      ### Option: DBHost
      # Database host name.
      # If set to localhost, socket is used for MySQL.
      # If set to empty string, socket is used for PostgreSQL.
      #
      # Mandatory: no
      # Default:
      DBHost=localhost

      to

      ### Option: DBHost
      # Database host name.
      # If set to localhost, socket is used for MySQL.
      # If set to empty string, socket is used for PostgreSQL.
      #
      # Mandatory: no
      # Default:
      #DBHost=localhost

      DBHost=ip of new database

      Then
      systemctl restart mariadb on the new server
      systemctl restart zabbix-server on the zabbix server

      remember to stop the mariadb and disable the service on the zabbix server

      Comment

      • limbooface
        Member
        • Jun 2016
        • 77

        #4
        I do have a query if anyone knows in the old setup in /etc/my.cnf i set

        ​​​​​​max_connections = 700
        innodb_buffer_pool_size=5G

        But in this new database I get
        mysql: unknown variable 'max_connections=700'

        Would anyone know what I should set this too? Or do I even need this?

        This command use to work but does not anymore
        Check max used connection mariadb

        mysqladmin -uzabbix -p extended-status | grep Max_used_connections

        Comment

        Working...