1

running Kafka Connect 4.1.1 on DC/OS using the confluent community package. How can we upload or add our jdbc driver to the remote cluster?

Update: It's a package installed DC/OS catalog, which is a mesos framework, running docker images.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
user432024
  • 4,392
  • 8
  • 49
  • 85

1 Answers1

3

Update

Script borrowed from here (thanks to @rmoff)

It's an example of overriding the Docker CMD with a bash script to download and extract the REST API source connector.

bash -c 'echo Installing unzip… && \
                curl -so unzip.deb http://ftp.br.debian.org/debian/pool/main/u/unzip/unzip_6.0-16+deb8u3_amd64.deb && \
                dpkg -i unzip.deb && \
                echo Downloading connector… && \
                curl -so kafka-connect-rest.zip https://storage.googleapis.com/rmoff-connectors/kafka-connect-rest.zip && \
                mkdir -p /u01/connectors/ && \
                unzip -j kafka-connect-rest.zip -d /u01/connectors/kafka-connect-rest && \
                echo Launching Connect… && \
                /etc/confluent/docker/run'

You'll need to build your own Docker images and publish them to a resolvable Docker Registry for your Mesos cluster, and then edit the Mesos Service to pull these images instead of the Confluent one.

For example, in your Dockerfiles, you would have

ADD http://somepath.com/someJDBC-driver.jar /usr/share/java/kafka-connect-jdbc

Or curl rather than ADD, as shown in the Confluent docs (because it needs to extract that .tar.gz file).

FROM confluentinc/cp-kafka-connect

ENV MYSQL_DRIVER_VERSION 5.1.39

RUN curl -k -SL "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz" \
    | tar -xzf - -C /usr/share/java/kafka-connect-jdbc/ --strip-components=1 mysql-connector-java-5.1.39/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar

You can also use confluent-hub install to add other connectors that aren't JDBC JAR files

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Yeah that much I figured. The issue is how do I tell the mesos framework to use that that specific docker image. I'll have to dig around. I'll up-vote your answer for now. – user432024 Nov 13 '18 at 15:35
  • I'd guess the docker daemon settings on the machine, but DCOS might be able to setup a custom Docker registry, I'm not sure. Otherwise, you could just push to DockerHub – OneCricketeer Nov 13 '18 at 15:37
  • It's more complicated then that. I need to rebuild the framework. 1- I need to find the src of it first lol. Worst case I will deploy my own service using marathon and standard docker images. – user432024 Nov 13 '18 at 15:42
  • Not sure what you mean by "rebuild", `FROM confluentinc/cp-kafka-connect` should be fine. Otherwise, you just download the OSS Confluent tarball – OneCricketeer Nov 13 '18 at 15:46
  • Yes that's all understood, the mesos framework is a bunch of YAML (worst case compiled code) files using the DC/OS mesos SDK: https://mesosphere.github.io/dcos-commons/developer-guide/. So I would have to download that framework and look for the docker image and change that. Technically the framework should have allowed to specify a "volume" to allow it to get the jars. Thats what happens when we wan't to use one click installs haha – user432024 Nov 13 '18 at 15:55
  • Oh, I think I understand. I've not used those one click catalog things, though – OneCricketeer Nov 13 '18 at 15:57
  • Yeah certain things work great! Like I'm running the packaged Kafka and no complains, but when you need customization, you have to dig in... – user432024 Nov 13 '18 at 16:01