グローバルクラスターへの接続
グローバルクラスターが実行された後、エンドポイントと認証トークンを使用して接続します。このページでは、2 種類のエンドポイント、それぞれの使用タイミング、およびスイッチオーバーやフェイルオーバー時のルーティング動作について説明します。
この機能は、ビジネスクリティカル プロジェクト内の Dedicated クラスターでのみ利用可能です。
エンドポイントタイプの選択
グローバルクラスターには、以下の 2 つの接続方法があります。
-
グローバルエンドポイント を経由する方法
-
グローバルクラスター内の プライマリークラスター またはセカンダリクラスターの パブリックエンドポイント または プライベート エンドポイントを経由する方法
以下の表は、これら 2 つの接続エンドポイントを比較したものです。
Global endpoint | プライマリークラスター またはセカンダリクラスターのエンドポイント | |
|---|---|---|
書き込みルーティング | 自動的に プライマリークラスター へルーティングされます | 書き込みを受け付けるのは プライマリークラスター の パブリックエンドポイント のみです |
読み取りルーティング | プライマリークラスター へルーティングされます (まもなく、レイテンシに基づいて最も近い利用可能なクラスターへインテリジェントにルーティングする機能がサポートされる予定です。) | 接続した特定のクラスターに対して読み取りが行われます |
スイッチオーバー / フェイルオーバー | 自動的に再ルーティングされ、コードの変更は不要です | 新しい プライマリークラスター を指すように接続先を手動で更新する必要があります |
プライベート Link | 非対応(パブリックインターネットが必要) | 対応しています。 |
推奨用途 | 自動フェイルオーバーとレイテンシベースのルーティングを必要とする本番アプリケーション | 特定のクラスターへの直接アクセス(例:環境の複製、テスト、デバッグ) |
本番ワークロードには グローバルエンドポイント の使用を推奨します。これにより、スイッチオーバーやフェイルオーバー発生時にアプリケーションコード内でエンドポイントの変更を処理する必要がなくなります。
エンドポイントとトークンの取得
グローバルクラスターまたは対象クラスターに移動します。
-
global endpoint の場合:Global Cluster ページに移動します。
-
public endpoint の場合:特定の プライマリークラスター またはセカンダリクラスターの Cluster Details ページに移動します。
接続カードで、Global Endpoint または Public Endpoint をコピーします。

認証トークンを準備します。これは API key または cluster credential (username:password) のいずれかになります。
SDK バージョンの確認
インストール 済みの SDK があることを確認してください。グローバルクラスターに接続する前に、SDK が最小バージョン要件を満たしていることを確認してください。
SDK | 最小バージョン |
|---|---|
Python |
|
Node.js |
|
Java |
|
Go |
|
グローバルエンドポイント を使用した接続
グローバルエンドポイント は、グローバルクラスター内の適切なクラスターへリクエストをルーティングする単一の URL です。SDK クライアントの uri として使用してください。
- Python
- Java
- NodeJS
- Go
- cURL
from pymilvus import MilvusClient
# Use the global endpoint for automatic routing
client = MilvusClient(
uri="YOUR_GLOBAL_ENDPOINT", # Global endpoint from the console
token="YOUR_CLUSTER_TOKEN" # API key or username:password
)
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.client.ConnectConfig;
// Use the global endpoint for automatic routing
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("YOUR_GLOBAL_ENDPOINT") // Global endpoint from the console
.token("YOUR_CLUSTER_TOKEN") // API key or username:password
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
const { MilvusClient } = require("@zilliz/milvus2-sdk-node")
// Use the global endpoint for automatic routing
const client = new MilvusClient({
address: "YOUR_GLOBAL_ENDPOINT", // Global endpoint from the console
token: "YOUR_CLUSTER_TOKEN" // API key or username:password
})
import "github.com/milvus-io/milvus/client/v2/milvusclient"
// Use the global endpoint for automatic routing
client, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_GLOBAL_ENDPOINT", // Global endpoint from the console
APIKey: "YOUR_CLUSTER_TOKEN", // API key or username:password
})
curl --request POST \
--url "YOUR_GLOBAL_ENDPOINT" \
--header "Authorization: Bearer YOUR_CLUSTER_TOKEN" \
--header "Content-Type: application/json" \
--data '{"dbName": "default"}'
Connect using a パブリックエンドポイント
グローバルクラスター内の各クラスターには、それぞれ独自のパブリックエンドポイントがあります。特定のクラスターを直接ターゲットにする必要がある場合は、これを使用してください。
- Python
- Java
- NodeJS
- Go
- cURL
from pymilvus import MilvusClient
# Connect directly to a specific cluster
client = MilvusClient(
uri="YOUR_CLUSTER_PUBLIC_ENDPOINT", # Public endpoint of a specific cluster
token="YOUR_CLUSTER_TOKEN" # API key or username:password
)
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.client.ConnectConfig;
// Connect directly to a specific cluster
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("YOUR_CLUSTER_PUBLIC_ENDPOINT") // Public endpoint of a specific cluster
.token("YOUR_CLUSTER_TOKEN") // API key or username:password
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
const { MilvusClient } = require("@zilliz/milvus2-sdk-node")
// Connect directly to a specific cluster
const client = new MilvusClient({
address: "YOUR_CLUSTER_PUBLIC_ENDPOINT", // Public endpoint of a specific cluster
token: "YOUR_CLUSTER_TOKEN" // API key or username:password
})
import "github.com/milvus-io/milvus/client/v2/milvusclient"
// Connect directly to a specific cluster
client, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_PUBLIC_ENDPOINT", // Public endpoint of a specific cluster
APIKey: "YOUR_CLUSTER_TOKEN", // API key or username:password
})
curl --request POST \
--url "YOUR_CLUSTER_PUBLIC_ENDPOINT" \
--header "Authorization: Bearer YOUR_CLUSTER_TOKEN" \
--header "Content-Type: application/json" \
--data '{"dbName": "default"}'
パブリックエンドポイントを使用する場合、書き込み操作を受け付けるのはプライマリークラスターのパブリックエンドポイントのみです。セカンダリークラスターのパブリックエンドポイントへの書き込みは失敗します。
Routing behavior
During normal operation
Request type | グローバルエンドポイント | パブリックエンドポイント |
|---|---|---|
Write (insert, upsert, delete) | Routed to the プライマリークラスター | Only accepted on the プライマリークラスター's endpoint |
Read (search, query) | Routed to the プライマリークラスター (Intelligent routing to the nearest available cluster based on latency will be supported soon.) | Served by the specific cluster you connect to |
During and after switchover / failover
Scenario | グローバルエンドポイント | パブリックエンドポイント |
|---|---|---|
スイッチオーバー in progress | Writes briefly paused, then resume on the new primary. Reads continue. | No change to endpoints. Old primary becomes secondary. |
フェイルオーバー in progress | Writes unavailable until new primary is promoted. Reads continue on secondaries. | Old primary's endpoint becomes unreachable. |
After completion | Automatically routes to the new primary. No code changes. | Update your code to use the new primary's パブリックエンドポイント for writes. |
SDK automatic reconnection
グローバルエンドポイントを使用する場合、Zilliz Cloud SDK はスイッチオーバーおよびフェイルオーバー中のエンドポイントの再ルーティングを処理します。アプリケーション側でルーティング変更に対するリトライロジックを実装する必要はありません。ただし、切り替え時点で進行中の書き込みは一時的なエラーを受ける可能性があります。これらのケースは、アプリケーション内の標準的なリトライロジックで処理されます。