Skip to content

Commit

Permalink
Merge pull request #625 from fluent/dns_roundrobin
Browse files Browse the repository at this point in the history
out_forward: Support dns round robin
  • Loading branch information
repeatedly committed Jul 1, 2015
2 parents 6002b9b + a39ad3c commit e13cc27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions example/in_forward.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<source>
type forward
</source>

<match test>
type stdout
</match>
7 changes: 6 additions & 1 deletion example/out_forward.conf
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<source>
type forward
type dummy
tag test
</source>

<match test>
type forward

<server>
# first server
host localhost
port 24224
</server>
<server>
# second server
host localhost
port 24225
</server>
<server>
# second server
host localhost
port 24226
standby
</server>

flush_interval 1
send_timeout 60
heartbeat_type udp
heartbeat_interval 1
Expand Down
5 changes: 2 additions & 3 deletions lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,8 @@ def resolved_host
end

def resolve_dns!
@sockaddr = Socket.pack_sockaddr_in(@port, @host)
port, resolved_host = Socket.unpack_sockaddr_in(@sockaddr)
return resolved_host
# sample to support dns round robin
Socket.getaddrinfo(@host, @port).sample[3]
end
private :resolve_dns!

Expand Down

0 comments on commit e13cc27

Please sign in to comment.