Skip to content

Instantly share code, notes, and snippets.

@frankyaorenjie
Last active October 13, 2017 17:21
Show Gist options
  • Save frankyaorenjie/a11f0ecd56e46277554e8b672e0403ef to your computer and use it in GitHub Desktop.
Save frankyaorenjie/a11f0ecd56e46277554e8b672e0403ef to your computer and use it in GitHub Desktop.
es env
ulimit
vm.max_map_count via sysctl to be at least 262144.
sudo swapoff -a
http.cors.enabled : true
http.cors.allow-origin : "*"
index.number_of_replicas: 0
curl -XPUT 'localhost:9200/_template/logstash_template' -d '
{
"template" : "*",
"settings" : {"number_of_replicas" : 0 , "refresh_interval": "5s"}
} '
sudo mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/[DEVICE_ID]
https://github.com/lmenezes/cerebro
====
123 sudo apt-get update
124 sudo apt-get install gcc make
127 sudo gem install fluentd -v "~> 0.12.0" --no-ri --no-rdoc
136 sudo gem install fluent-plugin-gcloud-pubsub-custom
137 sudo gem install fluent-plugin-elasticsearch
====
resource.type=("aws_ec2_instance" OR "gce_instance" )
#!/bin/bash
user=`whoami`
es_master_ip=$1
if [ "$user" != "root"]
then
echo "MUST run this script with sudo, or in root"
exit
fi
device_id=`lsblk | tail -1 | awk '{print $1}'`
ROOT=/service
hostname=`hostname`
echo "format disk...."
mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/$device_id
uuid=`blkid | grep "$device_id" cut -d'"' -f 2`
mount -o discard,defaults /dev/$device_id $ROOT/elasticsearch/data
chmod a+w $ROOT/elasticsearch/data
cp /etc/fstab /etc/fstab.backup
echo "UUID=$uuid $ROOT/elasticsearch/data ext4 discard,defaults,nofail 0 2" >> /etc/fstab
echo "*\t\tsoft\tnofile\t\t65536" >> /etc/security/limits.conf
echo "*\t\thard\tnofile\t\t65536" >> /etc/security/limits.conf
echo "*\t\tsoft\tmemlock\t\tunlimited" >> /etc/security/limits.conf
echo "*\t\thard\tmemlock\t\tunlimited" >> /etc/security/limits.conf
echo "vm.max_map_count = 262144" >> /etc/sysctl.conf
sysctl -p
swapoff -a
sys_mem=`free -g | grep Mem | awk '{print $2}'`
jvm_mem=`echo "$sys_mem / 2" | bc`
echo "-Xms"$jvm_mem"g" >> $ROOT/elasticsearch/config/jvm.options
echo "-Xmx"$jvm_mem"g" >> $ROOT/elasticsearch/config/jvm.options
sed -i "s/HOSTNAME/$hostname/g" $ROOT/elasticsearch/config/elasticsearch.yml
sed -i "s/ES_MASTER_IP/$es_master_ip/g" $ROOT/elasticsearch/config/elasticsearch.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment