[FAQ] TiDB Log 输出:“write: connection reset by peer”

【问题澄清】

  • TiDB v3.x 规律输出以下日志:

  • tidb1报错日志:

2020/04/10 16:22:31.838 terror.go:357: [error] write tcp 172.20.5.143:4000 >100.121.100.2:59025: write: connection reset by peer github.com/pingcap/errors.AddStack /home/jenkins/agent/workspace/tidb_v3.0.12/go/pkg/mod/github.com/pingcap/errors@v0.11.4/errors.go:174 github.com/pingcap/errors.Trace /home/jenkins/agent/workspace/tidb_v3.0.12/go/pkg/mod/github.com/pingcap/errors@v0.11.4/juju_adaptor.go:15 github.com/pingcap/tidb/server.(*packetIO.flush /home/jenkins/agent/workspace/tidb_v3.0.12/go/src/github.com/pingcap/tidb/server/packetio.go:172 github.com/pingcap/tidb/server.(*clientConn.flush /home/jenkins/agent/workspace/tidb_v3.0.12/go/src/github.com/pingcap/tidb/server/conn.go:967 github.com/pingcap/tidb/server.(*clientConn.writeInitialHandshake /home/jenkins/agent/workspace/tidb_v3.0.12/go/src/github.com/pingcap/tidb/server/conn.go:261 github.com/pingcap/tidb/server.(*clientConn.handshake /home/jenkins/agent/workspace/tidb_v3.0.12/go/src/github.com/pingcap/tidb/server/conn.go:169 github.com/pingcap/tidb/server.(*Server.onConn /home/jenkins/agent/workspace/tidb_v3.0.12/go/src/github.com/pingcap/tidb/server/server.go:345 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1357

【解决思路】

1.上游应用连接 TiDB 时是否使用了 LB 、keepalive 等组件

  1. 是否有大量业务链接或者探活链接

【解决方案】

  • 正确配置或者优化 tidb 上游组件

【参考案例】