Ad Widget

Collapse

Redhat 7 : connection to database 'zabbix' failed: [1040] Too many connections

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syndeysider
    Senior Member
    • Oct 2013
    • 115

    #1

    Redhat 7 : connection to database 'zabbix' failed: [1040] Too many connections

    Zabbix 2.4.3
    MySQL 5.6.23
    Redhat 7

    Latest Dell Servers 64GB RAM
    PCIe-SSD's etc.


    mysqld.log
    2015-02-06 10:56:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

    2015-02-06 10:56:17 38435 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5106)
    2015-02-06 10:56:17 38435 [Warning] Buffered warning: Changed limits: max_connections: 214 (requested 1000)
    2015-02-06 10:56:17 38435 [Warning] Buffered warning: Changed limits: table_cache: 400 (requested 2048)


    2015-02-06 10:56:17 38435 [Note] Plugin 'FEDERATED' is disabled.
    2015-02-06 10:56:17 38435 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2015-02-06 10:56:17 38435 [Note] InnoDB: The InnoDB memory heap is disabled
    2015-02-06 10:56:17 38435 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2015-02-06 10:56:17 38435 [Note] InnoDB: Memory barrier is not used
    2015-02-06 10:56:17 38435 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2015-02-06 10:56:17 38435 [Note] InnoDB: Using CPU crc32 instructions
    2015-02-06 10:56:17 38435 [Note] InnoDB: Initializing buffer pool, size = 40.0G
    2015-02-06 10:56:19 38435 [Note] InnoDB: Completed initialization of buffer pool
    2015-02-06 10:56:19 38435 [Note] InnoDB: Highest supported file format is Barracuda.
    2015-02-06 10:56:21 38435 [Note] InnoDB: 128 rollback segment(s) are active.
    2015-02-06 10:56:21 38435 [Note] InnoDB: Waiting for purge to start
    2015-02-06 10:56:21 38435 [Note] InnoDB: 5.6.22 started; log sequence number 10739272257702
    2015-02-06 10:56:21 38435 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
    2015-02-06 10:56:21 38435 [Note] - '0.0.0.0' resolves to '0.0.0.0';
    2015-02-06 10:56:21 38435 [Note] Server socket created on IP: '0.0.0.0'.
    2015-02-06 10:56:21 38435 [Note] Event Scheduler: Loaded 0 events
    2015-02-06 10:56:21 38435 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.6.22-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)

    zabbix-server.log
    12447:20150211:152143.070 [Z3001] connection to database 'zabbix' failed: [1040] Too many connections
    12447:20150211:152143.070 Cannot connect to the database. Exiting...
    12441:20150211:152143.069 [Z3001] connection to database 'zabbix' failed: [1040] Too many connections
    12442:20150211:152143.069 Cannot connect to the database. Exiting...
    12338:20150211:152143.070 Cannot connect to the database. Exiting...
    12441:20150211:152143.070 Cannot connect to the database. Exiting...
    12430:20150211:152143.069 Cannot connect to the database. Exiting...
    12443:20150211:152143.069 [Z3001] connection to database 'zabbix' failed: [1040] Too many connections
    12436:20150211:152143.069 Cannot connect to the database. Exiting...
    12318:20150211:152143.070 Cannot connect to the database. Exiting...
    12608:20150211:152143.070 server #317 started [icmp pinger #40]
    12443:20150211:152143.070 Cannot connect to the database. Exiting...
    42883:20150211:152143.071 One child process died (PID:12323,exitcode/signal:1). Exiting ...
    42883:20150211:152145.074 syncing history data...


    my.cnf
    # Zabbix Configuration
    skip-external-locking
    key_buffer_size = 256M
    max_allowed_packet = 128M
    table_open_cache = 2048
    max_connections = 1000
    query_cache_size = 1024M
    query_cache_limit = 2M
    innodb_log_file_size = 256M
    innodb_flush_method=O_DIRECT
    innodb_buffer_pool_size = 40960M
    thread_cache_size=64
    innodb_thread_concurrency=0
    innodb_read_io_threads=64
    innodb_write_io_threads=64
    tmpdir = /var/lib/mysql/ramdisk
    innodb_file_per_table
    thread_cache_size = 24
    wait_timeout = 10800
    net_read_timeout = 3600
    expire_logs_days = 5

    Anyone else having an issue with MySQL forcing max_connections down on start?
  • jan.garaj
    Senior Member
    Zabbix Certified Specialist
    • Jan 2010
    • 506

    #2
    Did you change system hard limits?
    Content max_open_files warning during mysqld startup Troubles after NON recommended upgrade path Com_* counters not updated in SHOW STATUS ERROR 1300 (HY000): Invalid utf8 character string MySQL crashes during import MySQL workbench gives an openGL error max_open_files warning during mysqld startup Problem [Warning] Changed limits: max_open_files: 1024 max_connections: 100 table_cache: 457 [Warning] Could not increase number of max_open_files to more than 1024 (request: 1070) Explanation The operating system hard limit of open files was exceeded.


    Are you able to run SQL command
    Code:
    SHOW FULL PROCESSLIST
    to see what/who is connected?
    Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
    My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant

    Comment

    • syndeysider
      Senior Member
      • Oct 2013
      • 115

      #3
      Resolved

      Thank you!

      It was indeed limits set by the OS. Resolved it with :

      Edit file /usr/lib/systemd/system/mysqld.service
      Add at end:

      LimitNOFILE=65535
      LimitNPROC=65535

      $ systemctl daemon-reload
      $ service mysqld restart

      Comment

      Working...