第四篇:Elaticsearch 安裝配置

Elasticsearch 是一個分佈式搜索引擎,類似產品還有solr-cloud 。Elasticsearch 相對於solr 而言,隨着容量的變化,效率會比solr高,特色就是速度快。ES使用者衆多,如:StackOverflow、github、維基百科等。java

Elasticsearch 至少須要在java1.8 平臺,官方建議使用 oracle jdk 1.8.0_131版本。node

 

1、下載安裝elasticsearch:git

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.1.tar.gz -O /opt/elasticsearch-5.6.1.tar.gz 
tar xf /opt/elasticsearch-5.6.1.tar.gz -C /usr/local
vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml #編輯elastic配置文件修改爲以下內容
cluster.name:    logging-cpy                    #集羣名稱
node.name: cpy04.dev.xjh.com            #es節點ID
path.data: /usr/local/elasticsearch-5.6.1/data    #es數據存放路徑
path.logs: /usr/local/elasticsearch-5.6.1/logs    #es 日誌存放路徑
bootstrap.memory_lock: true                        #禁用內存交換功能,防止性能瓶頸
network.host: 192.168.12.164            #集羣通訊節點地址,默認使用迴環地址
http.port: 9200                   #es 端口
discovery.zen.ping.unicast.hosts: ["192.168.12.164"]    #將同一集羣節點所有添加到列表中,會按期掃描急羣衆服務器的9300和9405端口,作健康檢查
discovery.zen.minimum_master_nodes: 1                #防止腦裂,計算公式爲"主節點個數/2 + 1" ,例如單點就是1 ,好比3個就是(3/2+1)=2

  

2、 配置系統內存鎖定(因爲es 配置文件中配置了內存鎖定,若是系統不鎖定會報:memory locking requested for elasticsearch process but memory is not locked)github

vim /etc/security/limits.conf #添加以下內容
* soft memlock unlimited
* hard memlock unlimited

3、配置可建立最大文件(解決:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536])bootstrap

vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536

4、配置可建立線程數(解決:max number of threads [1024] for user [elastic] is too low, increase to at least [2048])vim

vim /etc/security/limits.d/90-nproc.conf 
#*          soft    nproc     1024  #註釋這行改成2048
*          soft    nproc     2048
root       soft    nproc     unlimited

5、修改最大虛擬內存大小(解決:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144])centos

vim /etc/sysctl.conf #添加以下內容
# max virtual memory size
vm.max_map_count=633360
保存退出後使用:sysctl -p 命令生效sysctl.conf 配置

6、解決centos6.x 不支持SecComp,ES5.2 後的版本默認使用 bootstrap.system_call_filter 檢測,若是不經過則終止ES 進程,因此將該項改成falsebash

vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml 
bootstrap.system_call_filter: false

7、 添加啓動elasticsearch 用戶(es 默認不能使用root 用戶啓動)服務器

groupadd elastic
useradd elastic -g elastic

8、啓動elasticsearchoracle

su - elastic
/usr/local/elasticsearch-5.6.1/bin/elasticsearch -d
相關文章
相關標籤/搜索