Comments (9)
That's super helpful, thanks @solarmosaic-kflorence!
I'll add a config for using .sh
commands and push a release tomorrow. :)
Hope that'll help!
from kafka-shell.
Hi @blankenshipz,
I haven't used this docker image, so this is interesting. Based on that docker image alone, I don't know if you could use kafka-shell
in its current state to run commands via the docker image. It does look like the files are on the path, but they end in .sh
which kafka-shell
currently does not support. For example, docker run -it wurstmeister/kafka kafka-topics.sh
works.
My docker example is based on the Confluent docker images (confluentinc/cp-kafka
), which do have the files on the path. A simple way to utilize their docker images can be found here (with ZooKeeper as well):
https://github.com/simplesteph/kafka-stack-docker-compose/blob/master/zk-single-kafka-single.yml
If you do that, then it will work properly. If you'd prefer to use the wurstmeister/kafka
image, you could:
- Extend that Dockerfile to make it work
- Run another daemon container (see my confluent-tools repository as an example)
- I could extend
kafka-shell
with some additional configurations to add in.sh
Let me know if those options work for you. I'll probably add in an additional configuration for the .sh
extension this weekend.
from kafka-shell.
Hi @blankenshipz, have you been able to work around this issue? Anything else you need help with?
from kafka-shell.
Hi @devshawn; I haven't had a chance to try it yet but switching to the image you're using should work - I'll reopen this issue if It doesn't.
Thanks!
from kafka-shell.
Just wanted to mention that I also stumbled here trying to use this tool with a kafka/zookeeper deployment into docker kubernetes (using cp-kafka
). I get the same error for most commands, for example: sh: kafka-topics: command not found
.
I am essentially using the example you posted above, but with docker stack deploy --orchestrator kubernetes
from kafka-shell.
@solarmosaic-kflorence - thanks for the report.
I'd be happy to assist you, but I'd need to know a bit more about your setup and how your config is set up. Feel free to open a new issue 😄. I haven't used docker stack
before but I've used this tool with the kubectl
prefix to run commands on running k8s containers.
from kafka-shell.
hey @devshawn -- here is an example you can use:
kafka-stack.yaml
:
version: '3.3'
services:
# https://hub.docker.com/r/bitnami/zookeeper
zookeeper1:
image: bitnami/zookeeper:3.4.13
hostname: zookeeper1
ports:
- "2181:2181"
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
volumes:
- zookeeper1-data:/bitnami/zookeeper
# https://hub.docker.com/r/bitnami/kafka
kafka1:
image: bitnami/kafka:2.2.1
hostname: kafka1
ports:
- "9092:9092"
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
ALLOW_PLAINTEXT_LISTENER: "yes"
KAFKA_CFG_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_CFG_LISTENERS: INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper1:2181"
volumes:
- kafka1-data:/bitnami/kafka
deploy with docker stack deploy --orchestrator kubernetes -c kafka-stack.yaml kafka-stack
I can now add the following to my ~/.kafka-shell/config
: command_prefix: kubectl exec svc/kafka1 --
But when I try to execute commands, I get:
> kafka-topics --list
OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"kafka-topics\": executable file not found in $PATH": unknown
command terminated with exit code 126
Looks like it is for the same reason, commands are exposed in this docker image with the .sh
extension.
PS: using cp-kafka
the commands were fixed by using the kubectl exec svc/kafka1 --
command_prefix
option -- would be nice if it were possible to set this option on execution of kafka-shell
instead of having to set it in configuration (so it's easier to provide developer documentation without having people modifying their local configuration), but it's not a big deal.
from kafka-shell.
FWIW it looks like the .sh
commands are defacto: https://kafka.apache.org/quickstart
from kafka-shell.
@devshawn since we are slightly off-topic on this ticket, I have created #18 to track. It would probably be useful to add documentation for this use-case at the same time as well.
from kafka-shell.
Related Issues (15)
- Add command: kafka-reassign-partitions
- config.yml removed once sing off HOT 2
- Configuration file validation should evaluate environment variables HOT 3
- cannot launch kafka-shell HOT 6
- More config/properties auto-completions HOT 1
- Add support for `.sh` kafka commands in the PATH HOT 5
- Add command: kafka-replica-verification
- How to add my own custom kafka commands into this? HOT 4
- Connect to Remote kafka cluster HOT 4
- Add command: kafka-preferred-replica-election
- Plzzz Add more Easter eggs
- Allow for commands to be piped
- Auto fill `--command-config` for commands
- Does it support ACL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kafka-shell.