当cassandra重新启动时,应用程序的准备语句会发生什么? [英] What happens to the prepared statements of an application when cassandra is restarted?

查看:153
本文介绍了当cassandra重新启动时,应用程序的准备语句会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们在生产中使用一个java ee应用程序,它使用prepared语句。让我们假设它准备了对其会话bean初始化所需的语句。



在cassandra中,每个预准备语句都有一个id。如果现在,如果cassandra重新启动,java ee应用程序也需要重新启动?

解决方案

几乎所有Cassandra客户端都应该支持情况,而不必重新启动(所有datastax驱动程序做我的知识)。例如,在java驱动程序中,当一个节点下降并再次出现时,将其标记为可用时的第一件事情之一是 reprepare您的应用程序已注册的所有PreparedStatements

此外,如果您在应用程序中使用PreparedStatement进行查询,并且Cassandra节点回应它不知道该语句,则客户端应准备该查询并重试请求


Let's take a java ee application in production, which uses prepared statements. Let's assume that it prepared required statements on initialization of its session beans.

In cassandra, each prepared statement has an id. If now, if cassandra is restarted, will java ee application also needs to get restarted?

解决方案

Almost all Cassandra clients should support this situation without having to restart (all datastax drivers do to my knowledge). For example, in the java-driver, when a node goes down and comes up again, one of the first things it does when marking it as available is reprepare all PreparedStatements your application has registered.

In addition, if you make a query using a PreparedStatement in your application and a Cassandra node responds that it does not know about that statement, the client should prepare that query and retry the request.

这篇关于当cassandra重新启动时,应用程序的准备语句会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆