Skip to content

Instantly share code, notes, and snippets.

@javisantana
Created December 3, 2020 10:33
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 javisantana/5fbc83004bded0a3020517d7c3564286 to your computer and use it in GitHub Desktop.
Save javisantana/5fbc83004bded0a3020517d7c3564286 to your computer and use it in GitHub Desktop.

Clickhouse has a pretty good endpoint /replicas_status which gives information about the, guess what, replication status. When you are working on a cluster in which you use replication to increase the amount of QPS you usually have a load balancer before, something like this:

                                 +--------------+
                                 |              |
                       +-------->+  clickhouse  |
                       |         |              |
                       |         +--------------+
                       |
                       |
+--------------+       |         +--------------+
|              |       |         |              |
|   load       +---------------->+  clickhouse  |
|   balancer   |       |         |              |
|              |       |         +--------------+
+--------------+       |
                       |
                       |         +---------------+
                       |         |               |
                       +-------->+  clickhouse   |
                                 |               |
                                 +---------------+

Sometimes you insert a new fresh replica and when that happens the health checks on the new replica start to work so the load balancer will throw traffic to machine that does not have data yet.

So using /replicas_status as the health check will leave out the new replica until it catchup with the rest of the replicas.

If you call it with ?verbose=1 return detailed information for each replicated table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment