Install Kafka Docker
For local development and testing, you can run Pulsar in standalonemode on your own machine within a Docker container.
- Install Kafka Docker Server
- Install Kafka Docker Vpn
- Install Kafka On Docker
- Install Kafka Docker Windows
- Install Kafka Docker Server
- Install Kafka Docker Vpn
If you have not installed Docker, download the Community editionand follow the instructions for your OS.
Start Pulsar in Docker
- A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size!
- The latest kafkacat docker image is edenhill/kafkacat:1.6.0, there's also Confluent's kafkacat docker images on Docker Hub. If you are connecting to Kafka brokers also running on Docker you should specify the network name as part of the docker run command using the -network parameter.
For MacOS, Linux, and Windows:
A few things to note about this command:
- The data, metadata, and configuration are persisted on Docker volumes in order to not start 'fresh' everytime the container is restarted. For details on the volumes you can use
docker volume inspect <sourcename>
- For Docker on Windows make sure to configure it to use Linux containers
To install packages in a docker container, the packages should be defined in the Dockerfile. If you want to install packages in the Container, use the RUN statement followed by exact download command. $ RUN pip install //IN Windows $ RUN apt-get install //in Ubuntu $ RUN yum install //CentOS/RHEL.
If you start Pulsar successfully, you will see INFO
-level log messages like this:
Tip
When you start a local standalone cluster, a public/default
namespace is created automatically. The namespace is used for development purposes. All Pulsar topics are managed within namespaces.For more information, see Topics.
Use Pulsar in Docker
Install Kafka Docker Server
Pulsar offers client libraries for Java, Go, Pythonand C++. If you're running a local standalone cluster, you canuse one of these root URLs to interact with your cluster:
Install Kafka Docker Vpn
pulsar://localhost:6650
http://localhost:8080
Install Kafka On Docker
The following example will guide you get started with Pulsar quickly by using the Pythonclient API.
Install the Pulsar Python client library directly from PyPI:
Consume a message
Create a consumer and subscribe to the topic:
Produce a message
Install Kafka Docker Windows
Now start a producer to send some test messages:
Get the topic statistics
Install Kafka Docker Server
In Pulsar, you can use REST, Java, or command-line tools to control every aspect of the system.For details on APIs, refer to Admin API Overview.
In the simplest example, you can use curl to probe the stats for a particular topic:
Install Kafka Docker Vpn
The output is something like this: