
# 不同编程语言如何使用Cluster集群客户端
当前DCS Cluster集群对比Proxy集群的优势和特性：
表1Cluster集群与Proxy集群差异 
| 对比项    | Cluster集群      | Proxy集群 |
|:---|:---|:---|
| 原生兼容性  | 高              | 中       |
| 客户端兼容性 | 中（需要客户端开启集群模式） | 高       |
| 性价比    | 高              | 中       |
| 时延     | 低时延            | 中等时延    |
| 读写分离   | 原生支持（客户端SDK配置） | Proxy实现 |
| 性能     | 高              | 中       |
   
Cluster集群由于没有代理层，在时延和性能方面具备一定的优势；但是对于客户端使用方面，由于Cluster集群使用开源的Redis Cluster协议，在客户端的兼容性方面略差于Proxy集群。
推荐的Cluster集群客户端：
表2Cluster集群客户端 
| **客户端语言** | **客户端类型**                                                | **Cluster** **集群参考文档**                                                                                                                                                                   |
|:---|:---|:---|
| Java      | Jedis                                                    | <https://github.com/xetorthio/jedis#jedis-cluster>                                                                                                                                       |
| Java      | Lettuce                                                  | <https://github.com/lettuce-io/lettuce-core/wiki/Redis-Cluster>                                                                                                                          |
| PHP       | php redis                                                | <https://github.com/phpredis/phpredis#readme>                                                                                                                                            |
| Go        | Go Redis                                                 | Cluster集群：<https://pkg.go.dev/github.com/go-redis/redis/v8#NewClusterClient> Proxy集群或单机主备：<https://pkg.go.dev/github.com/go-redis/redis/v8#NewClient> |
| Python    | redis-py-cluster                                         | <https://github.com/Grokzen/redis-py-cluster#usage-example>                                                                                                                              |
| C         | hiredis-vip                                              | <https://github.com/vipshop/hiredis-vip?_ga=2.64990636.268662337.1603553558-977760105.1588733325>                                                                                        |
| C++       | redis-plus-plus                                          | <https://github.com/sewenew/redis-plus-plus?_ga=2.64990636.268662337.1603553558-977760105.1588733325#redis-cluster>                                                                      |
| Node.js   | node-redis io-redis | <https://github.com/NodeRedis/node-redis> <https://github.com/luin/ioredis>                                                                           |
   
官方推荐的开源客户端列表：<https://redis.io/clients>。
