ES安装
1、下载elasticsearch7.6.0
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/targz.html
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.0-linux-x86_64.tar.gz
tar -xzf elasticsearch-7.6.0-linux-x86_64.tar.gz
cd elasticsearch-7.6.2/
./bin/elasticsearch
2、安装ik分词器
https://blog.csdn.net/a159951333/article/details/124302400
unzip -o elasticsearch-analysis-ik-7.6.0.zip -d ik-analyzer
mv ik-analyzer /soft/elasticsearch/plugins/
3、修改配置
vim elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
./bin/elasticsearch
4、常见问题
问题1:无法使用root启动
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
For complete error details, refer to the log at /soft/elasticsearch-7.6.0/logs/elasticsearch.log
解决方法https://blog.csdn.net/ichen820/article/details/122414312
adduser es
passwd es
chown -R es:es elasticsearch-6.8.9/
chmod 770 elasticsearch-6.8.9/
useradd es
su es
问题2:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vim /etc/sysctl.conf 添加vm.max_map_count = 262144 参考https://blog.csdn.net/lsqtzj/article/details/123767421
问题3:the default discovery settings are unsuitable for production use; at least...
vim config/elasticsearch.yml
#添加配置
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
问题4:解决max number of threads [3818] for user [es] is too low, increase to at least [4096]
vim /etc/security/limits.conf
soft nproc 4096
soft nproc 4096
重启后用查看
ulimit -Hu
ulimit -Su
5、测试
POST http://192.168.110.128:9200/_analyze?pretty
User-Agent: Fiddler
Host: 192.168.110.128:9200
Content-Type: application/json
Content-Length: 59
{ "analyzer": "ik_smart", "text": "中国人民共和国" }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix