centos7上elastic search安装问题怎么解决(centos7,elastic,search,编程语言)

时间:2024-04-28 17:36:03 作者 : 石家庄SEO 分类 : 编程语言
  • TAG :

下载elastic search 5.3.0

wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.tar.gzmvelasticsearch-5.3.0.tar.gz/optcd/opttar-xzvfelasticsearch-5.3.0.tar.gzcdelasticsearch-5.3.0/

启动es

cd/bin./elasticsearch

按照道理应该就可以了,然而接下来各种坑一一出现,分别阐述

错误1:error='cannot allocate memory' (errno=12)

centos7上elastic search安装问题怎么解决

error='cannot allocate memory'

solutions:

由于elasticsearch5.0默认分配jvm空间大小为2g,需要改小一点

vimconfig/jvm.options-xms2g→-xms512m-xmx2g→-xmx512m

错误2:can not run elasticsearch as root

centos7上elastic search安装问题怎么解决

can not run elasticsearch as root

solutions:

在 linux 环境中,elasticsearch 不允许以 root 权限来运行!所以需要创建一个非root用户,以非root用户来起es

groupaddelk#创建用户组elkuseraddelk-gelk-p111111#创建新用户elk,-gelk设置其用户组为elk,-p111设置其密码6个1chown-relk:elk/opt#更改/opt文件夹及内部文件的所属用户及组为elk:elksuelk#切换到非root用户elk下来

错误3:(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]
此错误出现在修改config/elasticsearch.yml中的network.host为network.host: 0.0.0.0以便让外网任何ip都能来访问时。

solutions:

切换到root用户,然后

vim/etc/security/limits.conf*softnofile300000*hardnofile300000*softnproc102400*softmemlockunlimited*hardmemlockunlimited

centos7上elastic search安装问题怎么解决

/etc/security/limits.conf

错误4:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

centos7上elastic search安装问题怎么解决

vm.max_map_count is too low

solutions:

先要切换到root用户;

然后可以执行以下命令,设置 vm.max_map_count ,但是重启后又会恢复为原值。

sysctl-wvm.max_map_count=262144

持久性的做法是在 /etc/sysctl.conf 文件中修改 vm.max_map_count 参数:

echo"vm.max_map_count=262144">/etc/sysctl.confsysctl-p

centos7上elastic search安装问题怎么解决

最后终于在外网访问成功:

centos7上elastic search安装问题怎么解决

外网访问成功!

安装可视化插件 elasticsearch-head

gitclonegit://github.com/mobz/elasticsearch-head.gitcdelasticsearch-headnpminstall#此处我试图用cnpminstall有问题,用npm可以npmrunstart

centos7上elastic search安装问题怎么解决

然后在外网访问http://你的安装机ip:9100

centos7上elastic search安装问题怎么解决

访问elasticsearch-head可视化界面成功

最后实际简单测试一下

新建 index,可以直接向 elastic 服务器发出 put 请求。下面的例子是新建一个名叫weather的 index。

centos7上elastic search安装问题怎么解决

用rest接口向es添加index

然而刷新elasticsearch-head可视化界面可以看到索引已经成功插入

centos7上elastic search安装问题怎么解决

索引已经插入

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:centos7上elastic search安装问题怎么解决的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:Web服务器Tengine在CentOS下怎么安装下一篇:

10 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18