ElasticSearch部署文檔(Ubuntu 14.04)html
安裝javajava
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer sudo apt-get install oracle-java8-set-default
安裝ElasticSearchnode
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - echo "deb http://packages.elastic.co/elasticsearch/1.6/debian stable main" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get install elasticsearch sudo update-rc.d elasticsearch defaults 95 10
ElasticSearch各個目錄說明git
type | description | location |
---|---|---|
home | Home of elasticsearch installation | /usr/share/elasticsearch |
bin | Binary scripts including elasticsearch to start a node | /usr/share/elasticsearch/bin |
conf | Configuration files elasticsearch.yml and logging.yml | /etc/elasticsearch |
conf | Environment variables including heap size,file descriptors | /etc/default/elasticsearch |
data | The location of the data files | /var/lib/elasticsearch/ |
logs | Log files location | /var/log/elasticsearch |
plugins | Plugin files location | /usr/share/elasticsearch/plugins |
配置github
ES_HEAP_SIZEweb
# 在/etc/default/elasticsearch中修改: ES_HEAP_SIZE=4g #不要超過32g,若是整臺機器只部署ES,一半內存用於Java heap,另外一半給Lucene
File Descriptorsbootstrap
cat <<EOF>> /etc/security/limits.conf elasticsearch - nofile 65535 EOF # 在/etc/default/elasticsearch中修改: MAX_OPEN_FILES=65535
Virtual memoryoracle
cat <<EOF>> /etc/sysctl.conf vm.max_map_count=262144 EOF sysctl -p
Memory Settingscurl
# 在/etc/elasticsearch/elasticsearch.yml中修改: bootstrap.mlockall: true # 在/etc/default/elasticsearch中修改: MAX_LOCKED_MEMORY=unlimited
其餘elasticsearch
在/etc/elasticsearch/elasticsearch.yml中修改: # 集羣名稱,同一集羣,名稱要設置相同 cluster.name: elasticsearch_production # 節點名稱 node.name: elasticsearch_001_data # 數據路徑,可配置多個,英文逗號分開,注意目錄的權限,保證elasticsearch用戶可寫 path.data: /path/to/data1,/path/to/data2 # 日誌路徑,注意目錄的權限,保證elasticsearch用戶可寫 path.logs: /path/to/logs # 插件路徑 path.plugins: /path/to/plugins # 該屬性是爲了造成一個集羣,有主節點資格並互相鏈接的節點的最小數目 # (number of master-eligible nodes / 2) + 1。 下面的值是在3個有主節點資格的狀況下設定 # 由於節點數,之後能夠增長,或者減小,故該配置能夠動態修改 discovery.zen.minimum_master_nodes: 2 # 恢復控制 gateway.recover_after_nodes: 2 gateway.expected_nodes: 3 gateway.recover_after_time: 5m #關閉多播,用單播。並指定至少一個能接受單播的主機 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["192.168.2.1:9300", "192.168.2.2:9300", "192.168.2.3:9300"]
sudo /etc/init.d/elasticsearch start # 驗證上面一些配置是否配置成功 curl localhost:9200/_nodes/process?pretty
參考連接