Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Member Roles doc #5742

Merged
merged 23 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/articles/clustering/node-roles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
uid: node-roles
title: Node Roles
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called "Member Roles"

---

# Node Roles

Not all nodes of a cluster need to perform the same function. For example, there might be one sub-set which runs the web front-end, one which runs the data access layer and one for the number-crunching. Choosing which actors to start on each node, for example cluster-aware routers, can take node roles into account to achieve this distribution of responsibilities.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to expand this:

  • Why are roles important?
  • How are they used elsewhere in different parts of Akka.Cluster (this should be a bulleted list) ?
  • What do they allow end-users to do?


The node roles are defined in the configuration property named `akka.cluster.roles` and typically defined in the start script as a system property or environment variable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show an example


The roles are part of the membership information in `MemberEvent` that you can subscribe to. The roles of the own node are available from the `SelfMember` and that can be used for conditionally starting certain actors:

```csharp
var selfMember = Cluster.Get(_actorSystem).SelfMember;
if (selfMember.HasRole("backend"))
{
context.ActorOf(Backend.Prop(), "back");
}
else if (selfMember.HasRole("front"))
{
context.ActorOf(Frontend.Prop(), "front");
}
```
4 changes: 3 additions & 1 deletion docs/articles/clustering/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
- name: Distributed Data
href: distributed-data.md
- name: Split Brain Resolver
href: split-brain-resolver.md
href: split-brain-resolver.md
- name: Node Roles
href: node-roles.md