-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added docker standalone support. #12
base: master
Are you sure you want to change the base?
Conversation
Thank you very much, this helps a lot! Should I create a new container like this in order to create a topic?
Can you help me? This is the error that I get:
Thank you again for your work. |
So what i did is that I stood up KA+ZK with docker compose and defined the host IP: Those containers also create the topics at start.
|
Perfect, since I'd like to start my kafka server on this ip 10.0.100.23, I've created this .yaml file.
Saved it and typed docker-compose up in that folder.
and, after building the image as said, typed the docker run command. Is there something that I am missing/doing wrong? |
Try setting kafka server to your IP address:9092.
Also what does Docker ps show?
…On Mon, Apr 20, 2020 at 8:43 AM Guberlo ***@***.***> wrote:
Perfect, since I'd like to start my kafka server on this ip *10.0.100.23*,
I've created this .yaml file.
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_CREATE_TOPICS: "reddit-posts:3:1,reddit-comments:3:1:compact"
KAFKA_ADVERTISED_HOST_NAME: 10.0.100.23
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Saved it and typed docker-compose up in that folder.
Both Kafka and ZK seems to work fine. Then I moved to the repository
folder created the env file as follows:
SUBREDDIT=all
COMMENTS_SUBREDDIT=all
KAFKA_SERVER=localhost:9092
and, after building the image as said, typed the docker run command.
The container starts but, after 2 minutes, I get the same error as before.
Is there something that I am missing/doing wrong?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEWHQ5UU7UYWGDKOHEL3CTRNRGRRANCNFSM4MHPCDBQ>
.
|
Everything is working now locally with this configuration:
Thanks for your help. ---Edit--- I found the location. Everthing is working now! |
@monksy my sincerest apologies, turns out I forgot to watch my own repo and thus didn't get notified when you filed this PR and the several feature requests! I'll be reviewing this shortly and will get back to you. |
Awesome, I appreciate it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @monksy! I've left some comments about the implementation, but also wanted to take a step back and ask some questions about the goals here.
What's the intended use case? If we just want to make it as easy as possible to get the connector up and running in any environment, we could create a docker-compose file that not only brings up the connector, but also ZooKeeper and Kafka.
If the goal is to get the connector running against a pre-existing Kafka broker, I think we might be able to simplify the deployment process a little further, and also add a richer level of configurability. The environment variable-based approach is good, but with only a pre-selected collection of hard-coded properties that the user can configure, seems a little restrictive. We might consider using something like the built-in templating logic that Confluent provides with their Docker images: create a config file template (such as this one) for the connector config, then use dub
to render the template (like this) before starting the connector. We could either bake default environment variables into the image itself, or use the templating logic to set some (disclaimer: not sure if this is possible, haven't personally worked with dub
before).
plugin.path=target/components/packages/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, apologies for any headaches the lack of a newline may have caused!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really just an issue for the extra appending. This won't be needed with the replace script.
@@ -41,8 +41,8 @@ | |||
<properties> | |||
<jraw.version>1.1.0</jraw.version> | |||
<junit.version>4.12</junit.version> | |||
<kafka.version>2.0.0</kafka.version> | |||
<kafka.connect.maven.plugin.version>0.11.1</kafka.connect.maven.plugin.version> | |||
<kafka.version>2.4.1</kafka.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why is this needed? The only dependency that this property is used for is org.apache.kafka:connect-api
, which AFAIK hasn't changed in between 2.0.0 and 2.4.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there may be changes between 2.0 and 2.4. I just wanted to get it on the (then latest)
# We're going to override the subreddit, comments, and broker if we have an environment variable set | ||
|
||
[[ -v SUBREDDIT ]] && echo "posts.subreddits=$SUBREDDIT" >> /kafka-connect-reddit/kafka-connect-reddit-source.properties | ||
[[ -v COMMENTS_SUBREDDIT ]] && echo "comments.subreddits=$COMMENTS_SUBREDDIT" >> /kafka-connect-reddit/kafka-connect-reddit-source.properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion here RE: replacing with a sed script
The environment file that was used looks like this: (To configure the subreddit, comment location, and where your broker can be reached) | ||
|
||
```bash | ||
SUBREDDIT=chicagohelicopters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use POSTS_SUBREDDITS
here (with the POST_
prefix, and pluralized)? Seems better to be explicit than implicit, and it'd align with the precedents set elsewhere in the connector for the properties that dictate the posts/comments subreddits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point.. I didn't consider that.
```bash | ||
SUBREDDIT=chicagohelicopters | ||
COMMENTS_SUBREDDIT=chicagohelicopters | ||
KAFKA_SERVER=<kafka hostname>:9092 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: kind of seems like 9092 is a hard coded port here, maybe change it to:
KAFKA_SERVER=<kafka hostname>:9092 | |
KAFKA_SERVER=localhost:9092 |
KAFKA_SERVER=<kafka hostname>:9092 | ||
``` | ||
|
||
Note: Change the kafka host name. If the variable in the file or docker run arguements is not present then it will default to the following values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: spelling, wording
Note: Change the kafka host name. If the variable in the file or docker run arguements is not present then it will default to the following values: | |
Note: Make sure to change the Kafka host name. Variables not specified in the env file or docker run arguments will default to the following values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, might be worth pointing out that people can use the docker.for.mac.localhost
hostname if they're using Mac and have a Kafka broker running locally.
Co-Authored-By: Chris Egerton <[email protected]>
Co-Authored-By: Chris Egerton <[email protected]>
Co-Authored-By: Chris Egerton <[email protected]>
Right now I'm not using the Confluent platform with my kafka setup. (I'm not sure what's community and what's not open source) I was looking to have this stood up as a self-contained docker container in isolation that'll just run this with whatever broker you have available. I don't want to bind it to a docker compose cluster. I would leave that to the person using it. As far as the images that Confluent provides, I'm not well versed at what they provide. I'm open to suggestions. |
Co-Authored-By: Chris Egerton <[email protected]>
Okay, that helps clarify things. I'm not very familiar either with Confluent's Docker utilities; I think we might be able to just get away with some copy+paste+tweak here with a template file and an invocation of |
I'm willing to work with you this weekend. I'm not sure how much time I will have between now and Saturday.. But if you want to get together to work through this, I would be up for that. |
This adds in support so that you can stand up this connector and have it up and working from a local build. Also, this gives support to customize the subreddit, comments subreddit, and broker via environment variable.
Please note: the blank lines in
connect-standalone.properties
are neccessary because the environment variables are added to the property files and it's overriding the defaults from what you had.