Ad Widget

Collapse

Database connect error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • galina
    Junior Member
    • Feb 2018
    • 2

    #1

    Database connect error

    Hello.
    After the emergency shutdown of the server due to electricity, there was a problem with accessing the zabbix system to the mysql database (InnoDB).

    But (!) zabbix-server web interface does not give errors, it show all servers and show random critical error and send notification about it. It's strange behavior of the system - all servers and systems working without errors.
    Log error for database: "Error connecting to database: No such file or directory".

    In the zabbix-server error log many database unavailability errors. For example:
    18767:20180212:154157.760 database connection re-established
    18808:20180212:154157.761 database connection re-established
    18808:20180212:154157.820 [Z3005] query failed: [2013] Lost connection to MySQL server during query [commit;]
    18805:20180212:154157.820 [Z3005] query failed: [2013] Lost connection to MySQL server during query [insert into history_uint (itemid,clock,ns,value) values (36277,1518439267,499694357,0),(26197,1518439$
    ]
    18767:20180212:154157.820 [Z3005] query failed: [2013] Lost connection to MySQL server during query [select distinct t.triggerid,t.description,t.expression,t.error,t.p riority,t.type,t.value,t.state,t.la$
    18808:20180212:154157.820 [Z3001] connection to database 'zabbix' failed: [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 104
    18805:20180212:154157.820 [Z3001] connection to database 'zabbix' failed: [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 104
    18767:20180212:154157.820 database is down: retrying in 10 seconds
    18801:20180212:154157.820 [Z3005] query failed: [2013] Lost connection to MySQL server during query [delete from history_uint where itemid=33762 and clock<1509871962]
    18808:20180212:154157.820 database is down: reconnecting in 10 seconds
    18805:20180212:154157.820 database is down: reconnecting in 10 seconds
    18801:20180212:154157.820 database is down: retrying in 10 seconds
    18796:20180212:154157.874 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
    18796:20180212:154157.874 database is down: reconnecting in 10 seconds
    18791:20180212:154158.186 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    18791:20180212:154158.186 database is down: reconnecting in 10 seconds
    18807:20180212:154158.312 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    18807:20180212:154158.313 database is down: reconnecting in 10 seconds
    18794:20180212:154158.317 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    18794:20180212:154158.317 database is down: reconnecting in 10 seconds
    18806:20180212:154158.383 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    18806:20180212:154158.383 database is down: reconnecting in 10 seconds
    18797:20180212:154158.398 [Z3005] query failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [select hostid,status,tls_accept,tls_issuer,tls_subject,tl s_ps$
    18797:20180212:154158.398 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    18797:20180212:154158.398 database is down: reconnecting in 10 seconds
    18790:20180212:154158.785 IPMI agent item "FAN1" on host "khv_srv_db" failed: another network error, wait for 15 seconds
    There are particular variants of decisions (ex. change path of socket, give more privileges).

    Help me, how I can fix up this errors? I have no idea
  • cristydavidd
    Junior Member
    • Nov 2022
    • 1

    #2
    It might be because the MySQL server is bound to the loop-back IP (127.0.0.1 / localhost) which effectively cuts you off from connecting from "outside". You can solve this by open mysql configuration file named my.cnf and try to find "bind-address", here replace the setting (127.0.0.1 OR localhost) with your live server ip (the ip you are using in mysql_connect function)

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #3
      Caution on the prior reply....

      What is your configuration, all on one host or separate servers for some Zabbix functions? What OS, Version, DB & version?

      The socket file is created when mysqld starts. Some recent Linux versions have changed /var/run (alias /run) to a ram disk (tmpfs) and some versions of mysql don't create the /var/run/mysql directory after reboot, but I would expect mysqld to fail and hence the Zabbix web to fail also. Local communication to mysql will by default use a socket file, ip stack.

      Check:
      1. mysqld is really running & check it's logs
      2. Verify mysql is local to zabbix-server
      3. Verify mysql config in zabbix web

      Comment

      Working...