如何使用Node.js在Cassandra中设置降级策略 [英] How to set the downgrading policy in Cassandra using nodejs

查看:71
本文介绍了如何使用Node.js在Cassandra中设置降级策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定要使用Cassandra在nodejs中设置策略 DowngradingRetryPolicy。

I am not sure about setting the policy 'DowngradingRetryPolicy' in nodejs using Cassandra.

policies : { loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy,
                                                   retry: new cassandra.policies.retry.IdempotenceAwareRetryPolicy(new cassandra.policies.retry.RetryPolicy())
                                                 } });

这就是我设置 IdempotenceAwareRetryPolicy 策略的方式并且它按预期工作,但是如何使用nodejs在Cassandra中设置' DowngradingRetryPolicy '策略

This is how I set the IdempotenceAwareRetryPolicy policy and it is working as expected but How to set the 'DowngradingRetryPolicy' policy in Cassandra using nodejs

红宝石实现,

https://datastax.github.io/ruby-driver/features/retry_policies/downgrading_consistency/


推荐答案

nodejs中没有降级一致性重试策略。恕我直言,这是一件好事,就C *一致性保证而言,这没有多大意义。人们总是可以编写自己的重试策略来执行此操作(如果确实需要),但是默认情况下会出现这种情况会鼓励进行危险的设置,从而可能在意外/随机时间违反一致性期望。

There is no downgrading consistency retry policy in nodejs. This is a good thing imho, it doesn't make much sense in context of C* consistency guarantees. People can always write own retry policy to do it if really need it, but to be there by default encourages a dangerous setup that can violate consistency expectations at unexpected/random times.

但是,如果您正在考虑使用降级重试策略,请仅使用CL.ONE和常规策略。您必须假设所有查询都将那样执行,否则您的应用程序将不安全。

However, if you are thinking about a using downgrading retry policy, just use CL.ONE and a normal policy. You would have to assume that all queries will execute at that anyway or your application would not be safe. So might as well get the performance improvements of the reduced consistency level.

除非有充分的理由,否则最好还是坚持使用默认的TokenAwarePolicy包装DCAwareRoundRobinPolicy 。只是DCAwareRoundRobinPolicy可能最适合稳定性。

Unless theres a strong reason for it, you will be best served just sticking with the default TokenAwarePolicy wrapping DCAwareRoundRobinPolicy. Just DCAwareRoundRobinPolicy probably best for stability.

这篇关于如何使用Node.js在Cassandra中设置降级策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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