Shared Cassandra Session 失去连接,应用必须重启

Shared Cassandra Session loses connection and app must be restarted

我正在开发使用 Cassandra 作为数据存储的 Flask Web 服务。

Web 服务设置为使用 Cassandra 的共享会话,据我所知,它会自动处理连接池。

当我部署应用程序时,在一段时间内一切正常,但在一定时间后会话会丢失集群中的所有 C* 主机并拒绝尝试重新连接。它只是错误地显示消息:Unable to complete the operation against any hosts.

我该怎么做才能让会话自动尝试重新连接到群集或检测到会话已中断以便我可以将其关闭并创建新会话?

您应该不需要创建新会话。假设您正在使用 datastax python-driver, the driver maintains a 'control connection' which subscribes to node up/down events. If the control connection is lost, it will reconnect to another host in the cluster. It would be useful to turn on debug logging,这将揭示集群中的节点被标记为关闭的原因。