Cassandra persistence - with Cassandra 2.2.7 + akka-persistence-cassandra-0.7 + akka 2.4.8 - not working

467 views
Skip to first unread message

Muthukumaran Kothandaraman

unread,
Jul 30, 2016, 8:29:07 AM7/30/16
to Akka User List
Hi, 

With above combination I am getting following error while running a simple PersistentActor. Checked compatibility on page - https://github.com/akka/akka-persistence-cassandra 

Will give a try with 


[WARN] [07/30/2016 08:13:20.699] [example-cassandra-journal.default-dispatcher-6] [akka://example/system/cassandra-journal] Failed to connect to Cassandra and initialize. It will be retried on demand. Caused by: line 2:13 no viable alternative at input 'MATERIALIZED' (      [CREATE] MATERIALIZED...)

Strangely, when I check the keyspaces and tables with cqlsh directly connecting to Cassandra, I was able to see the keyspace named akka and corresponding tables created by akka. So, I assume connectivity itself is not an issue. 
But, the table akka.messages is empty always and events do not get populated. 

Before trying with Cassandra  3.0.8 , I would like to check if I am missing something. 

I assume my application.conf below is fine because I do not see any exceptions. I am using cassandra only for journals. In the initial run I am not doing any explicit snapshotting from within actor. 

akka.persistence.journal.plugin = "cassandra-journal"
akka.persistence.snapshot-store.plugin = "akka.persistence.snapshot-store.local"

akka.persistence.snapshot-store.local.dir = "target/example/snapshots"

# DO NOT USE THIS IN PRODUCTION !!!
# See also https://github.com/typesafehub/activator/issues/287
# akka.persistence.journal.leveldb.native = false

# akka.persistence.journal.leveldb.fsync = off

cassandra-journal {

# FQCN of the cassandra journal plugin
class = "akka.persistence.cassandra.journal.CassandraJournal"

# Comma-separated list of contact points in the cluster
contact-points = ["127.0.0.1"]

# Port of contact points in the cluster
port = 9042

# Name of the keyspace to be created/used by the journal
keyspace = "akka"

# Parameter indicating whether the journal keyspace should be auto created
keyspace-autocreate = true

# In case that schema creation failed you can define a number of retries before giving up.
keyspace-autocreate-retries = 1

# The number of retries when a write request returns a TimeoutException or an UnavailableException.
write-retries = 3

# Deletes are achieved using a metadata entry and then the actual messages are deleted asynchronously
# Number of retries before giving up
delete-retries = 3

# Number of retries before giving up connecting to the cluster
connect-retries = 3

# Delay between connection retries
connect-retry-delay = 5s

# Name of the table to be created/used by the journal
table = "messages"

# Compaction strategy for the journal table
table-compaction-strategy {
class = "SizeTieredCompactionStrategy"
}

# Name of the table to be created/used for storing metadata
metadata-table = "metadata"

# Name of the table to be created/used for journal config
config-table = "config"

# replication strategy to use. SimpleStrategy or NetworkTopologyStrategy
replication-strategy = "SimpleStrategy"

# Replication factor to use when creating a keyspace. Is only used when replication-strategy is SimpleStrategy.
replication-factor = 1

# Replication factor list for data centers, e.g. ["dc1:3", "dc2:2"]. Is only used when replication-strategy is NetworkTopologyStrategy.
data-center-replication-factors = []

# Write consistency level
write-consistency = "QUORUM"

# Read consistency level
read-consistency = "QUORUM"

max-message-batch-size = 200

# Target number of entries per partition (= columns per row).
# Must not be changed after table creation (currently not checked).
# This is "target" as AtomicWrites that span parition boundaries will result in bigger partitions to ensure atomicity.
target-partition-size = 500000

# Maximum size of result set
max-result-size = 50001

# Dispatcher for the plugin actor.
plugin-dispatcher = "cassandra-journal.default-dispatcher"

# Dispatcher for fetching and replaying messages
replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"

# Default dispatcher for plugin actor.
default-dispatcher {
type = Dispatcher
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 2
parallelism-max = 8
}
}

# The time to wait before cassandra will remove the thombstones created for deleted entries.
# cfr. gc_grace_seconds table property documentation on http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/tabProp.html
gc-grace-seconds = 864000
}

Muthukumaran Kothandaraman

unread,
Jul 30, 2016, 10:27:43 AM7/30/16
to Akka User List
Moved to Cassandra version 3.7 and no other changes - it works now !

Just in case somebody is hitting same problem, this could be useful. 

Please note that this is purely localhost testing. Will start cluster testing sometime

Regards
Muthu

Justin du coeur

unread,
Jul 30, 2016, 10:57:00 AM7/30/16
to akka...@googlegroups.com
I see you got things working, which is great.  I just wanted to caution:

On Sat, Jul 30, 2016 at 8:29 AM, Muthukumaran Kothandaraman <muthu....@gmail.com> wrote:
I assume my application.conf below is fine because I do not see any exceptions.

As a rule of thumb, this isn't a safe assumption.  Config-file format is weakly typed, remember -- it's just strings -- and it does *not* automatically detect errors.  Some mistakes will get caught by the relevant libraries, but in general if you make a typo in the name, and the library has a default value for that config key, the error will be silently ignored...

Patrik Nordwall

unread,
Aug 2, 2016, 6:00:13 AM8/2/16
to akka...@googlegroups.com
Have you tried version 0.17 with the compat flag described in the readme? https://github.com/akka/akka-persistence-cassandra/blob/master/README.md

/Patrik
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Muthukumaran Kothandaraman

unread,
Aug 3, 2016, 1:31:09 AM8/3/16
to Akka User List
Just to unblock myself I had moved ahead with Cassandra 3.7. I do have some constraints in not moving to 3.x yet and have to stick to 2.x for an upcoming work. Will definitely try out the compat flag. 


Regards
Muthu


Reply all
Reply to author
Forward
0 new messages