/akka-cluster-example-inloop

Simple akka cluster example.

Primary LanguageScala

akka-cluster-example-inloop

Simple akka cluster example.

To run:

  1. Install cassandra and start it.
  2. sbt clean compile xitrum-package
  3. cd target/xitrum/bin
  4. ./start.sh seed1
  5. ./start.sh seed2
  6. ./start.sh stat1
  7. ./start.sh stat2
  8. ./start.sh query
  9. ./start_driver.sh
  10. cd ../logs
  11. tail -f driver_rt.log

Note

To got multiple sharding actors run on separated sub-set of nodes, and can be accessed from other nodes in the cluster, for example:

  • Counter1 runs on node1, node2, node3
  • Counter2 runs on node7, node8, node9
  • Query want to query both Counter1 sharding and Counter2 sharding.

You have to:

  1. All those sharding nodes should contain at lease one same role in "actor.cluster.roles"
  2. All sharding nodes should have the role in "actor.cluster.roles" which is the same as its sharding role
  3. Query can have or one or none whatever role in "akka.contrib.cluster.sharding.role"
  4. ClusterSharding(system).start() with entryProps = Some(Props[Counter1]) on node1, node2, node3
  5. ClusterSharding(system).start() with entryProps = Some(Props[Counter2]) on node7, node8, node9
  6. ClusterSharding(system).start() with entryProps = None on node of Query for shardings of Counter1 and Counter2.