Cassandra创建自定义索引错误java.lang.ClassNotFoundException

问题描述:

->表:

cassandra@cqlsh:coba> CREATE TABLE data(
        ... nim int,
        ... nama text,
        ... alamat text,
        ... PRIMARY KEY (nim, alamat)
        ... );

->品牌指数:

CREATE CUSTOM INDEX cari_alamat ON coba.data (alamat) USING 'org.apache.cassandra.index.sasi.SASIIndex';

->错误:

ServerError: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.cassandra.index.sasi.SASIIndex

->如果您能帮助我,我将非常高兴

-> I would be very happy if you can help me

->谢谢

最初怀疑的是,我认为您运行的Cassandra版本低于3.4。

As initially susspected, I think you are running cassandra version lower than 3.4.

(这就是我要求版本的原因)

(that's why I asked for the version)

我尝试了一下,并在3.0上遇到了同样的错误.10:

I tried it out and got the same error on 3.0.10:

cqlsh:test> CREATE CUSTOM INDEX cari_alamat ON test.data (alamat) USING 'org.apache.cassandra.index.sasi.SASIIndex';
ConfigurationException: Unable to find custom indexer class 'org.apache.cassandra.index.sasi.SASIIndex'

从理论上讲,您可以通过以下方式实现自己的:
Cassandra自定义二级索引

Theoretically you could implement your own with: Cassandra Custom Secondary Index

但是我想它升级起来更容易。

But I guess it's just easier to upgrade.

另外请注意,Sasi索引可能存在一些错误:

Also be aware there might be some bugs with Sasi indexes:

Cassandra中的SASI索引似乎有一些错误

但是我想最好搜索一下Cassandra Jira,这只是一个小警告

But I guess it's better to search cassandra Jira for this one, this is just as a small warning.