0

在 out 集群中,我们有五个节点组成:

  • 2 个种子节点(后端)
  • 1 名工人
  • 2 IIS 上的 webapi

集群已加入、启动并运行;但是当通过路由器向集群执行第一条消息时,第二个 IIS 使所有集群无法访问和分离。此外,第二个 IIS 无法传递任何消息。

这是我的 IIS 配置:

<hocon>
  <![CDATA[
        akka.loglevel = INFO
        akka.log-config-on-start = off
        akka.stdout-loglevel = INFO
        akka.actor {
            provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
            deployment {
              /Process {
                router = round-robin-group
                routees.paths = ["/user/Process"] # path of routee on each node
                # nr-of-instances = 3 # max number of total routees
                cluster {
                    enabled = on
                    allow-local-routees = off
                    use-role = Process
                }
              }
            }
            debug {
              receive = on
              autoreceive = on
              lifecycle = on
              event-stream = on
              unhandled = on
            }
        }
        akka.remote {
            helios.tcp {
                # transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                # applied-adapters = []
                # transport-protocol = tcp
                port = 0
                hostname = 172.16.1.8
            }
            log-remote-lifecyclo-events = DEBUG
        }
        akka.cluster {
          seed-nodes = [
            "akka.tcp://ClusterActorSystem@172.16.1.8:2551",
            "akka.tcp://ClusterActorSystem@172.16.1.8:2552"
          ]
          roles = [Send]
          auto-down-unreachable-after = 10s
          # how often should the node send out gossip information?
          gossip-interval = 1s
          # discard incoming gossip messages if not handled within this duration
          gossip-time-to-live = 2s
        }
        # http://getakka.net/docs/persistence/at-least-once-delivery
        akka.persistence.at-least-once-delivery.redeliver-interval = 300s
        # akka.persistence.at-least-once-delivery.redelivery-burst-limit =
        # akka.persistence.at-least-once-delivery.warn-after-number-of-unconfirmed-attempts =
        akka.persistence.at-least-once-delivery.max-unconfirmed-messages = 1000000
        akka.persistence.journal.plugin = "akka.persistence.journal.sql-server"
        akka.persistence.journal.publish-plugin-commands = on
        akka.persistence.journal.sql-server {
            class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
            plugin-dispatcher = "akka.actor.default-dispatcher"
            table-name = EventJournal
            schema-name = dbo
            auto-initialize = on
            connection-string-name = "HubAkkaPersistence"
            refresh-interval = 1s
            connection-timeout = 30s
            timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
            metadata-table-name = Metadata
        }
        akka.persistence.snapshot-store.plugin = ""akka.persistence.snapshot-store.sql-server""
        akka.persistence.snapshot-store.sql-server {
          class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"
          plugin-dispatcher = ""akka.actor.default-dispatcher""
          connection-string-name = "HubAkkaPersistence"
          schema-name = dbo
          table-name = SnapshotStore
          auto-initialize = on
        }
  ]]>
</hocon>

在 global.asax 中,我们为集群创建了一个新路由器:

    ClusterActorSystem = ActorSystem.Create("ClusterActorSystem");

    var backendRouter =
        ClusterActorSystem.ActorOf(
            Props.Empty.WithRouter(FromConfig.Instance), "Process");

    Send = SistemiHubClusterActorSystem.ActorOf(
        Props.Create(() => new Common.Actors.Send(backendRouter)),
        "Send");

这是我们的后端配置:

<hocon><![CDATA[
    akka.loglevel = INFO
    akka.log-config-on-start = on
    akka.stdout-loglevel = INFO
    akka.actor {
        provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
        debug {
          receive = on
          autoreceive = on
          lifecycle = on
          event-stream = on
          unhandled = on
        }
    }
    akka.remote {
      helios.tcp {
            # transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
            # applied-adapters = []
            # transport-protocol = tcp
            # 
            # seed-node ports 2551 and 2552
            # non-seed-node port 0
            port = 2551
            hostname = 172.16.1.8
        }
        log-remote-lifecyclo-events = INFO
    }
    akka.cluster {
      seed-nodes = [
        "akka.tcp://ClusterActorSystem@172.16.1.8:2551",
        "akka.tcp://ClusterActorSystem@172.16.1.8:2552"
      ]
      roles = [Process]
      auto-down-unreachable-after = 10s
    }
  ]]></hocon>

目前使用 Akka 1.1 和 Akka 1.2 的问题

更新

如果我直接调用每个 IIS 工作正常,我发现问题与我们的 LoadBalancer (NetScaler) 有关。如果被平衡器调用,我将面临报告的问题;平衡器是透明的(它只向请求添加一些标头)。我可以检查什么来解决这个问题?

4

1 回答 1

0

最后我发现了问题,我们正在使用 akka.persistence,它需要每个 IIS 的 PersistenceId 的特定值偏角。

于 2017-07-07T06:46:51.413 回答