Ad Widget

Collapse

Zabbix down connection to database failed: [1040] Too many connections

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Qais
    Junior Member
    • May 2021
    • 4

    #1

    Zabbix down connection to database failed: [1040] Too many connections

    Hi,

    I installed Zabbix on Centos8 and installed apache and Mariadb, all things work ok and I added 10 different types of nods and started collecting information suddenly the Zabbix stops I tried to reconfigure Zabbix_Server.conf file with enhancement parameters and I reloaded Mysql Privileges and restarts the Zabbix Server nothing works with me

    when I checked the log file I found this

    Cannot connect to the database. Exiting...
    14036:20210531:191951.160 server #182 started [unreachable poller #46]
    14037:20210531:191951.171 server #183 started [unreachable poller #47]
    14038:20210531:191951.187 server #184 started [unreachable poller #48]
    14041:20210531:191951.198 server #187 started [trapper #1]
    14046:20210531:191951.215 server #192 started [trapper #6]
    14044:20210531:191951.216 server #190 started [trapper #4]
    14047:20210531:191951.225 server #193 started [trapper #7]
    14045:20210531:191951.226 server #191 started [trapper #5]
    14048:20210531:191951.233 server #194 started [trapper #8]
    14043:20210531:191951.262 server #189 started [trapper #3]
    14039:20210531:191951.277 server #185 started [unreachable poller #49]
    14049:20210531:191951.286 server #195 started [trapper #9]
    14042:20210531:191951.288 server #188 started [trapper #2]
    14015:20210531:191951.295 [Z3001] connection to database 'zabbix' failed: [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 95 "Operation not supported"
    14015:20210531:191951.295 database is down: reconnecting in 10 seconds
    14050:20210531:191951.295 server #196 started [trapper #10]
    14004:20210531:191951.299 [Z3001] connection to database 'zabbix' failed: [1040] Too many connections
    14004:20210531:191951.299 Cannot connect to the database. Exiting...
    14040:20210531:191951.305 server #186 started [unreachable poller #50]
    14035:20210531:191951.317 server #181 started [unreachable poller #45]
    13851:20210531:191951.338 One child process died (PID:14007,exitcode/signal:1). Exiting ...
    13851:20210531:191951.767 syncing trend data...
    13851:20210531:191951.768 syncing trend data done
    13851:20210531:191951.768 Zabbix Server stopped. Zabbix 5.0.11 (revision 15ae5548ce).


    I need advice on how to troubleshoot this problem
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Hi, database says that you have too many connections. Are you sure you haven't overly configured your Zabbix server, like the number of trappers or unreachable pollers?

    If you know your Zabbix server is configured appropriately, you need to search for increasing the connection limit on your MariaDB.

    Markku

    Comment

    • james.cook000@gmail.com
      Member
      • Apr 2018
      • 49

      #3
      Hi Qais,

      What is in the database logs?

      If in the zabbix configuration the number of server processes that connect to the database system is larger that the maximum allowed connections to the database (i.e. History Syncers, Pollers etc...).

      To resolve this you can do:
      • Lower the number of configured processes connecting to the database.
      • Increase the max connections allowed to the database (MySQL /etc/my.cnf max_connections)
      • Use database connection pooling software (PostgreSQL we use pgbouncer, MySQL im not sure of as we dont use this database)
      As a note it may be more efficient to use connection pooling when there are a large number of connections (example details: https://stackoverflow.blog/2020/10/1...ection-pooling)

      Cheers
      James

      Comment

      • Qais
        Junior Member
        • May 2021
        • 4

        #4
        Thank you, James, Markku

        The reason was that I configured the number of trappers and unreachable pollers as you said.
        The issue solved by increasing the max connection number in the MySQL configuration file.

        again thanks for your response,

        Comment

        • jolalla
          Member
          • May 2021
          • 45

          #5
          Hello all

          I need your help. Please.

          Install a new zabbix server with the following features:
          Centos7
          Zabbix version: 5.0
          Mysql: 15.1 Distrib: 10.4.19 Maria DB
          PHP 7.2

          it's a fresh install so i have nothing to back up because i haven't added any hosts yet.
          On the centos server create a partition for the DB (/ data). I followed the instructions on how to change the mysql database directory. I validated it with @@ datadir inside mysql and it was correct in:
          : / data / mysql

          But the web interface is not working for me now. shows me error:

          Database error
          No such file or directory

          I went to the php.ini configuration file located at:
          /etc/opt/remi/php72/php.ini and there add the new socket path and it looks like this:


          pdo_mysql.default_socket=/data/mysql/mysql.sock


          mysqli.default_socket =/data/mysql/mysql.sock



          And restart the service httpd But it still doesn't work for me, what else should I modify?

          Thank you very much for your help.

          I leave here the error message that gives me and how is the directory of the DB after having changed it to the new partition.
          Attached Files

          Comment


          • Markku
            Markku commented
            Editing a comment
            I'd recommend you to write a new post instead of replying to this "Too many connections" thread, maybe you get more hints that way.

            --> Go to the Zabbix Help page and click the "New Topic" button on top of the list.

            Markku
        • jolalla
          Member
          • May 2021
          • 45

          #6

          you're right Markku.. Thanks, I'll create a new topic and excuse me.

          Comment


          • Markku
            Markku commented
            Editing a comment
            No problem, and unfortunately I'm not able to help in your particular issue.

            Markku
        Working...