我们可以 运行 多个 TiDB 实例连接到同一个集群到 PD 和(因此 TiKV)吗?

Can we run multiple TiDB instances connected to the same cluster to PD and (hence TiKV)?

我想搭建一个TiDB本地集群来做benchmark。以下是我的一些疑惑:

Can multiple TiDB instances connect to the same PD and TiKV cluster?

是的,您可以根据需要添加任意数量的 tidb-servers。

If positive, will transactions submitted to different TiDB instances satisfy snapshot isolation level?

是的,TiDB是分布式数据库,默认提供快照隔离。并且来自不同 tidb-server 的不同事务也可以满足快照隔离级别。 TiDB 使用 Percolator transaction model to implement the distributed transaction. For more implementation details, you can refer to this article: https://pingcap.com/blog/2016-11-17-mvcc-in-tikv/

At the storage layer, does each TiKV node keep the entire dataset? (The replication factor is equal to the TiKV node number?)

没有。 TiDB 在内部将 table 分成基于范围的小块,我们称之为 "regions"。每个区域的默认大小约为 100MiB。复制因子默认为 3。集群中每个 tikv-server 拥有数十万个 region。

If negative, how to configure the replication factor?

PD 读取配置文件(conf/pd.yml)并使用其中的 max-replicas 配置。更详细的可以参考https://github.com/pingcap/docs/blob/master/FAQ.md#is-the-number-of-replicas-in-each-region-configurable-if-yes-how-to-configure-it