Skip to content

Instantly share code, notes, and snippets.

View seeker815's full-sized avatar

Sai Kothapalle seeker815

  • self
  • Bangalore, India
View GitHub Profile
@seeker815
seeker815 / app.json
Created December 28, 2017 04:58
production.docker-registry-v2
{
"id": "/production.docker-registry-v2",
"cmd": null,
"cpus": 1,
"mem": 2048,
"disk": 2048,
"instances": 1,
"constraints": [
[
"lifecycle",
@seeker815
seeker815 / app.py
Last active April 20, 2018 13:21
python code for hadoop metrics
import requests
import json
import boto
import socket
HOSTNAME = socket.gethostbyaddr(socket.gethostname())[0]
JOB_TRACKER_URL = "http://" + HOSTNAME + ":8088/ws/v1/cluster/metrics/"
config = json.load(open("config.json"))
METRIC_NAMESPACE = config['namespace']
<clusterMetrics>
<appsSubmitted>183</appsSubmitted>
<appsCompleted>181</appsCompleted>
<appsPending>0</appsPending>
<appsRunning>0</appsRunning>
<appsFailed>0</appsFailed>
<appsKilled>2</appsKilled>
<reservedMB>0</reservedMB>
<availableMB>0</availableMB>
<allocatedMB>0</allocatedMB>
@seeker815
seeker815 / trap_bash_errors.sh
Created May 24, 2018 11:09
Pattern to trap signals to make your bash script robust
#!/bin/bash
# trap
trap suicide SIGINT SIGHUP SIGQUIT
suicide (){
echo $?
echo "You hit Cntrl+c, exiting"
exit
}
@seeker815
seeker815 / boostrap_2.sh
Created May 24, 2018 11:19
trap with EXIT
#!/bin/bash
# trap1
trap suicide EXIT SIGINT SIGQUIT
suicide (){
if [ $? -ne 0 ]; then
echo "You hit Cntrl+c, exiting"
fi
exit
}
count=0
@seeker815
seeker815 / benchmark-commands.txt
Created June 11, 2018 05:16 — forked from zodvik/benchmark-commands.txt
Kafka (1.0.0) Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-two --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-one --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 buffer.memory=67108864 batch.size=8196
Single-thread, async 3x replication
@seeker815
seeker815 / benchmark.sh
Created June 12, 2018 05:53 — forked from ambud/benchmark.sh
Kafka Benchmark
#!/bin/bash
#
# Author: Ambud Sharma
#
# Purpose: To run kafka Kafka Producer / Consumer benchmark and create results
#
export NUM_RECORDS=10000000
export TOPIC_NAME_PREFIX="perf"
export CLUSTER_SIZE=3
export DRIVE_COUNT=1
@seeker815
seeker815 / kafka_benchmark.sh
Created June 12, 2018 11:47
Benchmark kafka
#!/bin/bash
# Purpose: To run kafka Kafka Producer / Consumer benchmark for Indix cluster
#
export TOPIC_NAME="benchmark_2_400"
export CLUSTER_SIZE=3
export DRIVE_COUNT=1
export BROKER_ADDRESS="10.181.18.63:9092"
export ZOOKEEPER_ADDRESS="10.181.18.63:2181"
@seeker815
seeker815 / startstopinstanceswithtag.py
Created July 13, 2018 14:42 — forked from coingraham/startstopinstanceswithtag.py
Python - start stopped or stop running instances with particular tag
import boto3
tagname = "Name"
tagvalue = "Value"
ec2 = boto3.resource('ec2')
ec2.instances.filter(Filters=[
{'Name': 'tag': [tagname], 'Values': [tagvalue]},
{'Name': 'instance-state-name', 'Values': ['running']}
]).start()
ec2.instances.filter(Filters=[
@seeker815
seeker815 / docker-compose-cheatsheet.sh
Created August 21, 2018 21:44 — forked from buonzz/docker-compose-cheatsheet.sh
docker-compose cheatsheet
$ docker-compose up -d # start containers in background
$ docker-compose kill # stop containers
$ docker-compose up -d --build # force rebuild of Dockerfiles
$ docker-compose rm # remove stopped containers
$ docker ps # see list of running containers
$ docker exec -ti [NAME] bash # ssh to the container
# list all images
docker images