Skip to content

Instantly share code, notes, and snippets.

@mikespokefire
Last active December 28, 2015 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikespokefire/7485840 to your computer and use it in GitHub Desktop.
Save mikespokefire/7485840 to your computer and use it in GitHub Desktop.
# On Machine A
serf agent -bind 192.168.50.10
# On Machine B
serf agent -bind 192.168.50.20
serf join 192.168.50.10
# On Machine A (with some time between each command)
serf event deploy feature/testing
serf event test-event payload
serf event deploy feature/testing
serf event test-event payload
# Wait for events to broadcast
# On Machine A
pkill serf
# Wait for Machine B to notice the node has failed
# On Machine A
serf agent -bind 192.168.50.10
# Wait for Machine B to notice Machine A is back up again
# All user events will be replayed, but not member-join, member-leave etc.
# On Machine C
serf agent -bind 192.168.50.30
serf join 192.168.50.10
# Machine C will join the cluster, the only event fired is member-join
serf agent -bind 192.168.50.10
==> Starting Serf agent...
==> Serf agent running!
Node name: 'alpha.example.com'
Bind addr: '192.168.50.10:7946'
RPC addr: '127.0.0.1:7373'
Encrypted: false
==> Log data will now stream in as it occurs:
2013/11/15 15:49:57 [INFO] Serf agent starting
2013/11/15 15:49:57 [INFO] serf: EventMemberJoin: alpha.example.com 192.168.50.10
2013/11/15 15:49:57 [INFO] Serf agent started
2013/11/15 15:49:58 [INFO] agent: Received event: member-join
2013/11/15 15:50:01 [INFO] Agent joining: [bravo]
2013/11/15 15:50:01 [INFO] Initiating push/pull sync with: 192.168.50.20:7946
2013/11/15 15:50:01 [INFO] serf: EventMemberJoin: bravo.example.com 192.168.50.20
2013/11/15 15:50:02 [INFO] agent: Received event: member-join
2013/11/15 15:50:07 Requesting user event send: deploy. Coalesced: true. Payload: "feature/testing"
2013/11/15 15:50:08 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:10 Requesting user event send: test-event. Coalesced: true. Payload: "payload"
2013/11/15 15:50:11 [INFO] agent: Received event: user-event: test-event
2013/11/15 15:50:14 Requesting user event send: deploy. Coalesced: true. Payload: "feature/testing"
2013/11/15 15:50:15 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:17 Requesting user event send: test-event. Coalesced: true. Payload: "payload"
2013/11/15 15:50:18 [INFO] agent: Received event: user-event: test-event
vagrant@alpha:~$ serf agent -bind 192.168.50.10
==> Starting Serf agent...
==> Serf agent running!
Node name: 'alpha.example.com'
Bind addr: '192.168.50.10:7946'
RPC addr: '127.0.0.1:7373'
Encrypted: false
==> Log data will now stream in as it occurs:
2013/11/15 15:50:38 [INFO] Serf agent starting
2013/11/15 15:50:38 [INFO] serf: EventMemberJoin: alpha.example.com 192.168.50.10
2013/11/15 15:50:38 [INFO] Serf agent started
2013/11/15 15:50:39 [INFO] agent: Received event: member-join
2013/11/15 15:50:58 [INFO] Responding to push/pull sync with: 192.168.50.20:50882
2013/11/15 15:50:58 [INFO] serf: EventMemberJoin: bravo.example.com 192.168.50.20
2013/11/15 15:50:58 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:58 [INFO] agent: Received event: user-event: test-event
2013/11/15 15:50:58 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:58 [INFO] agent: Received event: user-event: test-event
2013/11/15 15:50:59 [INFO] agent: Received event: member-join
2013/11/15 15:51:10 [INFO] Responding to push/pull sync with: 192.168.50.30:47777
2013/11/15 15:51:10 [INFO] serf: EventMemberJoin: charlie.example.com 192.168.50.30
2013/11/15 15:51:11 [INFO] agent: Received event: member-join
serf agent -bind 192.168.50.20
==> Starting Serf agent...
==> Serf agent running!
Node name: 'bravo.example.com'
Bind addr: '192.168.50.20:7946'
RPC addr: '127.0.0.1:7373'
Encrypted: false
==> Log data will now stream in as it occurs:
2013/11/15 15:49:58 [INFO] Serf agent starting
2013/11/15 15:49:58 [INFO] serf: EventMemberJoin: bravo.example.com 192.168.50.20
2013/11/15 15:49:58 [INFO] Serf agent started
2013/11/15 15:49:59 [INFO] agent: Received event: member-join
2013/11/15 15:50:01 [INFO] Responding to push/pull sync with: 192.168.50.10:45463
2013/11/15 15:50:01 [INFO] serf: EventMemberJoin: alpha.example.com 192.168.50.10
2013/11/15 15:50:02 [INFO] agent: Received event: member-join
2013/11/15 15:50:08 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:12 [INFO] agent: Received event: user-event: test-event
2013/11/15 15:50:15 [INFO] agent: Received event: user-event: deploy
2013/11/15 15:50:18 [INFO] agent: Received event: user-event: test-event
2013/11/15 15:50:29 [INFO] serf: EventMemberFailed: alpha.example.com 192.168.50.10
2013/11/15 15:50:30 [INFO] agent: Received event: member-failed
2013/11/15 15:50:58 [INFO] serf: attempting reconnect to alpha.example.com 192.168.50.10
2013/11/15 15:50:58 [INFO] Initiating push/pull sync with: 192.168.50.10:7946
2013/11/15 15:50:58 [INFO] serf: EventMemberJoin: alpha.example.com 192.168.50.10
2013/11/15 15:50:59 [INFO] agent: Received event: member-join
2013/11/15 15:51:10 [INFO] serf: EventMemberJoin: charlie.example.com 192.168.50.30
2013/11/15 15:51:10 [INFO] Initiating push/pull sync with: 192.168.50.30:7946
2013/11/15 15:51:11 [INFO] agent: Received event: member-join
serf agent -bind 192.168.50.30
==> Starting Serf agent...
==> Serf agent running!
Node name: 'charlie.example.com'
Bind addr: '192.168.50.30:7946'
RPC addr: '127.0.0.1:7373'
Encrypted: false
==> Log data will now stream in as it occurs:
2013/11/15 15:51:06 [INFO] Serf agent starting
2013/11/15 15:51:06 [INFO] serf: EventMemberJoin: charlie.example.com 192.168.50.30
2013/11/15 15:51:06 [INFO] Serf agent started
2013/11/15 15:51:07 [INFO] agent: Received event: member-join
2013/11/15 15:51:10 [INFO] Agent joining: [192.168.50.10]
2013/11/15 15:51:10 [INFO] Initiating push/pull sync with: 192.168.50.10:7946
2013/11/15 15:51:10 [INFO] serf: EventMemberJoin: bravo.example.com 192.168.50.20
2013/11/15 15:51:10 [INFO] serf: EventMemberJoin: alpha.example.com 192.168.50.10
2013/11/15 15:51:10 [INFO] Responding to push/pull sync with: 192.168.50.20:49642
2013/11/15 15:51:11 [INFO] agent: Received event: member-join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment