Lenses Box
Lenses Box is a container solution for building applications on a localhost Apache Kafka docker.
Last updated
Lenses Box is a container solution for building applications on a localhost Apache Kafka docker.
Last updated
2024 © Lenses.io Ltd. Apache, Apache Kafka, Kafka and associated open source project names are trademarks of the Apache Software Foundation.
Lenses Box contains all components of the Apache Kafka ecosystem, CLI tools, and synthetic data streams.
To start with the Box get your free development license online.
Install and run the Docker
Open Lenses in your browser, log in with admin/admin.
The broker in the Kafka docker has a broker id 101
and advertises the listener configuration endpoint to accept client connections.
If you run Docker on macOS or Windows, you may need to find the address of the VM running Docker and export it as the advertised listener address for the broker (On macOS it usually is 192.168.99.100
). At the same time, you should give the lensesio/box
image access to the VM’s network:
If you run on Linux, you don’t have to set the ADV_HOST
, but you can do something cool with it. If you set it to be your machine’s IP address, you can access Kafka from any clients in your network.
If you decide to run a box in the cloud, you (and all your team) can access Kafka from your development machines. Remember to provide the public IP of your server as the kafka advertised host for your producers and consumers to access it.
Kafka JMX metrics are enabled by default. Refer to ports once you expose the relevant port, ie. -p 9581:9581
you can connect to JMX with
If you are using docker-machine or setting this up in a Cloud or DOCKER_HOST is a custom IP address such as 192.168.99.100
, you will need to use the parameters --net=host -e ADV_HOST=192.168.99.100
.
To persist the Kafka data between multiple executions, provide a name for your Docker instance and do not set the container to be removed automatically (--rm
flag). For example:
Once you want to free up resources, just press Control-C
. Now you have two options: either remove the Docker:
Or use it at a later time and continue from where you left off:
Service | Port Number |
---|---|
Kafka broker | 9092 |
Kafka connect | 8083 |
Zookeeper | 2181 |
Schema Registry | 8081 |
Lenses | 3030 |
Elasticsearch | 9200 |
Kafka broker JMX | 9581 |
Schema registry JMX | 9582 |
Kafka connect JMX | 9584 |
Zookeeper JMX | 9585 |
Kafka broker (ssl) | 9092 |
Variable | Description |
---|---|
ADV_HOST=[ip-address] | The ip address that the broker will advertise |
DEBUG=1 | Prints all stdout and stderr processes to container’s stdout for debugging. |
DISABLE_JMX=1 | Disables exposing JMX metrics on Kafka services. |
ELASTICSEARCH_PORT=0 | Will not start Elasticsearch. |
ENABLE_SSL=1 | Creates CA and key-cert pairs and makes the broker also listen to SSL://127.0.0.1:9093 |
KAFKA_BROKER_ID=1 | Overrides the broker id (the default id is 101). |
SAMPLEDATA=0 | Disables the synthetic streaming data generator that are running by default. |
SUPERVISORWEB=1 | Enables supervisor interface on port 9001 (adjust via SUPERVISORWEB_PORT) to control services. |
Download your key locally and run the command:
The container is running multiple services, and it is recommended to allocate 5GB of RAM to the docker (although it can operate with even less than 4GB).
To reduce the memory footprint, it is possible to disable some connectors and shrink the Kafka Connect heap size by applying these options (choose connectors to keep) to the docker run
command: