This topic provides instructions to obtain the connection values for Apache Pulsar and to connect to App Connect.
Before you begin
Before you begin, ensure the following:
- Apache Pulsar is deployed and running (standalone or in a
Kubernetes cluster).
- You have access to the Pulsar admin CLI (pulsar-admin).
- You have appropriate permissions to create tenants and manage authentication.
Procedure
-
To create a tenant (BASIC and BASIC JWT),
complete the steps that follow:
- Run the following command to enter the container:
kubectl exec -it -n pulsar pulsar-mini-toolset-0 -- /bin/bash
- In the toolset container, create a tenant that is named
my-tenant:
bin/pulsar-admin tenants create my-tenant
- List all tenants to confirm that the tenant was created successfully:
bin/pulsar-admin tenants list
If the tenant is created successfully, the output includes the
following:
The tenant my-tenant has been successfully created.
"my-tenant"
"public"
"pulsar"
- To use symmetric key (secret key) encryption in Apache Pulsar (BASIC JWT), complete the
following steps:
- Run the following command to create a secret key:
bin/pulsar tokens create-secret-key --output my-secret.key
The command generates the my-secret.key file in the root of your Apache Pulsar installation directory.
- To generate the secret key in a specific location, provide an absolute path:
bin/pulsar tokens create-secret-key --output /opt/my-secret.key
- To create a base64-encoded version of the secret key, run:
bin/pulsar tokens create-secret-key --output my-secret.key --base64
- To use asymmetric key (private key and public key) encryption in Apache Pulsar (BASIC JWT), complete the
following steps:
- Run the following command to create a private key and a public key:
bin/pulsar tokens create-key-pair --output-private-key my-private.key --output-public-key my-public.key
The command generates the key files in the root of your Apache Pulsar installation directory.
- Copy the value of
my-private.key and save it somewhere safe.
Note:
- Store the
my-private.key file in a secure location. Only administrators should
have access to this file to generate new tokens.
- Share the
my-public.key file with all Pulsar brokers. You can distribute this
file publicly without security concerns.
- To generate a token or payload subject (BASIC JWT), complete one
of the following procedures depending on your key type and requirements.
- Run the following command to generate a token with the secret key a subject
field:
bin/pulsar tokens create --secret-key file:///path/to/my-secret.key \
--subject test-user
- Run the following command to generate a token by using a private key:
bin/pulsar tokens create --private-key file:///path/to/my-private.key \
--subject test-user
- Run the following command to create a token that expires after a specified duration
with the secret key:
bin/pulsar tokens create --secret-key file:///path/to/my-secret.key \
--subject test-user \
--expiry-time 1y