Skip to content

Create a Client

xqrzd edited this page Feb 19, 2022 · 4 revisions

KuduClient.NewBuilder takes a comma separated list of Kudu master addresses. The port defaults to 7051 if not supplied. When done configuring the builder, call Build to create a client.

KuduClient client = KuduClient.NewBuilder("localhost:7051,localhost:7151,localhost:7251")
    .Build();

KuduClient is intended to be a singleton, and is optimized for heavy concurrent use. It is inefficient to create multiple clients per application.

Authentication

Connecting to a secure Kudu cluster requires either Kerberos or token authentication. Tokens can only be obtained by clients that have already authenticated using Kerberos. Read more about Kudu security here.

Kerberos

When connecting to a secure Kudu cluster, it's important that the master hostname which the client is created with matches the Kerberos hostname. The client will automatically select an appropriate Kerberos ticket from the cache and use it.

Typically kinit is used on Linux and macOS to obtain a Kerberos ticket-granting ticket. On Windows, consider using a MSA (managed service account) to automatically keep the application's credentials up-to-date.

Token

After authenticating to a secure cluster, the client will automatically request an authentication token from the Kudu master. This token can be exported, to allow an application without Kerberos credentials to connect to a secure cluster:

ReadOnlyMemory<byte> token = await client.ExportAuthenticationCredentialsAsync();

Importing an authentication token:

client.ImportAuthenticationCredentials(token);

Tokens last 7 days by default. A client's authentication token can be refreshed by importing a new token with ImportAuthenticationCredentials.

Clone this wiki locally