与Cassandra集成点燃 [英] Ignite with Cassandra integration

查看:104
本文介绍了与Cassandra集成点燃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Ignite与Cassandra集成。我正在将持久性策略用作BLOB。当我运行程序时,它显示类似 com.datastax.driver.core.exceptions.CodecNotFoundException的错误:找不到请求的操作的编解码器:com.datastax.driver.core中的[varchar<-> java.nio.HeapByteBuffer] .CodecRegistry.notFound(CodecRegistry.java:679)

I am trying to integrate Ignite with Cassandra. I am using persistence strategy as BLOB. when i run the program it shows an error like "com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [varchar <-> java.nio.HeapByteBuffer] at com.datastax.driver.core.CodecRegistry.notFound(CodecRegistry.java:679) "

这是我的持久性xml文件

here is my persistence xml file

<persistence keyspace="sam" table="key">
<keyPersistence class="java.lang.String" strategy="BLOB" column="key"/>
<valuePersistence class="java.lang.String" strategy="BLOB" column="value"/>
</persistence>

main.cpp

int main()
{
IgniteConfiguration cfg;
cfg.springCfgPath = "apache-ignite-fabric-2.0.0-bin/cassandra-config.xml";
Ignite grid = Ignition::Start(cfg);
Cache<Test, Test> cache = grid.GetCache<Test, Test>("cache1");
Test obj;
cache.LoadCache ();
Test key;
key.key = "123dfsdfs";
obj.value = "sdfsf";
cache.Put (key,obj);
return 0;
}


推荐答案

该错误表示该类型Cassandra中的列的 varchar ,但是您试图在其中写入BLOB。因此失败了。

The error means that the type of the column in Cassandra is varchar, but you're trying to write a BLOB into it. Thus the failure.

但是为什么对字符串使用 BLOB 策略呢?您可以改为使用 PRIMITIVE 策略将字符串直接写入 varchar 列。

But why do you use BLOB strategy for strings? You can write a string as is to a varchar column by using PRIMITIVE strategy instead.

这篇关于与Cassandra集成点燃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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