2017-07-15 152 views
0

在我們的集羣,我們有四個節點複合:akka.cluster和持久性提供問題

  • 2種子節點(後端)
  • 1工人在IIS

  • 1的WebAPI集羣加入並運行;當我發個帖子中的WebAPI,:

    • IIS加入集羣
    • 的API收到的一個職位,併發送一個消息告訴
    • 消息處理兩次或三次!
    • 是隻發生於當IIS連接,下面的消息被工作正常發送的消息

    這裏是我的IIS配置:

    <akka> 
        <hocon> 
        <![CDATA[ 
          akka.loglevel = INFO 
          akka.log-config-on-start = off 
          akka.stdout-loglevel = INFO 
          akka.actor { 
           provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster" 
           deployment { 
            /TheProcess { 
            router = round-robin-group 
            routees.paths = ["/user/TheProcess"] # path of routee on each node 
            # nr-of-instances = 3 # max number of total routees 
            cluster { 
             enabled = on 
             allow-local-routees = off 
             use-role = TheProcess 
            } 
            }        
           } 
           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 
               # public-hostname = "localhost" 
            # 0 or 46001-46010 
            port = 0 
            hostname = "localhost" 
           } 
           log-remote-lifecyclo-events = DEBUG 
          } 
          akka.cluster { 
           seed-nodes = [ 
           "akka.tcp://[email protected]:2551", 
           "akka.tcp://[email protected]:2552" 
           ] 
           roles = [TheSend] 
           # 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 = "AkkaPersistence" 
           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 = "AkkaPersistence" 
           schema-name = dbo 
           table-name = SnapshotStore 
           auto-initialize = on 
          } 
         ]]> 
        </hocon> 
    

    這裏是我的後端配置:

    <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 
             # public-hostname = "localhost" 
           # 
           # seed-node ports 2551 and 2552 
           # non-seed-node port 0 or 46001-46010 
           port = 2551 
           hostname = "localhost" 
          } 
          log-remote-lifecyclo-events = INFO 
         } 
         akka.cluster { 
          seed-nodes = [ 
          "akka.tcp://[email protected]:2551", 
          "akka.tcp://[email protected]:2552" 
          ] 
          roles = [TheProcess] 
          # auto-down-unreachable-after = 10s 
         } 
         ]]> 
        </hocon> 
    

    我覺得問題是阿卡持久性相關,問題是什麼?

  • 回答

    0

    最後解決,persistenceId必須按照IIS實例如下規定進行設置:

    標識符

    一個持久的演員必須有確實在不同的演員變身沒有 變化的標識符。標識符必須是用PersistenceId方法定義的 。

    所以我已經把一個配置鍵,以便爲每個特定的IIS實例設置正確的persistenceId。

    如果在ReceiveCommand上執行UnstashAll,導致多次傳遞,還有一個else。