Skip to content

Latest commit

 

History

History
110 lines (61 loc) · 3.14 KB

hashers.md

File metadata and controls

110 lines (61 loc) · 3.14 KB

Process all the lines

Here you'll find some things around the basic config info for accepting metrics, and consistent hashing them.

For a detailed config overview see the config doc.

Listen Server Types

All inputs and out puts can be tcp, udp, unix socket, or http

tcp -> tcp://127.0.0.1:2003
udp -> udp://127.0.0.1:8125
unix -> unix:///my/socket.sock
http -> http://moo.org/stats

http expects the BODY of the request to basically be the lines

GET /stats HTTP/1.1
Host: moo.org
Accept: */*

key value thing
key value thing2

There is also a special listen called backend_only which is simply a place where things can routed to internally (from say a PreReg filter or Accumulator) that then out puts to it's consthash server outgoing list

Internal Stats

config section

[health]
enabled=true
listen="0.0.0.0:6061"
## stats are "rendered" every 5 seconds, so this will keep last
## `internal_health_server_points` in RAM (careful with how many you store)
## (use the statsd emitter to store longer term stuff)
points=500

# https this server if desired
# key="/tmp/server.key"
# cert="/tmp/server.crt"

It runs it's own micro stats server so you can ping it for it's internal stats (very lightweight at the moment) We can make a fancy status page when necessary

# for a little interface to the stats

localhost:6061/

# the json blob stats for the above html file

localhost:6061/stats

# if you want just a specific server set

localhost:6061/echo-example/stats

It will also emit it's owns stats to statsd as well using a buffered internal statsd client.

Handy "what are the URL" reference (because i always forget myself)

http://localhost:6061/servers

Status

If you have some checker (say nagios) and you want to get the helath status of the server itself

localhost:6061/ops/status

IF you want a specific server set

localhost:6061/echo-example/ops/status

Check Keys/Server pairs

You can "check" what server a given "key/line" will go to as well using a little json GET url

localhost:6061/hashcheck?key=XXXXXX

This will dump out the server this key will go to and the actuall "hash" value for it for all various running hash servers

Add/Remove hosts dynamically

You can also Add and remove servers from the hashpool via a POST/PUT

curl localhost:6061/echo-example/addserver --data "server=tcp://127.0.0.1:6004"

 PARAMS:
 
 - server: url : url of the host to add (udp/tcp)
 - check_server: url: url of the server to "check" for the above server that it is alive (defaults to `server`)
 - hashkey: string: the "string" that is the KEY for the hash algo (see `hashkeys` in the TOML config)
 - replica: int: the index of the replica (if any) for a server definition (defaults to 0)

curl localhost:6061/echo-example/purgeserver --data "server=tcp://127.0.0.1:6004"

PARAMS:

- server: url : url of the host to add (udp/tcp)
- replica: int: the index of the replica (if any) for a server definition (defaults to 0)