一、下載elasticsearch-5.2.0.rpmjava
rpm -i 安裝node
安裝後各個目錄說明git
#/usr/share/elasticsearch/ 主目錄
#/var/log/elasticsearch log日誌github
#/etc/sysconfig/elasticsearch 配置elasticsearch環境變量
#/etc/elasticsearch/elasticsearch.yml 配置elasticsearch集羣
#/etc/elasticsearch/jvm.options 配置elasticsearch的jvm參數
#/etc/elasticsearch/log4j2.properties 配置elasticsearch日誌參數npm
elasticsearch啓動命令
sudo -i service elasticsearch start
sudo -i service elasticsearch stopbootstrap
啓動報錯1vim
es5.2沒法啓動bug
報錯:
ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
緣由:
這是在由於Centos6不支持SecComp,而ES5.2.0默認bootstrap.system_call_filter爲true進行檢測,因此致使檢測失敗,失敗後直接致使ES不能啓動。
解決:
在elasticsearch.yml中配置bootstrap.system_call_filter爲false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
能夠查看issues
https://github.com/elastic/elasticsearch/issues/22899app
啓動報錯2curl
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max number of threads [1024] for user [Hadoop] is too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]jvm
編輯limits.conf 文件
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
vim /etc/security/limits.d/90-nproc.conf
找到以下內容:
soft nproc 1024
修改成
soft nproc 2048
vi /etc/sysctl.conf
添加下面配置:vm.max_map_count=655360
並執行命令:sysctl -p
啓動報錯3
報找不到JAVA_HOME
找到#/etc/sysconfig/elasticsearch文件 配置elasticsearch環境變量 ,增長# Elasticsearch Java path
JAVA_HOME
# Elasticsearch Java path
JAVA_HOME=/usr/local/java/
二、安裝ik
Git網址
https://github.com/medcl/elasticsearch-analysis-ik
1)下載
checkout ik version respective to your elasticsearch version
git checkout tags/{version}
2)編譯,須要maven
mvn package
3)
copy and unzip target/releases/elasticsearch-analysis-ik-{version}.zip
to your-es-root/plugins/ik
4)restart elasticsearch
5)測試分詞例子
curl -XPUT http://101.201.115.106:9201/index
curl -XPOST http://101.201.115.106:9201/index/fulltext/_mapping -d'
{
"fulltext": {
"_all": {
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"term_vector": "no",
"store": "false"
},
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"include_in_all": "true",
"boost": 8
}
}
}
}'
curl -XPOST http://101.201.115.106:9201/index/fulltext/1 -d'
{"content":"美國留給伊拉克的是個爛攤子嗎"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/2 -d'
{"content":"公安部:各地校車將享最高路權"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/3 -d'
{"content":"中韓漁警衝突調查:韓警平均天天扣1艘中國漁船"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/4 -d'
{"content":"中國駐洛杉磯領事館遭亞裔男子槍擊 嫌犯已自首"}'
curl -XPOST http://101.201.115.106:9201/index/fulltext/_search -d'
{
"query" : { "match" : { "content" : "中國" }},
"highlight" : {
"pre_tags" : ["<tag1>", "<tag2>"],
"post_tags" : ["</tag1>", "</tag2>"],
"fields" : {
"content" : {}
}
}
}
'三、安裝head,這個比較麻煩,須要安裝nodejs,npm,不像以前2.1版本,直接copy到plugin。
請參考http://hnr520.blog.51cto.com/4484939/1867033