安装教程

安装教程

常见问题

1. 启动 elasticsearch 异常 Failed to create node environment(解决)
  1. chmod 777 挂载目录路径

2. elasticsearch 配置外网访问
  1. # 进入 config/ elasticsearch.ym
  2. # 修改:network.host: 127.0.0.1 或者内网Ip
  3. http.host: 0.0.0.0

3. elasticsearch 启动报错,bootstrap checks failed

修改 elasticsearch.yml 配置文件,允许外网访问。增加 network.host: 0.0.0.0 , 后启动失败,检查没有通过,报错如下:

  1. [2018-05-18T17:44:59,658][INFO ][o.e.b.BootstrapChecks ] [gFOuNlS] bound or publishing to a non-loopback address, enforcing bootstrap checks
  2. ERROR: [2] bootstrap checks failed
  3. [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
  4. [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  1. a. max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]<br /> 编辑 `/etc/security/limits.conf`,追加以下内容;
  1. * soft nofile 65536
  2. * hard nofile 65536
  1. 此文件修改后需要重新登录用户,才会生效
  2. b. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]<br /> 编辑 `/etc/sysctl.conf`,追加以下内容:
  1. vm.max_map_count=655360

保存后,执行:

  1. sysctl -p

4. 后台启动
  1. ./elasearch -d

5. 安装中文分词器 IKAnalyzer
  1. ./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 出现的原因
  1. a. KBES版本不一致,把KBES版本调整为统一版本。
  2. b. `kibana.yml` 中配置有问题

将配置文件kibana.yml中的elasticsearch.url改为正确的链接,默认为: http://elasticsearch:9200,改为http://自己的IP地址:9200

  1. c. 浏览器没有缓过来,刷新几次浏览器。

7. elasticsearch 进行分词测试

https://blog.csdn.net/yexiaomodemo/article/details/97933870

  1. POST http://IP地址:9200/_analyze
  2. Content-Type: application/json
  3. {
  4. "analyzer":"ik_max_word",
  5. "text":"今天天气真好"
  6. }

返回成功结果

  1. {
  2. "tokens": [
  3. {
  4. "token": "今天天气",
  5. "start_offset": 0,
  6. "end_offset": 4,
  7. "type": "CN_WORD",
  8. "position": 0
  9. },
  10. {
  11. "token": "今天",
  12. "start_offset": 0,
  13. "end_offset": 2,
  14. "type": "CN_WORD",
  15. "position": 1
  16. },
  17. {
  18. "token": "天天",
  19. "start_offset": 1,
  20. "end_offset": 3,
  21. "type": "CN_WORD",
  22. "position": 2
  23. },
  24. {
  25. "token": "天气",
  26. "start_offset": 2,
  27. "end_offset": 4,
  28. "type": "CN_WORD",
  29. "position": 3
  30. },
  31. {
  32. "token": "真好",
  33. "start_offset": 4,
  34. "end_offset": 6,
  35. "type": "CN_WORD",
  36. "position": 4
  37. }
  38. ]
  39. }