使用Gocql时遇到超时错误。

huangapple go评论80阅读模式
英文:

Getting timeout error with Gocql

问题

我在向Cassandra插入数据时遇到了以下错误。我正在使用gocql客户端访问Cassandra。

> {"error":"gocql: 连接上的查询超时次数过多","status":500}
>
> {"error":"gocql: 在超时期限内未收到来自Cassandra的响应","status":500}
>
> {"error":"write tcp 172.23.15.226:36954-\u003e172.23.16.15:9042: 使用已关闭的网络连接","status":500}

有人可以帮我解决这个问题吗?

英文:

I am getting following errors while inserting data in Cassandra.
I am using gocql client for Cassandra.

> {"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}

Can anybody help me with this?

答案1

得分: 5

尝试在Cassandra配置文件中增加超时时间(对于写操作使用write_request_timeout_in_ms,对于并发写操作使用concurrent_writes)。

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

如果你正在使用低于4的协议版本,可以尝试将gocql中集群对象的Timeout参数设置为较高的值。

英文:

Try to increase timeouts in Cassandra config file (write_request_timeout_in_ms - for writes) and concurrent writes (concurrent_writes).

Also, try to lower NumConns parameter in your gocql driver.
If you are using goroutines, try to lower their number and verify that you are reusing same session object for all goroutines.

If you are using protocol version prior to 4, you can try to set Timeout paramter of cluster object in gocql to higher value.

huangapple
  • 本文由 发表于 2017年3月21日 17:17:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/42922757.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定