代码&优雅着&生活

导航

linux从零搭建Elasticsearch单机版安装02

1.下载elasticsearch 安装包,版本号为:elasticsearch-6.2.4

2.上传到服务器目录/opt/package

  使用rz命令。

3.解压到/opt/soft

  使用tar -zxvf 命令解压。

解压后切换到config目录,修改 vi elasticsearch.yml中

network.host: 0.0.0.0

4.使用root启动,失败,需要创建普通用户

useradd lishang -s /bin/bash
passwd lishang

设置密码后,执行文件夹授权

cd /opt/soft
chown -R lishang:lishang elasticsearch-6.2.4/

5.再次启动

su lishang
cd elasticsearch-6.2.4/bin
./elasticsearch

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3795] for user [lishang] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
依然报错。

切换到root用户,需要设置如下:

修改允许打开的最大文件描述符数量:

vi /etc/security/limits.conf

加入如下:

* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096

修改系统环境变量 vm.max_map_count 和允许打开的最 大文件 描述符数量[1] vm.max_map_count 设置:

vi /etc/sysctl.conf

添加如下配置:
vm.max_map_count=655360

修改配置后重启机器才能生效。

6.第三次重启elasticsearch

切换到普通用户:

su lishang
cd /opt/soft/elasticsearch-6.2.4/bin
./elasticsearch

启动成功。

如果需要后台启动,使用命令如下:

./elasticsearch -d

7.通过浏览器访问

发现访问不了,怀疑是防火墙没有关闭。

查看防火墙状态:

systemctl status firewalld

关闭防护墙:

systemctl stop firewalld

永久关闭防火墙:

systemctl disable firewalld

再次访问,成功。

 

posted on 2020-10-13 11:15  幸运的凌人  阅读(252)  评论(0编辑  收藏  举报