瀏覽代碼

Delete vagrant test harness setup

KJ Tsanaktsidis 4 年之前
父節點
當前提交
42bbd066c0

+ 0 - 9
vagrant/create_topics.sh

@@ -1,9 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-cd ${KAFKA_INSTALL_ROOT}/kafka-9092
-bin/kafka-topics.sh --create --partitions 1 --replication-factor 3 --topic test.1 --zookeeper localhost:2181
-bin/kafka-topics.sh --create --partitions 4 --replication-factor 3 --topic test.4 --zookeeper localhost:2181
-bin/kafka-topics.sh --create --partitions 64 --replication-factor 3 --topic test.64  --zookeeper localhost:2181
-bin/kafka-topics.sh --create --partitions 1 --replication-factor 3 --topic uncommitted-topic-test-4  --zookeeper localhost:2181

+ 0 - 25
vagrant/halt_cluster.sh

@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# If the functional tests failed (or some other task) then
-# we might want to look into the broker logs
-if [ "$TRAVIS_TEST_RESULT" = "1" ]; then
-    echo "Dumping Kafka brokers server.log:"
-    for i in 1 2 3 4 5; do
-        KAFKA_PORT=`expr $i + 9090`
-        sed -e "s/^/kafka-${KAFKA_PORT} /" ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/logs/server.log{.*,}
-    done
-fi
-
-set -ex
-
-for i in 1 2 3 4 5; do
-    KAFKA_PORT=`expr $i + 9090`
-    cd ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT} && bin/kafka-server-stop.sh
-done
-
-for i in 1 2 3 4 5; do
-    KAFKA_PORT=`expr $i + 9090`
-    cd ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT} && bin/zookeeper-server-stop.sh
-done
-
-killall toxiproxy

+ 0 - 86
vagrant/install_cluster.sh

@@ -1,86 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-TOXIPROXY_VERSION=2.1.4
-
-mkdir -p ${KAFKA_INSTALL_ROOT}
-if [ ! -f ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz ]; then
-    wget --quiet https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_${KAFKA_SCALA_VERSION}-${KAFKA_VERSION}.tgz -O ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz
-fi
-if [ ! -f ${KAFKA_INSTALL_ROOT}/toxiproxy-${TOXIPROXY_VERSION} ]; then
-    wget --quiet https://github.com/Shopify/toxiproxy/releases/download/v${TOXIPROXY_VERSION}/toxiproxy-server-linux-amd64 -O ${KAFKA_INSTALL_ROOT}/toxiproxy-${TOXIPROXY_VERSION}
-    chmod +x ${KAFKA_INSTALL_ROOT}/toxiproxy-${TOXIPROXY_VERSION}
-fi
-rm -f ${KAFKA_INSTALL_ROOT}/toxiproxy
-ln -s ${KAFKA_INSTALL_ROOT}/toxiproxy-${TOXIPROXY_VERSION} ${KAFKA_INSTALL_ROOT}/toxiproxy
-
-for i in 1 2 3 4 5; do
-    ZK_PORT=$((i + 2180))
-    ZK_PORT_REAL=$((i + 21800))
-    KAFKA_PORT=$((i + 9090))
-    KAFKA_PORT_REAL=$((i + 29090))
-
-    # unpack kafka
-    mkdir -p ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}
-    tar xzf ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz -C ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT} --strip-components 1
-
-    # broker configuration
-    mkdir -p "${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/data"
-
-    # Append to default server.properties with a small number of customisations
-    printf "\n\n" >> "${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/server.properties"
-    cat << EOF >> "${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/server.properties"
-############################# Sarama Test Cluster #############################
-
-broker.id=${KAFKA_PORT}
-broker.rack=${i}
-
-# Listen on "real" port
-listeners=PLAINTEXT://:${KAFKA_PORT_REAL}
-# Advertise Toxiproxy port
-advertised.listeners=PLAINTEXT://${KAFKA_HOSTNAME}:${KAFKA_PORT}
-
-# Connect to Zookeeper via Toxiproxy port
-zookeeper.connect=127.0.0.1:${ZK_PORT}
-
-# Data directory
-log.dirs="${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/data"
-
-# Create new topics with a replication factor of 2 so failover can be tested
-# more easily.
-default.replication.factor=2
-
-# Turn on log.retention.bytes to avoid filling up the VM's disk
-log.retention.bytes=268435456
-log.segment.bytes=268435456
-
-# Enable topic deletion and disable auto-creation
-delete.topic.enable=true
-auto.create.topics.enable=false
-
-# Lower the zookeeper timeouts so we don't have to wait forever for a node
-# to die when we use toxiproxy to kill its zookeeper connection
-zookeeper.session.timeout.ms=3000
-zookeeper.connection.timeout.ms=3000
-
-# Disable broker ID length constraint
-reserved.broker.max.id=10000
-
-# Permit follower fetching (KIP-392)
-replica.selector.class=org.apache.kafka.common.replica.RackAwareReplicaSelector
-
-###############################################################################
-EOF
-
-    # zookeeper configuration
-    cp ${REPOSITORY_ROOT}/vagrant/zookeeper.properties ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/
-    sed -i s/KAFKAID/${KAFKA_PORT}/g ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/zookeeper.properties
-    sed -i s/ZK_PORT/${ZK_PORT_REAL}/g ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/zookeeper.properties
-
-    ZK_DATADIR="${KAFKA_INSTALL_ROOT}/zookeeper-${ZK_PORT}"
-    mkdir -p ${ZK_DATADIR}
-    sed -i s#ZK_DATADIR#${ZK_DATADIR}#g ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/config/zookeeper.properties
-
-    echo $i > ${KAFKA_INSTALL_ROOT}/zookeeper-${ZK_PORT}/myid
-done

+ 0 - 9
vagrant/kafka.conf

@@ -1,9 +0,0 @@
-start on started zookeeper-ZK_PORT
-stop on stopping zookeeper-ZK_PORT
-
-# Use a script instead of exec (using env stanza leaks KAFKA_HEAP_OPTS from zookeeper)
-script
-  sleep 2
-  export KAFKA_HEAP_OPTS="-Xmx320m"
-  exec /opt/kafka-KAFKAID/bin/kafka-server-start.sh /opt/kafka-KAFKAID/config/server.properties
-end script

+ 0 - 17
vagrant/provision.sh

@@ -1,17 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-apt-get update
-yes | apt-get install default-jre
-
-export KAFKA_INSTALL_ROOT=/opt
-export KAFKA_HOSTNAME=192.168.100.67
-export KAFKA_VERSION=1.0.2
-export KAFKA_SCALA_VERSION=2.11
-export REPOSITORY_ROOT=/vagrant
-
-sh /vagrant/vagrant/install_cluster.sh
-sh /vagrant/vagrant/setup_services.sh
-sh /vagrant/vagrant/create_topics.sh
-sh /vagrant/vagrant/run_java_producer.sh

+ 0 - 6
vagrant/run_java_producer.sh

@@ -1,6 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-wget https://github.com/FrancoisPoinsot/simplest-uncommitted-msg/releases/download/0.1/simplest-uncommitted-msg-0.1-jar-with-dependencies.jar
-java -jar simplest-uncommitted-msg-0.1-jar-with-dependencies.jar -b ${KAFKA_HOSTNAME}:9092 -c 4

+ 0 - 22
vagrant/run_toxiproxy.sh

@@ -1,22 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-${KAFKA_INSTALL_ROOT}/toxiproxy -port 8474 -host 0.0.0.0 &
-PID=$!
-
-while ! nc -q 1 localhost 8474 </dev/null; do echo "Waiting"; sleep 1; done
-
-wget -O/dev/null -S --post-data='{"name":"zk1", "upstream":"localhost:21801", "listen":"0.0.0.0:2181"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"zk2", "upstream":"localhost:21802", "listen":"0.0.0.0:2182"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"zk3", "upstream":"localhost:21803", "listen":"0.0.0.0:2183"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"zk4", "upstream":"localhost:21804", "listen":"0.0.0.0:2184"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"zk5", "upstream":"localhost:21805", "listen":"0.0.0.0:2185"}' localhost:8474/proxies
-
-wget -O/dev/null -S --post-data='{"name":"kafka1", "upstream":"localhost:29091", "listen":"0.0.0.0:9091"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"kafka2", "upstream":"localhost:29092", "listen":"0.0.0.0:9092"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"kafka3", "upstream":"localhost:29093", "listen":"0.0.0.0:9093"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"kafka4", "upstream":"localhost:29094", "listen":"0.0.0.0:9094"}' localhost:8474/proxies
-wget -O/dev/null -S --post-data='{"name":"kafka5", "upstream":"localhost:29095", "listen":"0.0.0.0:9095"}' localhost:8474/proxies
-
-wait $PID

+ 0 - 29
vagrant/setup_services.sh

@@ -1,29 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-stop toxiproxy || true
-cp ${REPOSITORY_ROOT}/vagrant/toxiproxy.conf /etc/init/toxiproxy.conf
-cp ${REPOSITORY_ROOT}/vagrant/run_toxiproxy.sh ${KAFKA_INSTALL_ROOT}/
-start toxiproxy
-
-for i in 1 2 3 4 5; do
-    ZK_PORT=`expr $i + 2180`
-    KAFKA_PORT=`expr $i + 9090`
-
-    stop zookeeper-${ZK_PORT} || true
-
-    # set up zk service
-    cp ${REPOSITORY_ROOT}/vagrant/zookeeper.conf /etc/init/zookeeper-${ZK_PORT}.conf
-    sed -i s/KAFKAID/${KAFKA_PORT}/g /etc/init/zookeeper-${ZK_PORT}.conf
-
-    # set up kafka service
-    cp ${REPOSITORY_ROOT}/vagrant/kafka.conf /etc/init/kafka-${KAFKA_PORT}.conf
-    sed -i s/KAFKAID/${KAFKA_PORT}/g /etc/init/kafka-${KAFKA_PORT}.conf
-    sed -i s/ZK_PORT/${ZK_PORT}/g /etc/init/kafka-${KAFKA_PORT}.conf
-
-    start zookeeper-${ZK_PORT}
-done
-
-# Wait for the last kafka node to finish booting
-while ! nc -q 1 localhost 29095 </dev/null; do echo "Waiting"; sleep 1; done

+ 0 - 6
vagrant/toxiproxy.conf

@@ -1,6 +0,0 @@
-start on started networking
-stop on shutdown
-
-env KAFKA_INSTALL_ROOT=/opt
-
-exec /opt/run_toxiproxy.sh

+ 0 - 7
vagrant/zookeeper.conf

@@ -1,7 +0,0 @@
-start on started toxiproxy
-stop on stopping toxiproxy
-
-script
-  export KAFKA_HEAP_OPTS="-Xmx192m"
-  exec /opt/kafka-KAFKAID/bin/zookeeper-server-start.sh /opt/kafka-KAFKAID/config/zookeeper.properties
-end script

+ 0 - 36
vagrant/zookeeper.properties

@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# the directory where the snapshot is stored.
-dataDir=ZK_DATADIR
-# the port at which the clients will connect
-clientPort=ZK_PORT
-# disable the per-ip limit on the number of connections since this is a non-production config
-maxClientCnxns=0
-
-# The number of milliseconds of each tick
-tickTime=2000
-
-# The number of ticks that the initial synchronization phase can take
-initLimit=10
-
-# The number of ticks that can pass between
-# sending a request and getting an acknowledgement
-syncLimit=5
-
-server.1=localhost:2281:2381
-server.2=localhost:2282:2382
-server.3=localhost:2283:2383
-server.4=localhost:2284:2384
-server.5=localhost:2285:2385