Using TiDB as the backend database for Zabbix 6, the server needs to be restarted after adding a host, otherwise, there is no data

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: zabbix6使用tidb作为后端数据库,添加主机后需重启server否则没有数据

| username: TiDBer_MmArS3c9

[Test Environment for TiDB]
[TiDB Version] tidb-community-server-v7.3.0-linux-amd64
[Encountered Issue:] When using TiDB as the backend database for Zabbix 6, no data is collected after adding a host. A server-side restart is required to connect to the host and fetch data. There are no errors in the server logs.

| username: ShawnYan | Original post link

Can you provide more information?
Or check the zabbix logs, os logs, etc…

| username: Fly-bird | Original post link

Is it that the database has no data or the server has no data?

| username: Billmay表妹 | Original post link

You can try the following steps:

  1. Check the Zabbix Server configuration file: Ensure that the connection information for the TiDB database is correctly configured in the Zabbix Server configuration file. You can open the Zabbix Server configuration file (usually located at /etc/zabbix/zabbix_server.conf) and confirm the relevant configuration items for the TiDB database, such as the database host, port, username, and password.
  2. Check the TiDB database connection: Ensure that the Zabbix Server can successfully connect to the TiDB database. You can try using TiDB’s command-line tools (such as mysql or tidb-lightning) to connect to the TiDB database to verify if the database connection is normal. If the connection fails, check the network access permissions, username, and password configurations for the TiDB database.
  3. Restart the Zabbix Server: If the above steps do not resolve the issue, you can try restarting the Zabbix Server. After restarting, the Zabbix Server should be able to correctly load the TiDB database configuration and connect to the host to collect data.
| username: Raymond | Original post link

Excuse me, experts, did Zabbix use some foreign keys when using TiDB before? How was this issue resolved on TiDB?

| username: zhanggame1 | Original post link

TiDB supports foreign keys starting from version 7. In earlier versions, you can still create foreign keys, but they will not take effect and no error will be reported.

| username: tidb菜鸟一只 | Original post link

Are you restarting the Zabbix server or the TiDB server? It seems like there might be an issue with the JDBC configuration?