Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am smuthali on github.
  • I am smuthali (https://keybase.io/smuthali) on keybase.
  • I have a public key ASCLi0QcKmYfO6zWXIlO59IC6oDgpkY_urVgIydXFC2V5wo

To claim this, I am signing this object:

@smuthali
smuthali / kafka.tpl
Last active November 9, 2016 01:46
Kafka Consul template
#!/bin/bash
set -x
BROKERID={{ range $i, $services := service "zookeeper" }}{{ with node }}{{ if eq $services.Node .Node.Node }}{{ $i }}{{ end }}{{ end }}{{ end }}
HOSTNAME={{ range $i, $services := service "zookeeper" }}{{ with node }}{{ if eq $services.Node .Node.Node }}{{ $services.Address }}{{ end }}{{ end }}{{ end }}
ZOOKEEPER_CONNECT={{ range $i, $services := service "zookeeper" }}{{printf "%s:2181," $services.Address}}{{ end }}
KAFKA_CONNECT={{ range $i, $services := service "zookeeper" }}{{printf "%s:9092," $services.Address}}{{ end }}
sed -r -i "s/(zookeeper.connect)=(.*)/\1=$ZOOKEEPER_CONNECT/g" $KAFKA_HOME/config/server.properties
sed -r -i 's/(zookeeper.connect)=(.*)(.$)/\1=\2''/g' $KAFKA_HOME/config/server.properties
@smuthali
smuthali / myid.sh
Created November 5, 2016 00:46
Generate randon zookeeper myid
#!/bin/bash
echo ${RANDOM} > $1
@smuthali
smuthali / myid.sh
Created November 5, 2016 00:27
Zookeeper myid
#!/bin/bash
echo ${RANDOM} > myid
exit $?
@smuthali
smuthali / myid.tpl
Last active November 9, 2016 01:31
Zookeeper myid template
{{- $myid_counter := key "zk/zkcounter" | parseInt -}}
{{- range $i, $services := service "zookeeper" -}}
{{- with node -}}
{{- if eq $services.Node .Node.Node -}}
{{- $myid_counter | add $i -}}
{{- end -}}
{{- end -}}
{{ end }}
@smuthali
smuthali / zookeeper.hcl
Created November 4, 2016 19:06
Zookeeper
# Zookeeper
job "zookeeper" {
# Specify Region
region = "uswest-fremont"
# Specify Datacenter
datacenters = [ "fremont-dc1"]
# Specify job type
@smuthali
smuthali / myid.tpl
Created November 4, 2016 18:32
Zookeeper myid
{{range $i, $services := service "zookeeper"}}
{{ $i | add 1 }}
{{ end }}
@smuthali
smuthali / zoo.tpl
Last active November 9, 2016 01:35
Zookeeper Consul Template
# 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
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# Zookeeper
job "zookeeper" {
# Specify Region
region = "uswest-fremont"
# Specify Datacenter
datacenters = [ "fremont-dc1"]
# Specify job type
@smuthali
smuthali / gist:dc5d5bdfb2fb330d4005
Created December 4, 2015 22:10
docker build netty
docker build -t "bmcgeneva:netty-1.0.0-SNAPSHOT-151204215529" -f Dockerfile .
Sending build context to Docker daemon 416.5 MB
Sending build context to Docker daemon
Step 0 : FROM bmcgeneva:jdk18-jdk-1.0.0-SNAPSHOT-latest
---> 2cf8d95119ff
Step 1 : RUN mkdir -p /logs/netty; mkdir -p /apps/netty; mkdir -p /apps/netty/ingestor;
---> Using cache
---> e8e23ec0f5d9
Step 2 : COPY pip-pkgs.sh netty-configure.py netty-1.0.0-SNAPSHOT-bundle.tar.gz main.properties /apps/netty/
---> b7614d2e8f3a