Centos7安装Elasticsearch7.1.0

目录

一:下载Linux版本的Elasticsearch

 二:上传服务器,并解压

三:创建ES用户,并赋予权限

四:启动 Elasticsearch

五:常见错误以及解决方式


一:下载Linux版本的Elasticsearch

1:最新版的下载地址:Download Elasticsearch | Elasticicon-default.png?t=M1L8https://www.elastic.co/cn/downloads/elasticsearch

2:Elasticsearch7.1.0版的下载地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0-linux-x86_64.tar.gzicon-default.png?t=M1L8https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0-linux-x86_64.tar.gz

 3:Elasticsearch 历史版本下载地址:Past Releases of Elastic Stack Software | Elasticicon-default.png?t=M1L8https://www.elastic.co/cn/downloads/past-releases#elasticsearch

 二:上传服务器,并解压

 tar -zxvf elasticsearch-7.1.0-linux-x86_64.tar.gz

三:创建ES用户,并赋予权限

        1.创建一个esroot用户并设置初始密码

useradd -c 'ES user' -d /home/esroot esroot

passwd esroot

        2.将elasticsearch安装目录属主权限改为 esroot 用户

chown -R esroot:esroot /opt/elasticsearch-7.1.0/

groupadd elasticsearch

        3.切换用户到 esroot 

su esroot

 

四:启动 Elasticsearch

        进入Elasticsearch 的bin 目录

cd /opt/elasticsearch-7.1.0/bin/

         启动

#当前进程启动

./elasticsearch

#后台进程启动

./elasticsearch -d

五:常见错误以及解决方式

1:elasticsearch 已经正常启动了,浏览器访问localhost:9200,无法出现版本信息?

1:首先查看一下服务器对应的端口9200 9300 是否被防火墙拦截了

2:如果是阿里云的服务器,安全组是否设置了允许9200,9300端口的请求

3:在elasticsearchconfig目录下,修改elasticsearch.yml配置文件

node.name: node-1

network.host: 0.0.0.0

cluster.initial_master_nodes: ["node-1"]

2:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]?(注意:切换到root用户,否则提示没有权限

 1:打开 /etc/sysctl.conf 文件最后添加一行 vm.max_map_count=262144

 2:执行 /sbin/sysctl -p 立即生效

 3:重启启动 elasticsearch

3:the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

1:在elasticsearchconfig目录下,修改elasticsearch.yml配置文件

2:cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值