hector-v2-client-doc.pdf read notes

hector-v2-client-doc.pdf 读书笔记

LoadBalancingPolicy

Hector uses the slf4j logging API with the Log4J bridge to provide runtime logging.

Hector测试相关的类:
EmbeddedServerHelper
BaseEmbeddedServerTest

创建Keyspace:
Cluster cluster = HFactory.getCreateCluster("TestCluster",
new CassandraHostConfigurator("localhost:9160"));
Keyspace keyspace = HFactory.createKeyspace("Keyspace1",cluster);

StringSerializer
OrderPreservingPartitioner

IndexedSlicesQuery indexedSlicesQuery =
HFactory.createIndexedSlicesQuery(keyspace, se, se,, LongSerializer.get());
indexedSlicesQuery.addEqualsExpression("birthyear", 1975L);
indexedSlicesQuery.setColumnNames("birthdate","firstname");
indexedSlicesQuery.setColumnFamily("Users");
indexedSlicesQuery.setStartKey("");
QueryResult> result =
indexedSlicesQuery.execute();

IndexedSlicesQuery can also have expressions applied on other columns in conjunction with
the addEqualsExpression. There are two important points to note in using additional index
expressions:
● At least one equals expression against an indexed column must always be present via
addEqualsExpression
● The columns for additional clauses do not have have to be configured as indexed for the
ColumnFamily

Maven Repository for Dependencies

hector to store supercolumn:
Mutator mutator =
HFactory.createMutator(keyspace, stringSerializer);
mutator.insert("billing", "Super1", HFactory.createSuperColumn("jsmith",
Arrays.asList(HFactory.createStringColumn("first", "John")),
stringSerializer, stringSerializer, stringSerializer));

SuperColumnQuery superColumnQuery =
HFactory.createSuperColumnQuery(keyspace, stringSerializer,
stringSerializer, stringSerializer, stringSerializer);
superColumnQuery.setColumnFamily("Super1")
.setKey("billing").setSuperName("jsmith");
Result> result = superColumnQuery.execute();

To create your own approach to fail-over, for example to try the next three hosts pausing 200
milliseconds between each, you would construct the following FailoverPolicy:
FailoverPolicy failoverPolicy = new FailoverPolicy(3,200);

attributes exposed via JMX:
status and counters on the connections and pools
aggreate performance statics

If you do not want the overhead of having Pef4j running, it is possible to disable the statistics
gathering entirely by setting the system property com.prettyprint.cassandra.load_hector_log4j
to false at system startup and setting the level in your logging configuretion to WARN for the
appender named: me.prettyprint.hector.TimingLogger


[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23937368/viewspace-1050524/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23937368/viewspace-1050524/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值