Linux安装elasticsearch6.4.1

(1)环境说明
服务器环境:CentOS Linux 7

[root@VM-0-3-centos ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

jdk环境:jdk1.8

[root@VM-0-3-centos app]# java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

es版本:6.4.1

[root@VM-0-3-centos elasticsearch]# ll
total 123908
-rw-r--r-- 1 root root 97924081 Oct  9  2019 elasticsearch-6.4.1.tar.gz
-rw-r--r-- 1 root root  4502531 Oct  9  2019 elasticsearch-analysis-ik-6.4.1.zip
-rw-r--r-- 1 root root 24447542 Oct  9  2019 ingest-attachment-6.4.1.zip

资料下载连接
链接:https://pan.baidu.com/s/1Ml8b92zzXf9BgKiXjd-H_A
提取码:9527

(2)安装步骤
1)解压elasticsearch-6.4.1.tar.gz

[root@VM-0-3-centos elasticsearch]# tar -xzvf elasticsearch-6.4.1.tar.gz

2)将插件解压到elasticsearch-6.4.1/plugins目录下

[root@VM-0-3-centos elasticsearch]# unzip -d elasticsearch-6.4.1/plugins/elasticsearch-analysis-ik-6.4.1/ elasticsearch-analysis-ik-6.4.1.zip  
[root@VM-0-3-centos elasticsearch]# unzip -d elasticsearch-6.4.1/plugins/ingest-attachment-6.4.1/ ingest-attachment-6.4.1.zip

[root@VM-0-3-centos elasticsearch]# cd elasticsearch-6.4.1/plugins/
[root@VM-0-3-centos plugins]# ll
total 8
drwxr-xr-x 3 root root 4096 Mar 17 09:34 elasticsearch-analysis-ik-6.4.1
drwxr-xr-x 2 root root 4096 Mar 17 09:34 ingest-attachment-6.4.1

3)修改配置文件elasticsearch-6.4.1/config/elasticsearch.yml

[root@VM-0-3-centos config]# vim elasticsearch.yml

在末尾追加

#自定义配置
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"

4)创建es用户
不能用root用户启动。要创建es用户组和用户,授权elasticsearch-6.4.1目录给es用户

[root@VM-0-3-centos elasticsearch]# groupadd es
[root@VM-0-3-centos elasticsearch]# useradd es -g es -p elasticsearch-6.4.1
[root@VM-0-3-centos elasticsearch]# chown -R es:es elasticsearch-6.4.1
[root@VM-0-3-centos elasticsearch]# ll
total 95636
drwxr-xr-x 8 es   es       4096 Sep 14  2018 elasticsearch-6.4.1

5)切换su用户,启动服务

[root@VM-0-3-centos elasticsearch-6.4.1]# su es
[es@VM-0-3-centos elasticsearch-6.4.1]$ ./bin/elasticsearch

6)启动失败报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]启动失败报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:
使用root用户编辑/etc/security/limits.conf

[root@VM-0-3-centos ~]# vim /etc/security/limits.conf

在后面新增自定义配置

# 自定义配置
* soft nofile 65536
* hard nofile 65536

使用root用户编辑/etc/sysctl.conf

[root@VM-0-3-centos ~]# vim /etc/sysctl.conf

在后面新增自定义配置

# 自定义配置
vm.max_map_count=655360

然后重新加载系统参数

[root@VM-0-3-centos ~]# sysctl -p

7)重新启动

[es@VM-0-3-centos elasticsearch-6.4.1]$ ./bin/elasticsearch

在这里插入图片描述
8)后台方式启动(推荐)

[es@VM-0-3-centos elasticsearch-6.4.1]$ nohup ./bin/elasticsearch&

(3)访问(x.x.x.x:9200)验证成功。
在这里插入图片描述
(4)停掉服务
查看进程

[es@VM-0-3-centos elasticsearch-6.4.1]$ ps aux|grep elasticsearch

杀死进程

[es@VM-0-3-centos elasticsearch-6.4.1]$ kill -9 31723

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: 您可以参考官方文档来安装Elasticsearch:https://www.elastic.co/guide/cn/elasticsearch/reference/current/install-elasticsearch.html。 ### 回答2: 要在Linux安装Elasticsearch,可以按照以下步骤进行: 1. 首先,确保已经安装了Java Runtime Environment(JRE),因为Elasticsearch是用Java编写的。可以通过运行命令`java -version`来验证JRE的安装情况。 2. 接下来,前往Elasticsearch的官方网站(https://www.elastic.co/products/elasticsearch)下载适用于Linux安装包。根据你的系统架构选择下载64位或32位版本。 3. 下载完成后,解压缩压缩包。可以使用命令`tar -xf elasticsearch-x.x.x.tar.gz`来解压缩。这将会创建一个名为elasticsearch-x.x.x的目录。 4. 进入解压后的目录,然后打开config文件夹,编辑elasticsearch.yml文件,根据你的需求进行必要的配置更改,如监听端口、集群名称等。 5. 保存并关闭elasticsearch.yml文件后,你可以启动Elasticsearch。在命令行中切换到elasticsearch-x.x.x目录,然后运行`./bin/elasticsearch`命令。 6. 启动后,Elasticsearch会在后台运行,并通过默认端口9200提供RESTful API接口。可以通过在浏览器中访问`http://localhost:9200`来验证安装成功。 以上就是在Linux安装Elasticsearch的基本步骤。根据具体情况,还可以进行其他配置(如内存限制、集群配置等),以满足特定需求。 ### 回答3: 要在Linux安装Elasticsearch,首先需要确保你的系统满足所需的要求。Elasticsearch需要Java环境,因此请确保你已经安装了Java Development Kit(JDK)。 安装步骤如下: 1. 首先,更新你的系统: sudo apt update 2. 安装JDK: sudo apt install default-jdk 3. 验证JDK的安装: java -version 如果能够打印出Java的版本信息,说明JDK已经正确安装。 4. 下载Elasticsearch: 在Elasticsearch的官方网站上下载最新版本的压缩包,或者通过命令行下载: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.4-linux-x86_64.tar.gz 5. 解压缩文件: tar -xzf elasticsearch-7.13.4-linux-x86_64.tar.gz 6. 进入解压缩后的目录: cd elasticsearch-7.13.4 7. 启动Elasticsearch: ./bin/elasticsearch Elasticsearch将会启动,并在后台运行。 8. 验证Elasticsearch安装: 使用curl命令或者浏览器访问以下URL来验证Elasticsearch是否成功启动: curl -X GET "http://localhost:9200" 如果能够得到类似下面的响应,说明Elasticsearch已经安装并运行正常: { "name" : "your-machine-name", "cluster_name" : "elasticsearch", "cluster_uuid" : "xxxxxx", "version" : { "number" : "7.13.4", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "xxxxxx", "build_date" : "xxxxxx", "build_snapshot" : false, "lucene_version" : "xxxxxx", "minimum_wire_compatibility_version" : "xxxxxx", "minimum_index_compatibility_version" : "xxxxxx" }, "tagline" : "You Know, for Search" } 恭喜!现在你已经成功在Linux安装Elasticsearch。你可以通过编辑配置文件`./config/elasticsearch.yml`来配置Elasticsearch的相关设置。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值