Skip to content

Instantly share code, notes, and snippets.

@drewr
drewr / damjan.sh
Last active August 29, 2015 14:02
Bool filter with whitespace analyzer
curl -s -XDELETE localhost:9200/damjan >/dev/null
curl -s -XPUT localhost:9200/damjan -d'---
settings:
index.number_of_shards: 1
index.number_of_replicas: 0
mappings:
t:
properties:
appname:
{
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::snaps.example.com"
]

First node (24 cores):

sudo sh -c "ulimit -n 1000000; setuidgid $USER env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ES_HEAP_SIZE=2g bin/elasticsearch -Des.network.bind_host=0.0.0.0 -Des.network.publish_host=_eth0:ipv4_ -Des.discovery.zen.ping.unicast.hosts=bigstep003 -Des.discovery.zen.ping.multicast.enabled=false -Des.cluster.name=drewr -Des.logger.level=DEBUG"

Second node (8 cores):

sudo sh -c "ulimit -n 1000000; setuidgid $USER env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ES_HEAP_SIZE=2g bin/elasticsearch -Des.network.bind_host=0.0.0.0 -Des.network.publish_host=_eth3:ipv4_ -Des.discovery.zen.ping.unicast.hosts=bigstep001 -Des.discovery.zen.ping.multicast.enabled=false -Des.cluster.name=drewr -Des.logger.level=DEBUG"

Logstash running on the first node:

@drewr
drewr / twitter-mapping.json
Created April 8, 2014 15:32
Sample twitter settings
{
"twitter": {
"mappings": {
"status": {
"_all": {
"enabled": false
},
"_size": {
"enabled": true,
"store": true
@drewr
drewr / tribe-localhost-unicast.md
Last active August 29, 2015 13:57
Three-node tribe using localhost/unicast.

Three-node dev tribe on a single host

Setup

drewr1

% bin/elasticsearch \
    -Des.cluster.name=drewr1 \
    -Des.network.host=127.0.0.1 \

-Des.discovery.zen.ping.unicast.hosts=127.0.0.1 \

@drewr
drewr / run-centos.sh
Created December 10, 2013 05:25
Run Elasticsearch foregrounded on CentOS without any external daemontools or runit bins.
#!/bin/sh
ulimit -l unlimited
ulimit -n unlimited
CLUSTER=amex
NODE=node01
export ES_HEAP_SIZE=24g
#!/bin/sh
curl -XDELETE localhost:9200/foo >/dev/null
curl -XPUT localhost:9200/foo/t/1\?routing=one -d'{"fizzle":[1,2]}'; echo
curl -XPUT localhost:9200/foo/t/2\?routing=two -d'{"fazzle":[3223,23]}'; echo
curl -XPOST localhost:9200/foo/_refresh; echo
curl localhost:9200/foo/_search -d'
@drewr
drewr / results.txt
Last active December 28, 2015 10:59
Jepsen on ES
Run will take 10 seconds
0 :ok 208 ▌
1 :ok 224 ▌
2 :ok 108 ▎
3 :ok 98 ▎
4 :ok 96 ▎
5 :ok 62 ▏
6 :ok 62 ▏
7 :ok 45 ▏
8 :ok 45 ▏
while true; do
curl https://play.google.com/store/devices -L -s --compressed \
| fgrep -q -o "Nexus 5" && say -v Fred Nexus 5 launched\!
sleep 60
done
@drewr
drewr / import-bulks
Last active December 26, 2015 23:59
Simple bulk-indexing
#!/bin/sh
index=$1
find . -name \*.bulk.gz | while read i; do
gzip -cd $i | curl -XPOST localhost:9200/${index}/_bulk -d@- >/dev/null
done