安装教程
常见问题
1. 启动 elasticsearch
异常 Failed to create node environment(解决)
chmod 777 挂载目录路径
2. elasticsearch
配置外网访问
# 进入 config/ elasticsearch.ym
# 修改:network.host: 127.0.0.1 或者内网Ip
http.host: 0.0.0.0
3. elasticsearch
启动报错,bootstrap checks failed
修改 elasticsearch.yml 配置文件,允许外网访问。增加 network.host: 0.0.0.0 , 后启动失败,检查没有通过,报错如下:
[2018-05-18T17:44:59,658][INFO ][o.e.b.BootstrapChecks ] [gFOuNlS] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
a. max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]<br /> 编辑 `/etc/security/limits.conf`,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效
b. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]<br /> 编辑 `/etc/sysctl.conf`,追加以下内容:
vm.max_map_count=655360
保存后,执行:
sysctl -p
4. 后台启动
./elasearch -d
5. 安装中文分词器 IKAnalyzer
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.0/elasticsearch-analysis-ik-6.4.0.zip
6. Kibana server is not ready yet 出现的原因
a. KB、ES版本不一致,把KB和ES版本调整为统一版本。
b. `kibana.yml` 中配置有问题
将配置文件kibana.yml
中的elasticsearch.url
改为正确的链接,默认为: http://elasticsearch:9200,改为http://自己的IP地址:9200
c. 浏览器没有缓过来,刷新几次浏览器。
7. elasticsearch
进行分词测试
https://blog.csdn.net/yexiaomodemo/article/details/97933870
POST http://IP地址:9200/_analyze
Content-Type: application/json
{
"analyzer":"ik_max_word",
"text":"今天天气真好"
}
返回成功结果
{
"tokens": [
{
"token": "今天天气",
"start_offset": 0,
"end_offset": 4,
"type": "CN_WORD",
"position": 0
},
{
"token": "今天",
"start_offset": 0,
"end_offset": 2,
"type": "CN_WORD",
"position": 1
},
{
"token": "天天",
"start_offset": 1,
"end_offset": 3,
"type": "CN_WORD",
"position": 2
},
{
"token": "天气",
"start_offset": 2,
"end_offset": 4,
"type": "CN_WORD",
"position": 3
},
{
"token": "真好",
"start_offset": 4,
"end_offset": 6,
"type": "CN_WORD",
"position": 4
}
]
}