akkadotnet / akka.net

Canonical actor model implementation for .NET with local + distributed actors in C# and F#.
http://getakka.net
Other
4.72k stars 1.04k forks source link

Sample Cleanup: have Akka.Cluster.Sharding sample run on multiple nodes #3608

Open Aaronontheweb opened 6 years ago

Aaronontheweb commented 6 years ago

We should change https://github.com/akkadotnet/akka.net/tree/dev/src/examples/Cluster/ClusterSharding/ClusterSharding.Node to have it actually run on multiple nodes instead of just a single node, since that's more illustrative of real-world behavior than the single-node mode it uses right now.

Looks like that can be configured via the SQLite database, but it'd be easier to just discard that and have the code fire up multiple nodes like how it does for other samples.

shauryapatel27 commented 5 years ago

Hey, according to what I understand, I just need to change this particular piece of code.

        var members = _dbHelper.GetClusterMembers().ToImmutableList();
        if (members.Any())
        {
            _cluster.JoinSeedNodes(members);
            _dbHelper.AddClusterMember(_cluster.SelfAddress);
        }
        else
        {
            var self = _cluster.SelfAddress;
            _dbHelper.AddClusterMember(self);
            _cluster.JoinSeedNodes(ImmutableList.Create(self));
        }
    }

If so, I'd like to try to take up this issue.

Aaronontheweb commented 5 years ago

@shauryapatel27 you'll need to do that and maybe the Akka.Persistence backend (might be issues with multiple nodes all trying to write to SQLite). But by all means, please go ahead and give it a try!

shauryapatel27 commented 5 years ago

If there is no deadline on this then yes I want to try to take this one

pierrebelin commented 1 year ago

@Aaronontheweb Is this issue still opened ? I can take it if needed

Aaronontheweb commented 1 year ago

@Aaronontheweb Is this issue still opened ? I can take it if needed

It's still open! We would welcome any help we can get here

pierrebelin commented 1 year ago

@Aaronontheweb Is this issue still opened ? I can take it if needed

It's still open! We would welcome any help we can get here

I'm not sure on the issue. I checked inside the docker-compose, and it seems to have already 3 nodes (node-1, node-2 and node-3). Is it already in multi nodes or did I missed something? I started it locally, and it seems that there are multiples things to fix:

  1. network_mode “host” is incompatible with port_bindings (cf : Docker forum)
  2. when I start the configuration, nodes are not able to communicate with each others (AssociationError [akka.tcp://sharded-cluster-system@localhost:6057] -> akka.tcp://sharded-cluster-system@localhost:6055: Error [Connection refused tcp://sharded-cluster-system@localhost:6055]). It might comes from the docker compose configuration above. Should I just work on this configuration issue or should I also add behavior for nodes?
Aaronontheweb commented 1 year ago

@pierrebelin all yours!