Apache Pulsar is an open-source distributed pub-sub messaging system. While it was originally created by Yahoo, Pulsar is now a part of the Apache Software Foundation.
In this article, we will look into a quick setup to get Pulsar up and running locally in a minimal fashion. In future articles, we will investigate the client libraries, Pulsar Functions, and running out of Docker containers.
- Linux or MacOS operating system
To get started download the Pulsar binary tarball release:
Then unzip and navigate into the directory:
tar xvfz apache-pulsar-2.6.0-bin.tar.gz cd apache-pulsar-2.6.0
Start local from command-line
To start a local cluster use the
pulsar command in the
Now there is a standalone version of Pulsar running as long as that terminal is up. In order to run it in the background check the next section. If you do not want to worry about it running in the background skip to the "Consume a message"
Start local from daemon
To start a background daemon process run the
bin/pulsar-daemon start standalone
In order to stop the background process run:
bin/pulsar-daemon stop standalone
Consume a message
In a separate terminal run the following command to create a subscription on the
bin/pulsar-client consume my-topic -s "first-subscription"
Produce a hello world message
To send a message to the consumer setup above start another terminal and execute the following
bin/pulsar-client produce my-topic --messages "hello world!"
On the terminal setup for the consumer something like the following should show up:
In this short article, we saw how to set up the Apache Pulsar messaging system locally.