Elasticsearch
搜索引擎解決方案 版本 elasticsearch 5.6
Author : Janloong Do_O
配置
elasticsearch.in.sh
export JAVA_HOME=/usr/local/jdk8
export JRE_HOME=/usr/local/jdk8/jre
root用戶運行
ES_JAVA_OPTS="-Des.insecure.allow.root=true"
錯誤1
如果這時報錯"max virtual memory areas vm.maxmapcount [65530] is too low",運行
當前生效
$ sudo sysctl -w vm.max_map_count=262144
修改文件/etc/sysctl.conf
vm.max_map_count= 262144
執行命令
sysctl -p
錯誤2
max file descriptors [65535] forelasticsearch process likely too low, increase to at least [65536]
/etc/security/limits.conf,末尾增加如下內容
soft nofile 65536
hard nofile 65536
max virtual memory
或
* - nofile65536
* - memlock unlimited
需要重啓
接觸ip綁定限制 config/elasticsearch.yml
network.host: 0.0.0.0
基礎命令
查看當前節點的所有index
$ curl -X GET 'http://localhost:9200/_cat/indices?v'
新增index
$ curl -X PUT 'localhost:9200/weather'
刪除一個index
$ curl -X DELETE 'localhost:9200/weather'
安裝xpack後修改密碼
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -d '{
"password" : "elastic"
}'
插件
中文分詞器
$ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.3/elasticsearch-analysis-ik-5.6.3.zip
日誌查看插件
./bin/elasticsearch-plugin install mobz/elasticsearch-head
參考: