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

bind on specific address #195

Closed
wants to merge 3 commits into from
Closed

bind on specific address #195

wants to merge 3 commits into from

Conversation

schmurfy
Copy link
Contributor

How can I bind all the servers on a specific address ?
I tried to play around with the config and looked at the sources but I am not familiar enough with go to find the solution (and the config file led me nowhere either).

@pauldix
Copy link
Member

pauldix commented Jan 21, 2014

Should be able to do this. Added to 0.5.0 milestone

@schmurfy
Copy link
Contributor Author

I made a dirty patch replacing most occurences of ":%s" by "127.0.0.1:%s", I can try to make a proper patch from that but I am not sure what make the most sense:

  • add an bind_address option to each config block in the config
  • add a global bind_address used by every service

does anyone have a use case for per service bind_address ?

For my own use case the server has a private interface and a public one and I want to bind everything on the private interface so a global settings is enough for now.

@jvshahid
Copy link
Contributor

I think the global setting is fine until we have a use case for a per server bind address. @schmurfy do you want to make this change ?

@schmurfy
Copy link
Contributor Author

yeah I will give it a shot tomorrow, I think I understand the codebase enough now to do it :)

@jvshahid
Copy link
Contributor

cool, let us know if you need help.

@schmurfy
Copy link
Contributor Author

I think it should work but for some reason I cannot compile even on master, I have this error:

src/coordinator/raft_server.go:312: s.raftServer.AddEventListener undefined (type raft.Server has no field or method AddEventListener)
src/coordinator/raft_server.go:312: undefined: raft.StateChangeEventType
src/coordinator/raft_server.go:370: undefined: raft.Event
make: *** [build] Error 2

@jvshahid
Copy link
Contributor

delete src/github.com/goraft, or run go get -u github.com/goraft/raft

@jvshahid
Copy link
Contributor

You also did the change for the raft server only. Was that intentional ?

@schmurfy
Copy link
Contributor Author

it works way better after removing goraft, any idea what happened ?

I fixed an issue with config parsing and now everything seems to work, what did you mean by raft server only ?

@jvshahid
Copy link
Contributor

You had an old version of goraft checked out.

You initially mentioned that you want all servers to bind to a certain address. Currently there're 4 servers:

  1. raft server
  2. protobuf server
  3. admin server
  4. http server

I think all 4 should bind to the same address. What do you think ?

@schmurfy
Copy link
Contributor Author

That was the idea yeah but with my current changes they already seem to all bind on localhost:

$ lsof -nPi | grep daemon
daemon    58178 Schmurfy   16u  IPv4 0xdb12a52bb682dc47      0t0  TCP 127.0.0.1:8090 (LISTEN)
daemon    58178 Schmurfy   17u  IPv4 0xdb12a52bb667545f      0t0  TCP 127.0.0.1:8099 (LISTEN)
daemon    58178 Schmurfy   20u  IPv4 0xdb12a52bb6676c47      0t0  TCP 127.0.0.1:8086 (LISTEN)
daemon    58178 Schmurfy   21u  IPv4 0xdb12a52bb667f45f      0t0  TCP 127.0.0.1:8083 (LISTEN)

In my initial testing (my dirty patch) changing the address string returned by the config parser was enough and that's what I did in this patch, I had to update the raft_server file because it does things differently: instead of using directly the return value from the config file it is reformatted before use.

@jvshahid
Copy link
Contributor

Got it. That looks good to me. I'll merge it in a second. Thanks @schmurfy

@jvshahid jvshahid closed this in 50942ef Jan 22, 2014
jvshahid pushed a commit that referenced this pull request Aug 12, 2014
fix(server.go) fix potential deadlock when removing nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants