avito-tech / bioyino

High performance and high-precision multithreaded StatsD server
The Unlicense
228 stars 22 forks source link

Replication and raft clients on node with several interfaces #40

Closed msaf1980 closed 5 years ago

msaf1980 commented 5 years ago

Add options to bind client sockets for replication and raft to specific IP.

Albibek commented 5 years ago

When specifying raft nodes, you can use this-node parameter to set such binding.

msaf1980 commented 5 years ago

It does not solve. Client socket for raft thread (and may be replication too) not bind to specified address TcpStream::connect not do this, instead of TcpStream::connect_std with custom stream, created and binded with net2::TcpBuilder https://github.com/Albibek/raft-tokio/blob/master/src/tcp.rs#L219

Albibek commented 5 years ago

I agree. Going to add this feature soon.

msaf1980 commented 5 years ago

Good news ! I try to add this feature (in raft-tokio and bioyino). Socket was binding to correct address, and work as planned. But leader election don't work without any errors in log (cluster split brain with many master). And at this time I don't undestand why. https://github.com/msaf1980/raft-tokio/commits/master https://github.com/msaf1980/bioyino/tree/statsite-bind

Albibek commented 5 years ago

Try enabling trace log in bioyino/raft-tokio. Raft-tokio logs almos every fail there

Albibek commented 5 years ago

You can also try running cargo test -- --nocapture with patched raft-tokio, it will print trace logs by default. This will allow to at least localize problem to either bioyino or rafto-tokio.

msaf1980 commented 5 years ago

Hello. I patched raft-tokio and bioyino for this.

https://github.com/Albibek/raft-tokio/pull/2 https://github.com/avito-tech/bioyino/pull/43

Albibek commented 5 years ago

The binding of raft protocol client is in 0.5.0 branch. Snapshot client is the next target. I suppose, carbon client needs the same option as well.

msaf1980 commented 5 years ago

For carbon client - may be in some cases, but it's not necessary for our environment