{"id":18834478,"url":"https://github.com/fgouteroux/thanos-receive-controller","last_synced_at":"2026-01-26T11:30:17.760Z","repository":{"id":71765742,"uuid":"490202703","full_name":"fgouteroux/thanos-receive-controller","owner":"fgouteroux","description":"Automatically configure Thanos receive hashrings and dynamically scale up or down the hashring in case of faulty nodes.","archived":false,"fork":false,"pushed_at":"2022-05-09T08:56:39.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T07:42:24.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fgouteroux.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-09T08:46:06.000Z","updated_at":"2022-09-15T11:50:20.000Z","dependencies_parsed_at":"2023-06-09T21:30:11.106Z","dependency_job_id":null,"html_url":"https://github.com/fgouteroux/thanos-receive-controller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fthanos-receive-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fthanos-receive-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fthanos-receive-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fthanos-receive-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgouteroux","download_url":"https://codeload.github.com/fgouteroux/thanos-receive-controller/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768923,"owners_count":19693764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T02:12:36.487Z","updated_at":"2026-01-26T11:30:17.688Z","avatar_url":"https://github.com/fgouteroux.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thanos Receive Controller\n\nThe Thanos Receive Controller configures multiple hashrings of Thanos receivers.  \nBased on an initial hashring file, the controller identifies each healthy/ready endpoint and generates a complete configuration file.\n\n## Usage\n\n```shell\nUsage of thanos-receive-controller:\n  -directory string\n      Directory path to watch hashring files. (mutually exclusive with '--file')\n  -endpoint-port-offset int\n      Endpoint port offset to perform readiness requests. (default 1)\n  -endpoint-scheme string\n      Endpoint scheme to perform readiness requests. (default \"http\")\n  -endpoint-timeout int\n      Endpoint timeout to perform readiness requests. (default 5)\n  -file string\n      Hashring filepath to watch. (mutually exclusive with '--directory')\n  -interval int\n      Watcher Scheduler interval in seconds. (default 10)\n  -owner string\n      Set owner on generated hashring files. (default \"thanos\")\n  -schedule\n      Enable hashring files watcher scheduler.\n  -verbose\n      Enabled verbose mode.\n  -version\n      Show version.\n```\n\nThanos Receive Controller read an hashring file and performs http request on each node to check the readiness.\nIf the node is down or not ready, the endpoint will be not added in the generated file.\n\nThere is a sha256 checksum check to avoid overwrite the generated file with the same content.\n\n## Getting Started\n\nFirst, provide an initial hashring with expected endpoints:\n\n```json\n[\n  {\n    \"endpoints\": [\n      \"thanos-receiver1.local.net:10901\",\n      \"thanos-receiver2.local.net:10901\",\n      \"thanos-receiver3.local.net:10901\"\n    ]\n  }\n]\n```\n\n```shell\n$ thanos-rc-controller --file /etc/thanos/hashring-example1.json\nINFO 2022/01/31 15:24:23 main.go:79: File /etc/thanos/hashring-example1.json saved.\n```\n\n## Scheduler mode\n\nIn schedule mode, the controller will check every N seconds the readiness of each endpoints for a given hashring config and will generate an new hashring config.\nIf the current config has change with the last config, the generated file will be overwritten.\n\n```shell\n$ thanos-rc-controller --directory /etc/thanos --schedule\nINFO 2022/01/31 15:25:49 main.go:299: Scheduler Started (run every 10 seconds)\nINFO 2022/01/31 15:25:59 main.go:279: Tick at 2022-01-31 15:25:59.167734191 +0000 GMT m=+10.001703419\nINFO 2022/01/31 15:25:59 main.go:79: File /etc/thanos/hashring-example1_generated.json saved.\nINFO 2022/01/31 15:25:59 main.go:79: File /etc/thanos/hashring-example2_generated.json saved.\nINFO 2022/01/31 15:25:59 main.go:79: File /etc/thanos/hashring-example3_generated.json saved.\nINFO 2022/01/31 15:26:09 main.go:279: Tick at 2022-01-31 15:26:09.167761543 +0000 GMT m=+20.001730753\nINFO 2022/01/31 15:26:19 main.go:279: Tick at 2022-01-31 15:26:19.167749659 +0000 GMT m=+30.001718866\n^C\nINFO 2022/01/31 15:26:20 main.go:295: Caught SIGTERM interrupt\nINFO 2022/01/31 15:26:20 main.go:301: Scheduler Stopped...\n```\n\nThis is usefull to detect an endpoint failure and to avoid taht thanos Receiver forward requests to faulty node where the node configurated in hashrings file. See https://github.com/thanos-io/thanos/issues/4059.\n\nUse it with thanos component receiver flag: (https://thanos.io/tip/components/receive.md/)\n```\n--receive.hashrings-file-refresh-interval=5m\n                                 Refresh interval to re-read the hashring\n                                 configuration file. (used as a fallback)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fthanos-receive-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgouteroux%2Fthanos-receive-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fthanos-receive-controller/lists"}