problem in my program is cluster seed nodes are not connected . my port is 
1170 ( this port is executed) while i am trying another seed node of port 
2552 , 0 , 1171 and few other ports it show error like this , and i attach 
source code also 

[INFO] [07/26/2017 15:39:19.201] [main] [akka.remote.Remoting] Starting 
remoting
[INFO] [07/26/2017 15:39:20.220] [main] [akka.remote.Remoting] Remoting 
started; listening on addresses :[akka.tcp://[email protected]:1170]
[INFO] [07/26/2017 15:39:20.267] [main] 
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://[email protected]:1170] - Starting up...
[INFO] [07/26/2017 15:39:21.146] [main] 
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://[email protected]:1170] - Registered cluster JMX MBean 
[akka:type=Cluster]
[INFO] [07/26/2017 15:39:21.146] [main] 
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://[email protected]:1170] - Started up successfully
[WARN] [07/26/2017 15:39:21.365] 
[ClusterSystem-akka.actor.default-dispatcher-4] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/downingProvider]
 
Don't use auto-down feature of Akka Cluster in production. See 
'Auto-downing (DO NOT USE)' section of Akka Cluster documentation.
[INFO] [07/26/2017 15:39:21.475] 
[ClusterSystem-akka.actor.default-dispatcher-16] 
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://[email protected]:1170] - Metrics collection has started 
successfully
[WARN] [07/26/2017 15:39:22.793] 
[ClusterSystem-akka.remote.default-remote-dispatcher-13] 
[akka.tcp://[email protected]:1170/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2552-0]
 
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: /127.0.0.1:2552]
[WARN] [07/26/2017 15:39:22.824] [New I/O boss #3] 
[NettyTransport(akka://ClusterSystem)] Remote connection to null failed 
with java.net.ConnectException: Connection refused: no further information: 
/127.0.0.1:2552
[INFO] [07/26/2017 15:39:22.824] 
[ClusterSystem-akka.actor.default-dispatcher-17] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [1] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[INFO] [07/26/2017 15:39:26.494] 
[ClusterSystem-akka.actor.default-dispatcher-16] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [2] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:31.544] 
[ClusterSystem-akka.actor.default-dispatcher-2] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [2] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[WARN] [07/26/2017 15:39:32.626] [New I/O boss #3] 
[NettyTransport(akka://ClusterSystem)] Remote connection to null failed 
with java.net.ConnectException: Connection refused: no further information: 
/127.0.0.1:2552
[WARN] [07/26/2017 15:39:32.626] 
[ClusterSystem-akka.remote.default-remote-dispatcher-5] 
[akka.tcp://[email protected]:1170/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%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: /127.0.0.1:2552]
[INFO] [07/26/2017 15:39:32.626] 
[ClusterSystem-akka.actor.default-dispatcher-15] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [3] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:36.610] 
[ClusterSystem-akka.actor.default-dispatcher-4] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [3] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[INFO] [07/26/2017 15:39:36.610] 
[ClusterSystem-akka.actor.default-dispatcher-4] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [4] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:41.676] 
[ClusterSystem-akka.actor.default-dispatcher-15] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [4] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[WARN] [07/26/2017 15:39:42.868] [New I/O boss #3] 
[NettyTransport(akka://ClusterSystem)] Remote connection to null failed 
with java.net.ConnectException: Connection refused: no further information: 
/127.0.0.1:2552
[WARN] [07/26/2017 15:39:42.868] 
[ClusterSystem-akka.remote.default-remote-dispatcher-19] 
[akka.tcp://[email protected]:1170/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2552-2]
 
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: /127.0.0.1:2552]
[INFO] [07/26/2017 15:39:42.868] 
[ClusterSystem-akka.actor.default-dispatcher-4] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [5] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:46.742] 
[ClusterSystem-akka.actor.default-dispatcher-4] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [5] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[INFO] [07/26/2017 15:39:46.742] 
[ClusterSystem-akka.actor.default-dispatcher-16] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [6] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:51.792] 
[ClusterSystem-akka.actor.default-dispatcher-15] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [6] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[WARN] [07/26/2017 15:39:52.843] [New I/O boss #3] 
[NettyTransport(akka://ClusterSystem)] Remote connection to null failed 
with java.net.ConnectException: Connection refused: no further information: 
/127.0.0.1:2552
[WARN] [07/26/2017 15:39:52.843] 
[ClusterSystem-akka.remote.default-remote-dispatcher-20] 
[akka.tcp://[email protected]:1170/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2552-3]
 
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: /127.0.0.1:2552]
[INFO] [07/26/2017 15:39:52.843] 
[ClusterSystem-akka.actor.default-dispatcher-2] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [7] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[WARN] [07/26/2017 15:39:56.843] 
[ClusterSystem-akka.actor.default-dispatcher-15] 
[akka.tcp://[email protected]:1170/system/cluster/core/daemon/joinSeedNodeProcess-1]
 
Couldn't join seed nodes after [7] attempts, will try again. 
seed-nodes=[akka.tcp://[email protected]:2552]
[INFO] [07/26/2017 15:39:56.843] 
[ClusterSystem-akka.actor.default-dispatcher-2] 
[akka://ClusterSystem/deadLetters] Message 
[akka.cluster.InternalClusterAction$InitJoin$] from 
Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-1364196284]
 
to Actor[akka://ClusterSystem/deadLetters] was not delivered. [8] dead 
letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.


please anyone help me with this problem


Thanks & Regards,
Kiran Sarma

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
akka {
  version="2.5.1"
  actor {
    provider = "cluster"
  }
  remote {
    log-remote-lifecycle-events = off
    netty.tcp {
      hostname = "127.0.0.1"
      port = 1170
    }
  }

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

    # 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
package com.clusterdemo;

import java.io.Serializable;

public interface TransformationMessages {

  public static class TransformationJob implements Serializable {
   
	private static final long serialVersionUID = -323116870339260305L;
	private final String text;

    public TransformationJob(String text) {
      this.text = text;
    }

    public String getText() {
      return text;
    }
  }

  public static class TransformationResult implements Serializable {
    
	
	private static final long serialVersionUID = -6857185105427999258L;
	private final String text;

    public TransformationResult(String text) {
      this.text = text;
    }

    public String getText() {
      return text;
    }

    @Override
    public String toString() {
      return "TransformationResult(" + text + ")";
    }
  }

  public static class JobFailed implements Serializable {
   
	private static final long serialVersionUID = -6236715106724766422L;
	private final String reason;
    private final TransformationJob job;

    public JobFailed(String reason, TransformationJob job) {
      this.reason = reason;
      this.job = job;
    }

    public String getReason() {
      return reason;
    }

    public TransformationJob getJob() {
      return job;
    }

    @Override
    public String toString() {
      return "JobFailed(" + reason + ")";
    }
  }

  public static final String BACKEND_REGISTRATION = "BackendRegistration";

}
package com.clusterdemo;


import static com.clusterdemo.TransformationMessages.BACKEND_REGISTRATION;
import com.clusterdemo.TransformationMessages.TransformationJob;
import com.clusterdemo.TransformationMessages.TransformationResult;
import akka.actor.AbstractActor;
import akka.cluster.Cluster;
import akka.cluster.ClusterEvent.CurrentClusterState;
import akka.cluster.ClusterEvent.MemberUp;
import akka.cluster.Member;
import akka.cluster.MemberStatus;

public class TransformationBackend extends AbstractActor {

  Cluster cluster = Cluster.get(getContext().system());

  //subscribe to cluster changes, MemberUp
  @Override
  public void preStart() {
    cluster.subscribe(self(), MemberUp.class);
  }

  //re-subscribe when restart
  @Override
  public void postStop() {
    cluster.unsubscribe(self());
  }

  @Override
  public Receive createReceive() {
    return receiveBuilder()
      .match(TransformationJob.class, job -> {
        sender().tell(new TransformationResult(job.getText().toUpperCase()),
          self());
      })
      .match(CurrentClusterState.class, state -> {
        for (Member member : state.getMembers()) {
          if (member.status().equals(MemberStatus.up())) {
            register(member);
          }
        }
      })
      .match(MemberUp.class, mUp -> {
        register(mUp.member());
      })
      .build();
  }

  void register(Member member) {
    if (member.hasRole("frontend"))
      getContext().actorSelection(member.address() + "/user/frontend").tell(
          BACKEND_REGISTRATION, self());
  }
}
package com.clusterdemo;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

import akka.actor.ActorSystem;
import akka.actor.Props;

public class TransformationBackendMain {

  public static void main(String[] args) {
    // Override the configuration of the port when specified as program argument
    final String port = args.length > 0 ? args[0] : "1170";
    final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
      withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
      withFallback(ConfigFactory.load());

    ActorSystem system = ActorSystem.create("ClusterSystem", config);

    system.actorOf(Props.create(TransformationBackend.class), "backend");

  }

}
package com.clusterdemo;

import static com.clusterdemo.TransformationMessages.BACKEND_REGISTRATION;

import java.util.ArrayList;
import java.util.List;

import com.clusterdemo.TransformationMessages.JobFailed;
import com.clusterdemo.TransformationMessages.TransformationJob;
import akka.actor.ActorRef;
import akka.actor.Terminated;
import akka.actor.AbstractActor;

public class TransformationFrontend extends AbstractActor {

  List<ActorRef> backends = new ArrayList<>();
  int jobCounter = 0;

  @Override
  public Receive createReceive() {
    return receiveBuilder()
      .match(TransformationJob.class, job -> backends.isEmpty(), job -> {
        sender().tell(new JobFailed("Service unavailable, try again later", job),
          sender());
      })
      .match(TransformationJob.class, job -> {
        jobCounter++;
        backends.get(jobCounter % backends.size())
          .forward(job, getContext());
      })
      .matchEquals(BACKEND_REGISTRATION, message -> {
        getContext().watch(sender());
        backends.add(sender());
      })
      .match(Terminated.class, terminated -> {
        backends.remove(terminated.getActor());
      })
      .build();
  }
}
package com.clusterdemo;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

import com.clusterdemo.TransformationMessages.TransformationJob;
import scala.concurrent.ExecutionContext;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.dispatch.OnSuccess;
import akka.util.Timeout;
import static akka.pattern.Patterns.ask;

public class TransformationFrontendMain {

  public static void main(String[] args) {
    // Override the configuration of the port when specified as program argument
    final String port = args.length > 0 ? args[0] : "1170";
    final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
      withFallback(ConfigFactory.parseString("akka.cluster.roles = [frontend]")).
      withFallback(ConfigFactory.load());

    ActorSystem system = ActorSystem.create("ClusterSystem", config);

    final ActorRef frontend = system.actorOf(
        Props.create(TransformationFrontend.class), "frontend");
    final FiniteDuration interval = Duration.create(2, TimeUnit.SECONDS);
    final Timeout timeout = new Timeout(Duration.create(5, TimeUnit.SECONDS));
    final ExecutionContext ec = system.dispatcher();
    final AtomicInteger counter = new AtomicInteger();
    system.scheduler().schedule(interval, interval, new Runnable() {
      public void run() {
        ask(frontend,
            new TransformationJob("hello-" + counter.incrementAndGet()),
            timeout).onSuccess(new OnSuccess<Object>() {
          public void onSuccess(Object result) {
            System.out.println(result);
          }
        }, ec);
      }

    }, ec);

  }
}

Reply via email to