项目作者: atongen

项目描述 :
Listens to redis sentinels and updates twemproxy config after failover
高级语言: Go
项目地址: git://github.com/atongen/tpc.git
创建时间: 2017-10-05T21:40:16Z
项目社区:https://github.com/atongen/tpc

开源协议:

下载


tpc

tpc roughly stands for Twemproxy Configurator

Listens to a cluster of redis sentinel servers via pubsub.
Rewrites twemproxy config file and executes twemproxy reload command when
sentinel notifies of redis master failover.

Install

Download the latest release, extract it,
and put it somewhere on your PATH.

or

  1. $ go get github.com/atongen/tpc

or

  1. $ mkdir -p $GOPATH/src/github.com/atongen
  2. $ cd $GOPATH/src/github.com/atongen
  3. $ git clone git@github.com:atongen/tpc.git
  4. $ cd tpc
  5. $ go install
  6. $ rehash

Testing

  1. $ cd $GOPATH/src/github.com/atongen/tpc
  2. $ go test -cover

Releases

  1. $ mkdir -p $GOPATH/src/github.com/atongen
  2. $ cd $GOPATH/src/github.com/atongen
  3. $ git clone git@github.com:atongen/tpc.git
  4. $ cd tpc
  5. $ make release

Command-Line Options

  1. λ tpc -h
  2. Usage of tpc:
  3. -auto_eject_hosts
  4. Twemproxy: A boolean value that controls if server should be ejected temporarily when it fails consecutively server_failure_limit times.
  5. -backlog int
  6. Twemproxy: TCP backlog argument (default 1024)
  7. -channel string
  8. Slack: channel for notifications (default "#incidents")
  9. -client_connections int
  10. Twemproxy: The maximum number of connections allowed from redis clients (default 4096)
  11. -cmd string
  12. Process: Command to execute after master failover
  13. -distribution string
  14. Twemproxy: Key distribution (default "ketama")
  15. -has_tag string
  16. Twemproxy: A two character string that specifies the part of the key used for hashing. Eg '{}' or '$$'
  17. -hash string
  18. Twemproxy: Hash algorithm (default "fnv1a_64")
  19. -icon_emoji string
  20. Slack: icon emoji for notifications
  21. -ip string
  22. Twemproxy: Ip address (default "0.0.0.0")
  23. -listen_address string
  24. Prometheus: Listen address (default ":9298")
  25. -log string
  26. Process: Path to log file, will write to STDOUT if empty
  27. -master_pattern string
  28. Process: If provided, will filter master names from sentinel based on pattern
  29. -name string
  30. Twemproxy: Name of redis pool (default "redis")
  31. -out string
  32. Process: File to write configuration, will write to STDOUT if empty
  33. -backup string
  34. Process: Directory to write backup files, will write to STDOUT if empty
  35. -port int
  36. Twemproxy: Port (default 9000)
  37. -preconnect
  38. Twemproxy: A boolean value that controls if we should preconnect to all the servers in this pool on process start (default true)
  39. -redis_auth string
  40. Twemproxy: authenticate to the redis server on connect
  41. -redis_db int
  42. Twemproxy: The DB number to use on the redis pool servers. Twemproxy will always present itself to clients as DB 0
  43. -sentinels string
  44. Process: CSV of host:port to redis sentinels
  45. -server_connections int
  46. Twemproxy: The maximum number of connections that can be open to each server (default 1)
  47. -server_failure_limit int
  48. Twemproxy: The number of consecutive failures on a server that would lead to it being temporarily ejected when auto_eject_host is set to true. (default -1)
  49. -server_retry_timeout int
  50. Twemproxy: The timeout value in msec to wait for before retrying on a temporarily ejected server, when auto_eject_host is set to true. (default -1)
  51. -telemetry_path string
  52. Prometheus: Telemetry path (default "/metrics")
  53. -timeout int
  54. Twemproxy: The timeout value in msec that we wait for to establish a connection to the server or receive a response from a server. (default -1)
  55. -token string
  56. Slack: API token used for notifications
  57. -username string
  58. Slack: username for notifications
  59. -v Print version information and exit

Issues

twemproxy hot reload

There is a long-running twemproxy feature branch that is supposed to bring config hot-reload via unix signal:

Currently the solution is to pause the redis clients, then stop and restart the twemproxy process.