Elasticsearch

一:安装JDK

yum install -y java

检测是否安装成功,java -version

二:下载和安装Elasticsearch

先选择好要下载到的文件夹

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpm

使用rpm命令安装软件
rpm -ivh elasticsearch-5.5.0.rpm

使用service命令启动elasticsearch服务
service elasticsearch start

测试elasticsearch服务
curl localhost:9200

在我们输入 curl localhost:9200 后发现报错了,我们再看看9200端口有没有被监听(9200是elasticsearch的默认端口)

 

 端口没有被监听,说明elasticsearch的服务没有启动成功

输入service elasticsearch status后发现有错误,错误解决在后面附录

测试成功是这样的

 

如果想要外网能访问elasticsearch,就要修改配置。

将 /etc/elasticsearch/elasticsearch.yml中的 #network.host: 192.168.0.1 修改成 network.host: 0.0.0.0,重启 elasticsearch

这里有一个坑:network.host: 0.0.0.0 的冒号后面要有一个空格,这里我被坑了很长时间

上面的就算是安装好了 

其他elasticsearch命令:
1.查找ES进程
ps -ef | grep elastic
2.杀掉ES进程
kill -9 2382(进程号)

三.安装中文分词

安装中文分词插件ik (安装完需要重启es)

先查找 elasticsearch-plugin 文件的路径 
find / -name elasticsearch-plugin
再执行(/xxx/xxx/elasticsearch-plugin替换成你自己的路径)
/xxx/xxx/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip

四.安装 elasticsearch-php

如果要在php中使用再接着安装elasticsearch-php

composer require elasticsearch/elasticsearch

会自动加载合适的版本!我的php是5.6的,它会自动加载5.3的elasticsearch版本!

五.elasticsearch-php的使用

查看另一篇博客:https://blog.csdn.net/dabao87/article/details/106803523

附录:

错误1:

Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory,内存不足


解决:
修改jvm.options文件中关于内存的配置(根据服务器实际内存大小调整)
-Xms256m
-Xmx256m

 

错误2:
OpenJDK 64-Bit Server VM warning:If the number of processors is expected to increase from one,then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCTheads=Need矩阵的内容是怎样的

解决办法:添加配置
-XX:-AssumeMP 到jvm.options

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值