Akka Cluster with bind-port and bind-hostname and nginx forwarding port

Viewed 25

I just contacted akka and released an akka actor after

akka {
  log-dead-letters = on
  jvm-exit-on-fatal-error = on
  actor {
    provider = "akka.cluster.ClusterActorRefProvider"
  }
  remote {
    log-remote-lifecycle-events = on
    netty.tcp {
      hostname = 172.24.0.162
      port = 9998
    }
  }
}

This is the only way to call remotely

path= s"akka. tcp://cliActorSystem @172.24.0.162:9998/user/"  
actorSystem.actorSelection(path)

But I can't expose the server now. I have to use nginx to map to a domain name and a new port akka. conf

akka {
  log-dead-letters = on
  jvm-exit-on-fatal-error = on
  actor {
    provider = "akka.cluster.ClusterActorRefProvider"
  }
  remote {
    log-remote-lifecycle-events = on
    netty.tcp {
#      hostname = 172.24.0.162
#      port = 9998
      hostname = akka.hostname.com      # external (logical) hostname
      port = 8000                      # external (logical) port
      bind-hostname = 172.24.0.162     # internal (bind) hostname
      bind-port = 9998                 # internal (bind) port
    }
  }
}

Try to use the above configuration, but it can't meet expectations. In addition, adding the following configuration ports in nginx can not forward,

stream {
upstream akka_ proxy {
hash $remote_ addr consistent;
server 127.0.0.1:9998 ;
}
server {
listen 9990;
proxy_ connect_ timeout 5s;
proxy_ timeout 20s;
proxy_ pass akka_ proxy;
}
}

[ERROR] [09/13/2022 16:59:37.916] [cliActorSystem-akka.remote.default-remote-dispatcher-5] [akka://cliActorSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClientActorSystem%40127.0.0.1%3A60761-1/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://cliActorSystem@127.0.0.1:9990/]] arriving at [akka.tcp://cliActorSystem@127.0.0.1:9990] inbound addresses are [akka.tcp://cliActorSystem@127.0.0.1:9998]

I look forward to your help, thank you!

0 Answers
Related