Concepts about agent and client

67 views
Skip to first unread message

Daniel Gerep

unread,
May 8, 2020, 6:00:01 AM5/8/20
to Serf
Hello good people,

I am trying to understand how Serf works using it as a library so I can embed it in my code.

Made some tests using the CLI and I was able to start a few agents and handle some events.

My next step was to embed it in my code. I have a service running on a server and an API on another server.

The intention is to have Serf's agent running with my service and from time-to-time, the API will send an event to the agent.

In my service server I start the Serf agent like this (but with the server's IP):

 conf := serf.DefaultConfig()
 conf
.NodeName = "node-a"
 conf
.MemberlistConfig.BindAddr = "127.0.0.1"
 conf
.MemberlistConfig.BindPort = 6666
 conf
.MemberlistConfig.AdvertiseAddr = "127.0.0.1"
 conf
.MemberlistConfig.AdvertisePort = 6666

In my API I thought I had to create a Serf client that connects to the agent. The client library gives me the function call NewRPCClient(addr string) (*RPCClient, error) but it turns out that the server running my service has nothing running on port 7373.

I am sure I am messing with the concepts here but I think that I thought about it too much and can't get my head around it.

Can someone please help?
Reply all
Reply to author
Forward
0 new messages