Skip to content

Instantly share code, notes, and snippets.

@lukebakken
Last active November 23, 2016 17:44
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 lukebakken/81c0609c274b083272f182443a6267f5 to your computer and use it in GitHub Desktop.
Save lukebakken/81c0609c274b083272f182443a6267f5 to your computer and use it in GitHub Desktop.
Riak / haproxy
global
log /dev/log local0 info
pidfile /home/lbakken/run/haproxy.pid
defaults
log global
timeout connect 1s
timeout client 50ms
timeout server 1s
backend riak_rest_backend
mode http
option httplog
server riak1 ipv4@localhost:10018
frontend riak_rest
bind ipv4@localhost:8098
mode http
option contstats
default_backend riak_rest_backend
backend riak_protocol_buffer_backend
mode tcp
option tcpka
option srvtcpka
server riak1 ipv4@localhost:10017
frontend riak_protocol_buffer
bind ipv4@localhost:8087
mode tcp
option tcplog
option contstats
mode tcp
option tcpka
default_backend riak_protocol_buffer_backend
import riak,time
bn = 'riak-haproxy'
kn = 'riak-haproxy'
riak.RiakClient.retries = 1
c = riak.RiakClient()
# b = c.bucket(bn)
# b.new(kn, data={"foo": "one", "bar": "baz"}).store()
items = []
i = 0
while i < 3:
print(c.ping())
# for itm in c.stream_buckets():
# for itm in c.stream_keys(b):
# items.extend(itm)
# print('ITEMS:\n')
# print(items)
# print('\n')
time.sleep(1)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment