dotnet / dotNext

Next generation API for .NET
https://dotnet.github.io/dotNext/
MIT License
1.56k stars 119 forks source link

Cluster node status #209

Closed sad1y closed 5 months ago

sad1y commented 7 months ago

Issue

I expect that after I've added node to the cluster it should be Available for every node in cluster.

How to reproduce

Get project from https://github.com/sad1y/ClusteringTest Run script from root of project

dotnet run -- 9000 &
dotnet run -- 9001 &
dotnet run -- 9002 &

Check cluster state (on any node)

curl -i -XGET http://localhost:8000/cluster

Response should looks like this

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 05 Dec 2023 10:59:32 GMT
Server: Kestrel
Transfer-Encoding: chunked

"***00/Available,***01/Available,***03/Available"

Create new node

dotnet run -- 9003 &

Now, add new node through the master (in my case it is on port 8000)

dotnet run -- 9003 &
curl -i -XPOST http://localhost:8000/cluster -H "Content-Type: application/json" -d '{ "address": "127.0.0.1", "port": 9003 }'

Check cluster state on new node

curl -i -XGET http://localhost:8003/cluster
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 05 Dec 2023 10:59:32 GMT
Server: Kestrel
Transfer-Encoding: chunked
***00/Unknown,***01/Unknown,***02/Unknown,***03/Available

new node sees only itself

Check cluster state on non-master node

curl -i -XGET http://localhost:8002/cluster
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 05 Dec 2023 10:59:32 GMT
Server: Kestrel
Transfer-Encoding: chunked
***00/Available,***01/Available,***02/Available,***03/Unknown

any non-master node doesn't see newcomer

What else?

I set log level to Debug and observe that kind of messages

Local changes are not committed. Quorum is 4, last committed entry is 2
sakno commented 7 months ago

new node sees only itself

Correct, because follower node doesn't interact with the rest of cluster. Only leader node knows the state of each member.