ericjarvies
12/12/2016 - 5:28 AM

elasticsearch

elasticsearch

Ubuntu;

download;

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.deb

install;

sudo dpkg -i elasticsearch-5.1.1.deb

Ubuntu via APT;

# 5x
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-5.x.list
sudo apt-get update && sudo apt-get install elasticsearch
# 2x
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
sudo apt-get update
sudo apt-get -y install elasticsearch
nano /etc/ssh/sshd_config
ps -p 1

(init - older Ubuntu versions)
sudo update-rc.d elasticsearch defaults 95 10
sudo -i service elasticsearch start
sudo -i service elasticsearch stop

(systemd - newer Ubuntu versions)
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service
su elasticsearch
nano elasticsearch/config/jvm.options
export ES_HEAP_SIZE=1G; /usr/local/bin/elasticsearch/bin/elasticsearch -d
export MAX_OPEN_FILES=65535; /usr/local/bin/elasticsearch/bin/elasticsearch -d
export MAX_LOCKED_MEMORY=unlimited; /usr/local/bin/elasticsearch/bin/elasticsearch -d
ps aux | grep elasticsearch
ulimit -l unlimited     # sudo su  (must be root)

sudo sysctl -w vm.max_map_count=262144
echo 262144 | sudo tee /proc/sys/vm/max_map_count

sudo sysctl -w fs.file-max=65536
echo 65536 | sudo tee nano /proc/sys/fs/file-max

sudo nano /etc/security/limits.conf
*       soft  nofile  70000
*       hard  nofile  70000
root    soft  nofile  70000
root    hard  nofile  70000
sudo su
ulimit -n
ulimit -Hn
ulimit -Sn

OS X;

brew install elasticsearch && brew info elasticsearch
brew tap homebrew/services

to have launchd start elasticsearch now and restart at login;

brew services start elasticsearch

if background startup service not needed, just run;

elasticsearch

to stop service;

brew services stop elasticsearch

start with;

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist

to add plugin (first cd to plugin directory);

elasticsearch-plugin install pluginname

to remove plugin (first cd to plugin directory);

elasticsearch-plugin remove pluginname

edit elasticsearch configuration;

sudo nano /usr/local/etc/elasticsearch/elasticsearch.yml

need to figure these out;

bin/elasticsearch -Des.node.data=false -Des.node.master=true -Des.node.name=pdb0
bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=sfo
bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=tor