下载
https://www.elastic.co/products/elasticsearch
https://github.com/elastic/elasticsearch
运行
执行bin文件夹中的elasticsearch.bat ,查看 http://localhost:9200
安装ik中文分词器
https://github.com/medcl/elasticsearch-analysis-ik/releases
- 选择和已经下载的elasticsearch版本兼容的ik。
- 解压后复制elasticsearch/plugins/ik(ik文件夹新创建)目录下
- 重新运行elasticsearch.bat
- ik:http://localhost:9200/_cat/plugins
单节点部署,外网访问
修改elasticsearch.yml文件,设置network.host: 0.0.0.0,并添加discovery.type: single-node。
集群elasticsearch.yml
相关配置如下
1 | ---------------------------------- Cluster ----------------------------------- |
查看集群状态
http://192.168.85.141:9200/_cat/health?v 查看集群的健康状态
http://192.168.85.141:9200/_cat/indices?v 查看集群的索引数
http://192.168.85.141:9200/_cat/allocation?v 查看集群所在磁盘的分配状况
http://192.168.85.141:9200/_cat/nodes?v 查看集群的节点
http://192.168.85.141:9200/_cat 查看集群信息目录(包含上面的)
v 表示带title
启动过程报错
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
添加配置 /etc/sysctl.conf (永久性修改)
1 | # elasticsearch config start |
sysctl -p
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
添加配置 /etc/security/limits.conf (永久性修改)
1 | # elasticsearch config start |
其中
*
号不能省略,不需要重启
elasticsearch-env: line 122: syntax error near unexpected token `<’
解决方法是修改elasticsearch-env文件的第122行:
done < <(env)
【<改成三连,括号改成单引号】
done <<<’env’