This case shows Hashicorp's Serf product.
- Intro
- Serf Benefits
- Problem Solving
- Running the Agent
- Joining the Cluster
- Leaving the Cluster
- Events
- Custom Events
- Custom Queries
Serf is a tool for:
- Cluster Membership
- Failure Detection
- De-centralized Orchestration
- Decentralized
- Fault Tolerant
- Self-Healing
- Highly Available
- Membership
- Failure Detection & Recovery
- Custom Event Propagation
serf agentserf membersGracefully Leave
serf leaveor
Ctrl-CForcefully Leave
serf force-leaveStarting multiple agents...
serf agent -node=agent-one -bind=127.20.20.10
serf agent -node=agent-one -bind=127.20.20.11Telling 1st agent to join the 2nd agent will involve going into the 1st agent and telling it to join the 2nd agent:
serf join 127.20.20.11You can check the status of agents after joining by Checking Cluster members
To leave just stop the agent you want to leave. See options in Stopping Agent section.
Serf currently invokes the following types of events:
- member-join
- member-leave
- member-failed
- member-update
- member-reap
- user
- query
Starting a Serf agent with the event handler.
serf agent -log-level=debug -event-handler=handler.shflagging the serf agent in log level debug mode so we can see the stdin/stderr of the events.
To send a custom event we simply do:
serf event [your custom event]E.g. to query the load
serf query loadwhich can then be combined with Custom Events' an Event Handler to send back responses. In this particular example, we can send back load times of machines.