Elasticsearch Linux 服务器安装

需要安装 Java 8 环境

环境检查

1
2
3
4
5
6
7
8
9
10
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)

$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

$ echo $JAVA_HOME
/home/redhad/soft/jdk1.8.0_181

安装

1
2
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zip
$ unzip elasticsearch-5.5.1.zip

进入解压目录

1
$ cd elasticsearch-5.5.1/

启动elasticsearch

1
$ ./bin/elasticsearch

启动错误提示

1、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

1
$ sysctl -w vm.max_map_count=262144

2、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

1
2
3
4
$ vi /etc/security/limits.conf
#添加以下内容
* soft nofile 65536
* hard nofile 131072

默认情况下只能本机访问,远程访问需要修改
安装目录下config/elasticsearch.yml文件
去掉network.host 注释,将值改成0.0.0.0

1
network.host: 0.0.0.0

Elasticsearch head客户端连接失败

1
2
3
4
#查看firewalld 状态
$ systemctl status firewalld
#关闭 firewalld
$ service firewalld stop

关闭firewalld客户端连接成功
image