0
votes

I've been studying Akka Clusters via the akka-sample-cluster-app tutorial and this documentation. I have it running locally (127.0.0.1), but I can't seem to get it working using my static IP (192.168.0.99). I'm doing this as a quick sanity check because I'm getting similar messages while trying to use my Raspberry Pi's as nodes.

[WARN] [05/30/2016 11:01:41.432] [ClusterSystem-akka.remote.default-remote-dispatcher-8] [akka.tcp://[email protected]:63599/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40192.168.0.99%3A2552-1] Association with remote system [akka.tcp://[email protected]:2552] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://[email protected]:2552]] Caused by: [Connection refused: no further information: /192.168.0.99:2552]

I believe I'm getting a connection refused error because there's nothing listening on port 2552, but I'm confused about why. How does the Akka program get put on the nodes and begin running? Why does it work with 127.0.0.1 and not my static IP?

As far as I can tell, no where in this tutorial or documentation does it explicitly say: "You need to compile a separate program for your nodes." So does the program get pushed to the nodes from the main Akka server or do I need to create another project for my nodes?

I'm guess the former, but then how/why are people doing their node development in the same project as their server? How are they running the same jar differently as a server and as a node?

EDIT:

Address of Raspberry Pi Node 1: 192.168.0.8
Address of Raspberry Pi Node 2: 192.168.0.9
Address of Desktop Computer: 192.168.0.99

application.conf on Desktop Computer (Note hostname)

#//#snippet
akka {

    log-dead-letters = off
    log-level = "debug"

  actor {
    provider = "akka.cluster.ClusterActorRefProvider"
  }
  remote {
    log-remote-lifecycle-events = off
    netty.tcp {
      hostname = "192.168.0.99"
      port = 2552
    }
  }

  cluster {
    seed-nodes = [
      "akka.tcp://[email protected]:2552",
      "akka.tcp://[email protected]:2552"]

    #//#snippet
    # excluded from snippet
    auto-down-unreachable-after = 10s
    #//#snippet
    # auto downing is NOT safe for production deployments.
    # you may want to use it during development, read more about it in the docs.
    #
    # auto-down-unreachable-after = 10s
  }
}

# Disable legacy metrics in akka-cluster.
akka.cluster.metrics.enabled=off

# Enable metrics extension in akka-cluster-metrics.
akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]

# Sigar native library extract location during tests.
# Note: use per-jvm-instance folder when running multiple jvm on one host.
akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native
#//#snippet

application.conf on Raspberry Pi Node 2 (Similar on Node 1, just different hostname)

#//#snippet
akka {

    log-dead-letters = off
    log-level = "debug"

  actor {
    provider = "akka.cluster.ClusterActorRefProvider"
  }
  remote {
    log-remote-lifecycle-events = off
    netty.tcp {
      hostname = "192.168.0.9"
      port = 2552
    }
  }

  cluster {
    seed-nodes = [
      "akka.tcp://[email protected]:2552",
      "akka.tcp://[email protected]:2552"]

    #//#snippet
    # excluded from snippet
    auto-down-unreachable-after = 10s
    #//#snippet
    # auto downing is NOT safe for production deployments.
    # you may want to use it during development, read more about it in the docs.
    #
    # auto-down-unreachable-after = 10s
  }
}

# Disable legacy metrics in akka-cluster.
akka.cluster.metrics.enabled=off

# Enable metrics extension in akka-cluster-metrics.
akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]

# Sigar native library extract location during tests.
# Note: use per-jvm-instance folder when running multiple jvm on one host.
akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native
#//#snippet

With this I get "No route to host" on the node as I try to bring it up.

EDIT 2:

Because main is at simple.sample.cluster.simple.SimpleClusterApp I have to launch my node with "java -cp cluster.jar simple.sample.cluster.simple.SimpleClusterApp". Does that seem right? I assume this is the same tutorial project I'm compiling/assembling for both the node and the desktop? Or do I need to create an entirely different project for my nodes?? I'm so confused. The tutorial is terrible for newcomers.

1

1 Answers

1
votes

Hihi.

In this part of Akka Tutorial assumes you know how to up 2-nd node.

for this you need to start 2-nd actorSystem with .conf, where

 netty.tcp {
      hostname = "192.168.0.99"
      port = 2552
    }

and in seed write address of your 1-st node.