Couchbase的Smartclient有何作用

在Couchbase的集群架构中,没有中心节点、也没有统一Router的概念,因为Smartclient就做了这个事,客户端的library直接与集群中的独立服务器通信,不必经过其他router或proxy。之前我对这个问题也不是很确认,因此在邮件列表里提问如下:

Given I have three nodes as a cluster:
192.168.1.10
192.168.1.11
192.168.1.12

My client IP is 192.168.1.9
In the program I connect to a node IP, say 192.168.1.10

For the data transfer latter, I am not sure what way they take.
#1 all the data are sending to 192.168.1.10, and this node then does a distribution among all three nodes.
#2 the client has the chance to talk directly with other two nodes, and send the data directly to them.

得到社区里Trond Norbye的回答如下:
The Couchbase clients will distribute the data across all nodes in your cluster.

今天翻了一会书,看到这节内容:

One of the most common questions when developing applications is how clients and client libraries react and are affected by the topology and topology changes that occur in a running cluster.

In general, a Couchbase Server cluster acts as a “black box” in terms of the client and database interaction. If you are using a smart client, the topology, node structure, and changes to this are entirely handled through the combination of the vBucket map and the client library.

The client library will take care of the communication between the client and the in- dividual nodes. The node that you use to connect to the cluster when first opening a connection does not act as a proxy or distribution service.

Instead, a smart client (or Moxi) will load the vBucket map, and from this information, determine which node within the cluster should be contacted to store and retrieve different documents. The information exchange is direct with the right node for that data.

During a topology change (for example, a rebalance or failover operation), the client library should automatically handle any transient errors. In all other respects, the con- figuration and topology of the cluster is not something you should ever have to worry about.

这里就描述的很清楚,在客户端和数据库交互时,Couchbase集群作为一个黑盒子存在。客户端库负责客户程序和集群里独立节点的通信,你首次连接的那个节点,并不会充当代理或分发的角色。Smartclient或Moxi会加载vBucket映射表,并决定连接到集群里的哪个节点去获取和存储数据。如果集群的拓扑图改变了(比如执行rebalance或者failover操作),客户端库会自动处理任何会话错误。换句话说,集群的配置和结构,对应用程序是透明的,你无需去关注。

此条目发表在Common分类目录,贴了标签。将固定链接加入收藏夹。