- 浏览: 2564602 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Data Solution 2019(2)Kafka Single on Docker
Download the binary
> wget http://apache.osuosl.org/kafka/2.1.0/kafka_2.11-2.1.0.tgz
Unzip the file and place in the working directory
Start the single Zookeeper
> bin/zookeeper-server-start.sh config/zookeeper.properties
Start the Kafka Server
> bin/kafka-server-start.sh config/server.properties
Verify my installation, create a topic testyiyi
> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testyiyi
Send some messages in producer
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testyiyi
Start a consumer to receive these informations
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testyiyi --from-beginning
Try to run that in Docker
This is the start.sh, in the shell script I need to wait until the zookeeper starts
#!/bin/sh -ex
#start the service
cd /tool/kafka
nohup bin/zookeeper-server-start.sh config/zookeeper.properties > /tmp/zookeeper.log &
sleep 1
while ! grep -m1 'binding to port' < /tmp/zookeeper.log; do
sleep 1
done
bin/kafka-server-start.sh config/server.properties
Makefile is almost the same, nothing special
IMAGE=sillycat/public
TAG=ubuntu-kafka-1.0
NAME=ubuntu-kafka-1.0
prepare:
wget http://apache.osuosl.org/kafka/2.1.0/kafka_2.11-2.1.0.tgz -P install/
docker-context:
build: docker-context
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 2181:2181 -p 9092:9092 --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 2181:2181 -p 9092:9092 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}
Dockerfile, it installed the oracle JDK, that is nice
#Run a kafka server side
#Prepare the OS
FROM ubuntu:16.04
MAINTAINER Carl Luo <luohuazju@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
#Prepare the denpendencies
RUN apt-get install -qy wget unzip
#Install SUN JAVA
RUN apt-get update && \
apt-get install -y --no-install-recommends locales && \
locale-gen en_US.UTF-8 && \
apt-get dist-upgrade -y && \
apt-get --purge remove openjdk* && \
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
apt-get update && \
apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
apt-get clean all
#add the software
RUN mkdir /tool/
RUN mkdir /admin/
WORKDIR /tool/
ADD install/kafka_2.11-2.1.0.tgz /tool/
RUN ln -s /tool/kafka_2.11-2.1.0 /tool/kafka
ADD conf/server.properties /tool/kafka/config
#set up the app
EXPOSE 2181 9092
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app/
CMD [ "./start.sh" ]
Most of the content from server.properties are good, I only change the listeners and advertised.listerners
############################# Socket Server Settings #############################
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
# FORMAT:
# listeners = listener_name://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://:9092
# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured. Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
advertised.listeners=PLAINTEXT://localhost:9092
References:
https://kafka.apache.org/quickstart
Wait for server to start in shell script
https://stackoverflow.com/questions/21475639/wait-until-service-starts-in-bash-script
Install JDK 8
https://github.com/mlaccetti/docker-oracle-java8-ubuntu-16.04/blob/master/Dockerfile
https://github.com/wurstmeister/kafka-docker/wiki/Connectivity
Download the binary
> wget http://apache.osuosl.org/kafka/2.1.0/kafka_2.11-2.1.0.tgz
Unzip the file and place in the working directory
Start the single Zookeeper
> bin/zookeeper-server-start.sh config/zookeeper.properties
Start the Kafka Server
> bin/kafka-server-start.sh config/server.properties
Verify my installation, create a topic testyiyi
> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testyiyi
Send some messages in producer
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testyiyi
Start a consumer to receive these informations
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testyiyi --from-beginning
Try to run that in Docker
This is the start.sh, in the shell script I need to wait until the zookeeper starts
#!/bin/sh -ex
#start the service
cd /tool/kafka
nohup bin/zookeeper-server-start.sh config/zookeeper.properties > /tmp/zookeeper.log &
sleep 1
while ! grep -m1 'binding to port' < /tmp/zookeeper.log; do
sleep 1
done
bin/kafka-server-start.sh config/server.properties
Makefile is almost the same, nothing special
IMAGE=sillycat/public
TAG=ubuntu-kafka-1.0
NAME=ubuntu-kafka-1.0
prepare:
wget http://apache.osuosl.org/kafka/2.1.0/kafka_2.11-2.1.0.tgz -P install/
docker-context:
build: docker-context
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 2181:2181 -p 9092:9092 --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 2181:2181 -p 9092:9092 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}
Dockerfile, it installed the oracle JDK, that is nice
#Run a kafka server side
#Prepare the OS
FROM ubuntu:16.04
MAINTAINER Carl Luo <luohuazju@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
#Prepare the denpendencies
RUN apt-get install -qy wget unzip
#Install SUN JAVA
RUN apt-get update && \
apt-get install -y --no-install-recommends locales && \
locale-gen en_US.UTF-8 && \
apt-get dist-upgrade -y && \
apt-get --purge remove openjdk* && \
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
apt-get update && \
apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
apt-get clean all
#add the software
RUN mkdir /tool/
RUN mkdir /admin/
WORKDIR /tool/
ADD install/kafka_2.11-2.1.0.tgz /tool/
RUN ln -s /tool/kafka_2.11-2.1.0 /tool/kafka
ADD conf/server.properties /tool/kafka/config
#set up the app
EXPOSE 2181 9092
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app/
CMD [ "./start.sh" ]
Most of the content from server.properties are good, I only change the listeners and advertised.listerners
############################# Socket Server Settings #############################
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
# FORMAT:
# listeners = listener_name://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://:9092
# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured. Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
advertised.listeners=PLAINTEXT://localhost:9092
References:
https://kafka.apache.org/quickstart
Wait for server to start in shell script
https://stackoverflow.com/questions/21475639/wait-until-service-starts-in-bash-script
Install JDK 8
https://github.com/mlaccetti/docker-oracle-java8-ubuntu-16.04/blob/master/Dockerfile
https://github.com/wurstmeister/kafka-docker/wiki/Connectivity
发表评论
-
Update Site will come soon
2021-06-02 04:10 1688I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 325I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 486NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 375Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 376Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 345Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 437Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 446Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 383Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 469VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 396Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 491NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 433Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 343Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 257GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 458GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 334GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 318Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 327Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 304Serverless with NodeJS and Tenc ...
相关推荐
kafka的docker镜像包含了kafka,zookeeper 和kafkamanager,可以通过docker 来load 安装
docker的kafka镜像
docker容器中搭建kafka集群环境,kafka集群配置注意事项与优化
这个Docker Compose 文件定义了一个包含Zookeeper和三个Kafka节点的服务集群。通过指定镜像、端口映射、环境变量和依赖关系等配置,实现了Zookeeper和Kafka的快速部署和集成。同时,在定义了一个名为"mynetwork"的...
# 可以根据需要增加更多的kafka服务实例,如kafka2, kafka3等 networks: kafka-net: ``` 此配置文件中,我们启动了一个Zookeeper实例(zookeeper1)和一个Kafka实例(kafka1),并暴露了它们的默认端口。Kafka...
bitnami-docker-kafka:用于Kafka的Bitnami Docker映像
kafkamanager-docker Docker 设置要求码头工人docker-compose ( )独立运行(不需要 docker-compose) $ > docker run -p 9000:9000 -e ZKHOSTS= < server> : < port> --name= " kafka-manager " srangwal/kafka...
docker.io/danielqsj/kafka-exporter:v1.7.0
kafka-sparkstreaming-cassandra, 用于 Kafka Spark流的Docker 容器 用于 Kafka Spark流的Docker 容器这里Dockerfile为实验 Kafka 。Spark流( PySpark ) 和Cassandra设置了完整的流环境。 安装Kafka 0.10.2.1用于 ...
flink搭配kafka,构建流式采集框架,提供了docker部署方式脚本和k8s多副本方式部署脚本
-manager,Docker-compose脚本,使用之前需要手动配置文件中的zookeeper链接,使用之前需要先创建Docker网络: docker network create zoo_kafka。 Docker镜像使用的是:wurstmeister/kafka、sheepkiller/kafka-...
linux环境实现shell一键部署docker容器运行kafka集群(docker-compose实现集群启动,内置kafka-manager、zookeeper)
DR $ docker run --name kafka-exporter bitnami/kafka-exporter:latest为什么要使用Bitnami Images? Bitnami密切跟踪上游源变化,并使用我们的自动化系统及时发布该图像的新版本。 对于Bitnami映像,将尽快提供...
信创环境: 系统:Kylin V10,架构:arm64
docker-compose安装kafka
Build Kafka cluster with docker-compose集群管理方法构建imagecd demokafka.0.10.1.0docker-compose build启动集群cd demokafka.0.10.1.0docker-compose up -d停止集群cd demokafka.0.10.1.0docker-compose stop...
2. **Docker Compose** Docker Compose是一个工具,用于定义和运行多容器Docker应用。通过YAML文件(docker-compose.yml)配置服务、网络和卷,可以一次性启动整个应用环境。 3. **Kafka与Zookeeper** Apache ...
3.6.docker安装 kafka 参数解释: -d :后台运行 – name 当前容器的名字。 -p:暴露端口,-p 9092:9092 将容器内部的9092端口映射到宿主机的端口上。 –privileged:使用该参数,container内的root拥有真正的root...
vagrant 安装docker docker 安装mysql 、redis、kafka、 自启动
docker 安装kafka指令(映射挂载宿主机)