问题
-> Table :
cassandra@cqlsh:coba> CREATE TABLE data(
... nim int,
... nama text,
... alamat text,
... PRIMARY KEY (nim, alamat)
... );
-> Make Index :
CREATE CUSTOM INDEX cari_alamat ON coba.data (alamat) USING 'org.apache.cassandra.index.sasi.SASIIndex';
-> Error :
ServerError: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.cassandra.index.sasi.SASIIndex
-> I would be very happy if you can help me
-> Thanks You
回答1:
As initially susspected, I think you are running cassandra version lower than 3.4.
(that's why I asked for the version)
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'
Theoretically you could implement your own with: Cassandra Custom Secondary Index
But I guess it's just easier to upgrade.
Also be aware there might be some bugs with Sasi indexes:
SASI Indexes in Cassandra seem to have some bugs
But I guess it's better to search cassandra Jira for this one, this is just as a small warning.
来源:https://stackoverflow.com/questions/43466847/cassandra-create-custom-index-error-java-lang-classnotfoundexception