Can TiFlash be configured with a single replica in production?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 生产Tiflash可以设置单副本吗?

| username: jaybing926

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed to encounter the issue
[Encountered Issue: Issue Phenomenon and Impact]

Dear experts: In a production environment, can TiFlash be set to a single replica? Does TiDB automatically determine the availability of TiFlash? If it is unavailable, does it automatically query TiKV?
I just saw the following document, which implies that TiDB does not determine availability. Does this mean that TiFlash cannot be set to a single replica in production?

| username: weixiaobing | Original post link

You can set this parameter, but it is best to set 2 replicas in a production environment to ensure high availability. If this parameter is set, when TiFlash encounters an issue, all queries will go to TiKV, which may cause some other impacts.

tidb_allow_fallback_to_tikv introduced from version v5.0

  • Scope: SESSION | GLOBAL
  • Persist to cluster: Yes
  • Default value: “”
  • This variable indicates the list of storage engines that use TiKV as a fallback storage engine. When a storage engine in this list fails and causes an SQL statement to fail, TiDB will use TiKV as the storage engine to re-execute the SQL statement. Currently, this variable can be set to “” or “tiflash”. If this variable is set to “tiflash”, when TiFlash returns a timeout error (corresponding error code is ErrTiFlashServerTimeout), TiDB will use TiKV as the storage engine to re-execute the SQL statement.
| username: jaybing926 | Original post link

Sure, thank you~
What potential impacts could arise from issues with a single replica?

| username: weixiaobing | Original post link

A single replica does not have high availability. If any TiFlash node encounters an issue, TiFlash may become unusable.

| username: tidb菜鸟一只 | Original post link

The biggest problem with a single TiFlash node is that you might have many OLAP SQL queries running well with TiFlash, and normal OLTP SQL queries running fine with TiKV. However, if the TiFlash replica goes down and you haven’t enabled the tidb_allow_fallback_to_tikv parameter, all your SQL queries that rely on TiFlash will fail. If you do enable the tidb_allow_fallback_to_tikv parameter, it could potentially double the pressure on your TiKV, or even overwhelm it, affecting all your normal OLTP operations. Therefore, it is recommended to have at least two nodes.

| username: jaybing926 | Original post link

At least 2 nodes and 2 replicas, right?

| username: tidb菜鸟一只 | Original post link

That’s right, you can’t set up two replicas on a single node.

| username: jaybing926 | Original post link

Okay, we don’t have that many servers~~ :tired_face:

| username: jaybing926 | Original post link

I want to ask, if it is a single replica situation and this parameter is set: tidb_allow_fallback_to_tikv = ‘tiflash’
What problems might occur if the single replica has issues?

Our business OLAP volume is not large, so it might not be like what the previous person said, where if tiflash has issues, OLAP requests to tikv would cause unbearable pressure.
Our business OLAP is not large, but I want to ensure it is available. Switching to tikv being a bit slower is fine. But it must be available, and not error out so that queries can’t be executed.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.