使用 Gocql 获取超时错误

Getting timeout error with Gocql

我在 Cassandra 中插入数据时遇到以下错误。 我正在为 Cassandra 使用 gocql 客户端。

{"error":"gocql: too many query timeouts on the connection","status":500}

{"error":"gocql: no response received from cassandra within timeout period","status":500}

{"error":"write tcp 172.23.15.226:36954-\u003e172.23.16.15:9042: use of closed network connection","status":500}

谁能帮我解决这个问题?

尝试增加 Cassandra 配置文件(write_request_timeout_in_ms - 对于写入)和并发写入(concurrent_writes[=20)的超时=]).

此外,尝试降低 gocql 驱动程序中的 NumConns 参数。 如果您正在使用 goroutines,请尝试降低它们的数量并验证您是否为所有 goroutines 重复使用相同的会话对象。

如果你使用的是4之前的协议版本,你可以尝试将gocql中集群对象的Timeout参数设置为更高的值。