英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论