Skip to content

Commit 5d5c6f1

Browse files
committed
Adds Dockerfiles and docker-compose file
1 parent f04fa76 commit 5d5c6f1

File tree

9 files changed

+240
-1
lines changed

9 files changed

+240
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
2-
2+
.DS_Store
3+
kafka_2.11-0.10.0.0/

data/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu
2+
RUN mkdir -p /usr/share/elasticsearch/data
3+
RUN mkdir -p /var/lib/zookeeper
4+
RUN mkdir -p /tmp/kafka-logs
5+
VOLUME ["/usr/share/elasticsearch/data", "/var/lib/zookeeper", "/tmp/kafka-logs"]

docker-compose.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '2'
2+
services:
3+
elasticsearch:
4+
image: elasticsearch:2.2.0
5+
ports:
6+
- "9200:9200"
7+
- "9300:9300"
8+
volumes_from:
9+
- data
10+
kibana:
11+
image: kibana:4.4.1
12+
links:
13+
- elasticsearch
14+
environment:
15+
ELASTICSEARCH_URL: "http://elasticsearch:9200"
16+
ports:
17+
- "5601:5601"
18+
logstash:
19+
build: logstash/
20+
links:
21+
- elasticsearch
22+
- zookeeper
23+
- kafka
24+
zookeeper:
25+
build: zookeeper/
26+
ports:
27+
- "2181:2181"
28+
volumes_from:
29+
- data
30+
kafka:
31+
build: kafka/
32+
links:
33+
- zookeeper
34+
ports:
35+
- "9092:9092"
36+
volumes_from:
37+
- data
38+
data:
39+
build: data/

kafka/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update
4+
RUN apt-get install -y default-jre wget
5+
6+
7+
RUN wget http://www.eu.apache.org/dist/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz
8+
9+
RUN tar -xvzf kafka_2.11-0.9.0.0.tgz
10+
11+
EXPOSE 9092
12+
13+
COPY config/ config/
14+
15+
WORKDIR /kafka_2.11-0.9.0.0/
16+
17+
RUN mkdir -p /tmp/kafka-logs
18+
19+
VOLUME /tmp/kafka-logs
20+
21+
CMD ["bin/kafka-server-start.sh", "/config/server.properties"]

kafka/config/server.properties

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# see kafka.server.KafkaConfig for additional details and defaults
16+
17+
############################# Server Basics #############################
18+
19+
# The id of the broker. This must be set to a unique integer for each broker.
20+
broker.id=0
21+
22+
############################# Socket Server Settings #############################
23+
24+
listeners=PLAINTEXT://:9092
25+
26+
# The port the socket server listens on
27+
#port=9092
28+
29+
# Hostname the broker will bind to. If not set, the server will bind to all interfaces
30+
#host.name=localhost
31+
32+
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
33+
# value for "host.name" if configured. Otherwise, it will use the value returned from
34+
# java.net.InetAddress.getCanonicalHostName().
35+
advertised.host.name=kafka
36+
37+
# The port to publish to ZooKeeper for clients to use. If this is not set,
38+
# it will publish the same port that the broker binds to.
39+
#advertised.port=<port accessible by clients>
40+
41+
# The number of threads handling network requests
42+
num.network.threads=3
43+
44+
# The number of threads doing disk I/O
45+
num.io.threads=8
46+
47+
# The send buffer (SO_SNDBUF) used by the socket server
48+
socket.send.buffer.bytes=102400
49+
50+
# The receive buffer (SO_RCVBUF) used by the socket server
51+
socket.receive.buffer.bytes=102400
52+
53+
# The maximum size of a request that the socket server will accept (protection against OOM)
54+
socket.request.max.bytes=104857600
55+
56+
57+
############################# Log Basics #############################
58+
59+
# A comma seperated list of directories under which to store log files
60+
log.dirs=/tmp/kafka-logs
61+
62+
# The default number of log partitions per topic. More partitions allow greater
63+
# parallelism for consumption, but this will also result in more files across
64+
# the brokers.
65+
num.partitions=1
66+
67+
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
68+
# This value is recommended to be increased for installations with data dirs located in RAID array.
69+
num.recovery.threads.per.data.dir=1
70+
71+
############################# Log Flush Policy #############################
72+
73+
# Messages are immediately written to the filesystem but by default we only fsync() to sync
74+
# the OS cache lazily. The following configurations control the flush of data to disk.
75+
# There are a few important trade-offs here:
76+
# 1. Durability: Unflushed data may be lost if you are not using replication.
77+
# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
78+
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks.
79+
# The settings below allow one to configure the flush policy to flush data after a period of time or
80+
# every N messages (or both). This can be done globally and overridden on a per-topic basis.
81+
82+
# The number of messages to accept before forcing a flush of data to disk
83+
#log.flush.interval.messages=10000
84+
85+
# The maximum amount of time a message can sit in a log before we force a flush
86+
#log.flush.interval.ms=1000
87+
88+
############################# Log Retention Policy #############################
89+
90+
# The following configurations control the disposal of log segments. The policy can
91+
# be set to delete segments after a period of time, or after a given size has accumulated.
92+
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
93+
# from the end of the log.
94+
95+
# The minimum age of a log file to be eligible for deletion
96+
log.retention.hours=168
97+
98+
# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
99+
# segments don't drop below log.retention.bytes.
100+
#log.retention.bytes=1073741824
101+
102+
# The maximum size of a log segment file. When this size is reached a new log segment will be created.
103+
log.segment.bytes=1073741824
104+
105+
# The interval at which log segments are checked to see if they can be deleted according
106+
# to the retention policies
107+
log.retention.check.interval.ms=300000
108+
109+
# By default the log cleaner is disabled and the log retention policy will default to just delete segments after their retention expires.
110+
# If log.cleaner.enable=true is set the cleaner will be enabled and individual logs can then be marked for log compaction.
111+
log.cleaner.enable=false
112+
113+
############################# Zookeeper #############################
114+
115+
# Zookeeper connection string (see zookeeper docs for details).
116+
# This is a comma separated host:port pairs, each corresponding to a zk
117+
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
118+
# You can also append an optional chroot string to the urls to specify the
119+
# root directory for all kafka znodes.
120+
zookeeper.connect=zookeeper:2181
121+
122+
# Timeout in ms for connecting to zookeeper
123+
zookeeper.connection.timeout.ms=6000

logstash/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update
4+
RUN apt-get install -y default-jre wget
5+
6+
RUN wget https://download.elastic.co/logstash/logstash/logstash-2.1.3.tar.gz
7+
RUN tar -xvzf logstash-2.1.3.tar.gz
8+
9+
COPY config/ config/
10+
11+
WORKDIR /logstash-2.1.3
12+
13+
CMD ["bin/logstash", "-f", "/config/logstash.conf"]

logstash/config/logstash.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
input {
2+
kafka {
3+
topic_id => 'APPLICATION_LOGS'
4+
zk_connect => 'zookeeper:2181'
5+
}
6+
}
7+
# filter {
8+
#
9+
# }
10+
output {
11+
stdout { codec => rubydebug }
12+
elasticsearch {
13+
hosts => ["elasticsearch:9200"]
14+
}
15+
}

zookeeper/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update
4+
RUN apt-get install -y default-jre wget
5+
6+
RUN wget http://www.eu.apache.org/dist/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
7+
RUN tar -xvzf zookeeper-3.4.8.tar.gz
8+
9+
RUN mkdir -p /var/lib/zookeeper
10+
11+
VOLUME /var/lib/zookeeper
12+
13+
WORKDIR /zookeeper-3.4.8
14+
15+
COPY config/zoo.cfg conf/
16+
17+
EXPOSE 2181
18+
19+
CMD ["bin/zkServer.sh", "start-foreground"]

zookeeper/config/zoo.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tickTime=2000
2+
dataDir=/var/lib/zookeeper
3+
clientPort=2181

0 commit comments

Comments
 (0)