Pulsar Admin Console tutorial

The Luna Streaming Pulsar Admin Console is a web-based UI from DataStax that administers topics, namespaces, sources, sinks, and various aspects of Apache Pulsar features.

Getting Started in Pulsar Admin Console

In the Luna Streaming Pulsar Admin Console, you can use Pulsar clients to send and receive pub/sub messages.

If you haven’t already, launch the Luna Streaming Pulsar Admin Console in a browser by opening the URL that was specified in the Luna Streaming Installation Console. Example:

Get Pulsar Admin Console URL and password from Config tab of Installation Console

By default, you can log in with username admin. The generated and persisted password was also shown on the Config tab of the Installation Console.

Pulsar Admin Console features

To try out your service right now, use the built-in WebSocket test clients. See the Pulsar Admin Console’s Test Clients page.

To see interactive code samples, go to Code Samples.

To see the available namespaces, go to Namespaces. Messages published to namespaces are automatically replicated to all node(s) in the cluster.

Topics are automatically created, by default, when you first try to publish or subscribe. To manually create a topic or to create a partitioned topic, go to Topics.

The first part of a full topic name is your tenant name, followed by the namespace, and then the topic name.

Here is an example of a topic using its full name:

public/namespace/my-topic

You can select your current tenant using the drop-down at the top right of the Topics page. To create a new tenant, go to Tenants.

To see detailed information about your topics, go to Topics.

Standalone version

For information about building and running a standalone Pulsar Admin Console, see the readme on github.com/datastax/pulsar-admin-console.

When connecting you may need to provide the connect token for your account. You can get the token by going to the Pulsar Admin Console’s Credentials page.

Sending and receiving Pulsar messages

Go to the Pulsar Admin Console’s Test Clients page. The quickest way to try your service is to use the test clients, sending messages from one client to the other.

In the WebSocket Test Client 1 section, click Connect. This action creates a connection from the Pulsar Admin Console that’s running in your browser to the Pulsar instance on your server.

Scroll down to the Consume tab. In this simple example, which verifies that the service is running properly, add a hello world message and click Send. Example:

Send a message using a test client

In doing so, you published a message to your server, and in the Test Client you’re listening to your own topic. This UI proves that your client is working with the Pulsar server.

See the Code samples section for a look at the clients.

Code samples

On the Pulsar Admin Console’s Code Samples page, there are examples of Java, Python, Golang, Node.js, WebSocket, and HTTP clients. Each example shows Producer, Consumer, and Reader code; plus language-specific examples of setting project properties and dependencies. For example with Java, if you are using Maven in your project, add the following to the <properties> section of your pom.xml file:

<pulsar.version>2.6.2</pulsar.version>

And add the following to the pom.xml file’s <dependencies> section:

<dependency>
  <groupId>org.apache.pulsar</groupId>
  <artifactId>pulsar-client</artifactId>
  <version>${pulsar.version}</version>
</dependency>

If you are using Gradle, add this to your build.gradle file:

def pulsarVersion = '2.6.2'

dependencies {
    compile group: 'org.apache.pulsar', name: 'pulsar-client', version: pulsarVersion
}

Connecting Clients

To connect using the Pulsar binary protocol, use the following URL format with port 6651:

pulsar+ssl://<dns-name>:6651

For example, for an installed node with a DNS name ip-10-101-32-250.srv101.dsinternal.org:

pulsar+ssl://ip-10-101-32-250.srv101.dsinternal.org:6651

To connect using the WebSocket API, use the following URL format with port 8001:

wss://<dns-name>:8001

For example:

wss://ip-10-101-32-250.srv101.dsinternal.org:8001

To connect using HTTP, use the following URL format with port 8085:

For example:

Admin API

To connect to the admin API, use the following URL format with port 8443:

For example, give a DNS name of ip-10-101-32-250.srv101.dsinternal.org:

You can list all the tenants like this, for example:

Or if you have authentication enabled, like this:

pulsar-admin --admin-url https://ip-10-101-32-250.srv101.dsinternal.org:8443 --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationToken ----auth-params file:///token.jwt

You can get the token from the Pulsar Admin Console’s Credentials page.

Alternatively, you can save the URL authentication parameters in your client.conf file.

Creating and showing credentials

Connect token

When connecting clients, you’ll need too provide your connect token to identify your account. In all the Pulsar APIs, you specify the token when creating the client object. The token is your password to your account, so keep it safe.

The code samples automatically add your client token as part of the source code for convenience. However, a more secure practice would be to read the token from an environment variable or a file.

In the Pulsar Admin Console’s Credentials page, click Create New token and follow the instructions. If you previously created a token, use the Credentials page to get its value.

CA Certificate

The cluster may be using certificates signed by trusted certicate authorities, such as Let’s Encrypt. That means that you can use the default set of certificate authorities in your environment. The path to the default CA bundle varies by environment. For example:

  • /etc/ssl/certs/ca-bundle.crt (RHEL/CentOS)

  • /etc/ssl/certs/ca-certificates.crt (Debian/Ubuntu)

On OSX, run this command to export the default certificates to a file:

security find-certificate -a -p /System/Library/Keychains/SystemCACertificates.keychain > ca-certificates.crt

If the cluster is not using a public certificate authority, you can use the Pulsar Admin Console’s Credentials page to display it with Click to Show CA Certificate.

Most Pulsar APIs can be configured to skip certificate validation, but this is not recommended.