北大青鸟小游网:值得大家信赖的游戏下载站!

微信:96kaifa
关注我们
所在位置:首页 > 服务器 > centos7上elastic search安装的示例分析

centos7上elastic search安装的示例分析

发布时间:2021-06-16 10:45:50来源:北大青鸟手游网作者:北大青鸟手游网

O
O
  • 游戏类别:角色扮演
  • 游戏大小:
  • 游戏语言:
  • 游戏版本:
点击查看
扫码查看

小编给大家分享一下centos7上elastic search安装的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

本文介绍了centos7上elastic search安装及填坑记,分享给大家,具体如下:

下载elastic search 5.3.0

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.tar.gz
mv elasticsearch-5.3.0.tar.gz /opt
cd /opt
tar -xzvf elasticsearch-5.3.0.tar.gz
cd elasticsearch-5.3.0/

启动ES

cd /bin
./elasticsearch

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

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

centos7上elastic search安装的示例分析

error='Cannot allocate memory'

solutions:

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

vim config/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

groupadd elk # 创建用户组elkuseradd elk -g elk -p 111111 # 创建新用户elk,-g elk 设置其用户组为 elk,-p 111 设置其密码6个1chown -R elk:elk /opt # 更改 /opt 文件夹及内部文件的所属用户及组为 elk:elksu elk # 切换到非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* soft nofile 300000* hard nofile 300000* soft nproc 102400* soft memlock unlimited* hard memlock unlimited

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 -w vm.max_map_count=262144

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

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

centos7上elastic search安装的示例分析


我要评价

  • 热门资讯
  • 最新资讯
  • 手游排行榜
  • 手游新品榜