CentOS 7.8 安装 Elasticsearch 6.8.17
安装环境
1[root@localhost ~]# cat /etc/redhat-release
2CentOS Linux release 7.8.2003 (Core)
检查Java版本
Elasticsearch 要求 Java 8 或以上版本。
1[root@localhost ~]# java -version
2java version "1.8.0_202"
3Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
4Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
5[root@localhost ~]#
新建用户
默认情况下,Elasticsearch 不允许使用 root 用户启动。
1groupadd esgroup
2useradd esapp -g esgroup
修改资源配置
1vi /etc/security/limits.conf
2# 在文件中添加下面内容
3esapp soft nofile 65535
4esapp hard nofile 65535
修改后,需要打开新的终端使之生效。
下载压缩包
1cd /opt
2wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.17.tar.gz
3wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.17.tar.gz.sha512
4shasum -a 512 -c elasticsearch-6.8.17.tar.gz.sha512
解压并修改属主
1tar -xzf elasticsearch-6.8.17.tar.gz
2chown -R esapp: elasticsearch-6.8.17
修改配置文件
1# 切换到之前创建的普通用户
2su - esapp
3cd /opt/elasticsearch-6.8.17/config
4cp elasticsearch.yml elasticsearch.yml.bak
5vi elasticsearch.yml
将 network.host: 192.168.0.1
改为 network.host: 0.0.0.0
并取消注释。以便外部浏览器可以访问。
启动
1# 依然使用普通用户
2cd /opt/elasticsearch-6.8.17/bin
3# 启动
4./elasticsearch
检查是否启动成功
打开新的终端,输入下面的命令。
1[root@localhost ~]# curl -X GET "localhost:9200/?pretty"
2{
3 "name" : "h1TMR1i",
4 "cluster_name" : "elasticsearch",
5 "cluster_uuid" : "bFtHxxq0RzuWVx0xkW_Z0g",
6 "version" : {
7 "number" : "6.8.17",
8 "build_flavor" : "default",
9 "build_type" : "tar",
10 "build_hash" : "206f6a2",
11 "build_date" : "2021-07-01T18:51:20.391869Z",
12 "build_snapshot" : false,
13 "lucene_version" : "7.7.3",
14 "minimum_wire_compatibility_version" : "5.6.0",
15 "minimum_index_compatibility_version" : "5.0.0"
16 },
17 "tagline" : "You Know, for Search"
18}
19[root@localhost ~]#
在非本地浏览器中访问http://ES所在机器的IP:9200/
,正常的话同样也可以得到上面的信息。
相关资料