Centos7.4下安装ElasticSearch

Posted wintersweet321

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7.4下安装ElasticSearch相关的知识,希望对你有一定的参考价值。

以下英文内容来自Elastic官网

Set up Elasticsearch

 

This section includes information on how to setup Elasticsearch and get it running, including:

  • Downloading
  • Installing
  • Starting
  • Configuring

Supported platforms

The matrix of officially supported operating systems and JVMs is available here: Support Matrix. Elasticsearch is tested on the listed platforms, but it is possible that it will work on other platforms too.

Java (JVM) Version

Elasticsearch is built using Java, and includes a bundled version of OpenJDK from the JDK maintainers (GPLv2+CE) within each distribution. The bundled JVM is the recommended JVM and is located within the jdk directory of the Elasticsearch home directory.

To use your own version of Java, set the JAVA_HOME environment variable. If you must use a version of Java that is different from the bundled JVM, we recommend using a supported LTS version of Java. Elasticsearch will refuse to start if a known-bad version of Java is used. The bundled JVM directory may be removed when using your own JVM.

备注:https://www.elastic.co/guide/en/elasticsearch/reference/7.4/setup.html

Installing the Elastic Stack

When installing the Elastic Stack, you must use the same version across the entire stack. For example, if you are using Elasticsearch 7.4.0, you install Beats 7.4.0, APM Server 7.4.0, Elasticsearch Hadoop 7.4.0, Kibana 7.4.0, and Logstash 7.4.0.

If you’re upgrading an existing installation, see Upgrading the Elastic Stack for information about how to ensure compatibility with 7.4.0.

Installation Order

Install the Elastic Stack products you want to use in the following order:

  1. Elasticsearch (install instructions)
  2. Kibana (install)
  3. Logstash (install)
  4. Beats (install instructions)
  5. APM Server (install instructions)
  6. Elasticsearch Hadoop (install instructions)

Installing in this order ensures that the components each product depends on are in place.

备注:上述内容来自官网https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html

Install Elasticsearch with RPM

The RPM for Elasticsearch can be downloaded from our website or from our RPM repository. It can be used to install Elasticsearch on any RPM-based system such as OpenSuSE, SLES, Centos, Red Hat, and Oracle Enterprise.

Import the Elasticsearch PGP Key

We sign all of our packages with the Elasticsearch Signing Key (PGP key D88E42B4, available from https://pgp.mit.edu) with fingerprint:

4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4

Download and install the public signing key:

[root@LogServer zhangxm]# rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch

Installing from the RPM repository

Create a file called elasticsearch.repo in the /etc/yum.repos.d/ directory for RedHat based distributions, or in the /etc/zypp/repos.d/ directory for OpenSuSE based distributions, containing:

 

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

 

自己在虚拟服务器上创建的文件名为 elk.repo

技术图片
 1 [root@LogServer zhangxm]# cd /etc/yum.repos.d/
 2 [root@LogServer yum.repos.d]# ls -lnt
 3 total 36
 4 -rw-r--r--. 1 0 0 2424 Oct 25  2018 docker-ce.repo
 5 -rw-r--r--. 1 0 0 1664 Aug 30  2017 CentOS-Base.repo
 6 -rw-r--r--. 1 0 0 1309 Aug 30  2017 CentOS-CR.repo
 7 -rw-r--r--. 1 0 0  649 Aug 30  2017 CentOS-Debuginfo.repo
 8 -rw-r--r--. 1 0 0  314 Aug 30  2017 CentOS-fasttrack.repo
 9 -rw-r--r--. 1 0 0  630 Aug 30  2017 CentOS-Media.repo
10 -rw-r--r--. 1 0 0 1331 Aug 30  2017 CentOS-Sources.repo
11 -rw-r--r--. 1 0 0 3830 Aug 30  2017 CentOS-Vault.repo
12 -rw-r--r--. 1 0 0  227 Apr  1  2014 rsyslog.repo
13 [root@LogServer yum.repos.d]# vim /etc/yum.repos.d/elk.repo
14 baseurl=https://artifacts.elastic.co/packages/7.x/yum
15 gpgcheck=1
16 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
17 enabled=1
18 autorefresh=1
19 "elk.repo" [New] 8L, 214C written 
View Code

 

 

And your repository is ready for use. You can now install Elasticsearch with one of the following commands:

sudo yum install elasticsearch

自己执行的过程如下:

技术图片
 1 [root@LogServer elasticsearch]# yum install elasticsearch.x86_64 
 2 Loaded plugins: fastestmirror, langpacks
 3 Loading mirror speeds from cached hostfile
 4  * base: ap.stykers.moe
 5  * extras: centos.ustc.edu.cn
 6  * updates: ap.stykers.moe
 7 Resolving Dependencies
 8 --> Running transaction check
 9 ---> Package elasticsearch.x86_64 0:7.4.0-1 will be installed
10 --> Finished Dependency Resolution
11 
12 Dependencies Resolved
13 
14 ========================================================================================================================================================================
15  Package                                     Arch                                 Version                               Repository                                 Size
16 ========================================================================================================================================================================
17 Installing:
18  elasticsearch                               x86_64                               7.4.0-1                               elastic-7.x                               278 M
19 
20 Transaction Summary
21 ========================================================================================================================================================================
22 Install  1 Package
23 
24 Total download size: 278 M
25 Installed size: 469 M
26 Is this ok [y/d/N]: y
27 Downloading packages:
28 elasticsearch-7.4.0-x86_64.rpm FAILED                                          ===============================                        ]  60 kB/s | 167 MB  00:31:38 ETA 
29 https://artifacts.elastic.co/packages/7.x/yum/7.4.0/elasticsearch-7.4.0-x86_64.rpm: [Errno 14] curl#18 - "transfer closed with 116276076 bytes remaining to read"38 ETA 
30 Trying other mirror.
31 
32 
33 Error downloading packages:
34   elasticsearch-7.4.0-1.x86_64: [Errno 256] No more mirrors to try.
View Code

 

下载中断,故改为直接从官网下载RPM包。

 

Download and install the RPM manually

The RPM for Elasticsearch v7.4.0 can be downloaded from the website and installed as follows:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.4.0-x86_64.rpm.sha512 
sudo rpm --install elasticsearch-7.4.0-x86_64.rpm

NOTE:Compares the SHA of the downloaded RPM and the published checksum, which should output elasticsearch-version-x86_64.rpm: OK.

自己执行过程如下:

技术图片
[root@LogServer elasticsearch]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm
--2019-10-03 14:43:04--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm
Resolving artifacts.elastic.co (artifacts.elastic.co)... 151.101.230.222, 2a04:4e42:36::734
Connecting to artifacts.elastic.co (artifacts.elastic.co)|151.101.230.222|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 291756632 (278M) [application/octet-stream]
Saving to: 鈥榚lasticsearch-7.4.0-x86_64.rpm鈥?

100%[==============================================================================================================================>] 291,756,632  112KB/s   in 42m 8s 

2019-10-03 15:25:14 (113 KB/s) - 鈥榚lasticsearch-7.4.0-x86_64.rpm鈥?saved [291756632/291756632]

[root@LogServer elasticsearch]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm.sha512
--2019-10-03 15:37:35--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-x86_64.rpm.sha512
Resolving artifacts.elastic.co (artifacts.elastic.co)... 151.101.110.222, 2a04:4e42:1a::734
Connecting to artifacts.elastic.co (artifacts.elastic.co)|151.101.110.222|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 160 [application/octet-stream]
Saving to: 鈥榚lasticsearch-7.4.0-x86_64.rpm.sha512鈥?

100%[==============================================================================================================================>] 160         --.-K/s   in 0s      

2019-10-03 15:37:36 (35.3 MB/s) - 鈥榚lasticsearch-7.4.0-x86_64.rpm.sha512鈥?saved [160/160]
View Code
技术图片
 1 [root@LogServer elasticsearch]# shasum -a 512 -c elasticsearch-7.4.0-x86_64.rpm.sha512
 2 bash: shasum: command not found
 3 [root@LogServer elasticsearch]# ln -s /usr/bin/sha1sum /usr/bin/shasum
 4 [root@LogServer elasticsearch]# shasum -a 512 -c elasticsearch-7.4.0-x86_64.rpm.sha512
 5 shasum: invalid option -- a
 6 Try shasum --help for more information.
 7 [root@LogServer elasticsearch]# yum install -y perl-Digest-SHA
 8 Loaded plugins: fastestmirror, langpacks
 9 Loading mirror speeds from cached hostfile
10  * base: ap.stykers.moe
11  * extras: centos.ustc.edu.cn
12  * updates: ap.stykers.moe
13 Resolving Dependencies
14 --> Running transaction check
15 ---> Package perl-Digest-SHA.x86_64 1:5.85-4.el7 will be installed
16 --> Processing Dependency: perl(Digest::base) for package: 1:perl-Digest-SHA-5.85-4.el7.x86_64
17 --> Running transaction check
18 ---> Package perl-Digest.noarch 0:1.17-245.el7 will be installed
19 --> Finished Dependency Resolution
20 
21 Dependencies Resolved
22 
23 ========================================================================================================================================================================
24  Package                                       Arch                                 Version                                    Repository                          Size
25 ========================================================================================================================================================================
26 Installing:
27  perl-Digest-SHA                               x86_64                               1:5.85-4.el7                               base                                58 k
28 Installing for dependencies:
29  perl-Digest                                   noarch                               1.17-245.el7                               base                                23 k
30 
31 Transaction Summary
32 ========================================================================================================================================================================
33 Install  1 Package (+1 Dependent package)
34 
35 Total download size: 81 k
36 Installed size: 138 k
37 Downloading packages:
38 (1/2): perl-Digest-1.17-245.el7.noarch.rpm                                                                                                       |  23 kB  00:00:02     
39 (2/2): perl-Digest-SHA-5.85-4.el7.x86_64.rpm                                                                                                     |  58 kB  00:00:03     
40 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
41 Total                                                                                                                                    21 kB/s |  81 kB  00:00:03     
42 Running transaction check
43 Running transaction test
44 Transaction test succeeded
45 Running transaction
46   Installing : perl-Digest-1.17-245.el7.noarch                                                                                                                      1/2 
47   Installing : 1:perl-Digest-SHA-5.85-4.el7.x86_64                                                                                                                  2/2 
48   Verifying  : perl-Digest-1.17-245.el7.noarch                                                                                                                      1/2 
49   Verifying  : 1:perl-Digest-SHA-5.85-4.el7.x86_64                                                                                                                  2/2 
50 
51 Installed:
52   perl-Digest-SHA.x86_64 1:5.85-4.el7                                                                                                                                   
53 
54 Dependency Installed:
55   perl-Digest.noarch 0:1.17-245.el7                                                                                                                                     
56 
57 Complete!
58 [root@LogServer elasticsearch]# shasum -a 512 -c elasticsearch-7.4.0-x86_64.rpm.sha512
59 elasticsearch-7.4.0-x86_64.rpm: OK
60 [root@LogServer elasticsearch]# sudo rpm --install elasticsearch-7.4.0-x86_64.rpm
61 Creating elasticsearch group... OK
62 Creating elasticsearch user... OK
63 ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
64  sudo systemctl daemon-reload
65  sudo systemctl enable elasticsearch.service
66 ### You can start elasticsearch service by executing
67  sudo systemctl start elasticsearch.service
68 Created elasticsearch keystore in /etc/elasticsearch
69 [root@LogServer elasticsearch]# sudo systemctl daemon-reload
70 [root@LogServer elasticsearch]# sudo systemctl enable elasticsearch.service
71 Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
72 [root@LogServer elasticsearch]# sudo systemctl start elasticsearch.service
View Code

上述执行过程中遇到两个错误:

错误1:-bash: shasum: command not found

解决方案:在CentOS上,“shasum”被称为“sha1sum”,运行下面命令修复此问题

     ln -s /usr/bin/sha1sum /usr/bin/shasum

错误2:sha1sum: invalid option -- ‘a‘

解决方案:yum install -y perl-Digest-SHA

 

SysV init vs systemd

Elasticsearch is not started automatically after installation. How to start and stop Elasticsearch depends on whether your system uses SysV init or systemd (used by newer distributions). You can tell which is being used by running this command:

ps -p 1

自己执行命令如下:

技术图片
1 [root@LogServer elasticsearch]# ps -p 1
2    PID TTY          TIME CMD
3      1 ?        00:00:45 systemd
View Code

显然用的是systemd

Running Elasticsearch with systemd

To configure Elasticsearch to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

Elasticsearch can be started and stopped as follows:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

These commands provide no feedback as to whether Elasticsearch was started successfully or not. Instead, this information will be written in the log files located in /var/log/elasticsearch/.

 

自己执行命令如下:

技术图片
 1 [root@LogServer elasticsearch]# sudo systemctl start elasticsearch.service
 2 [root@LogServer elasticsearch]# sudo systemctl status elasticsearch.service
 3 ? elasticsearch.service - Elasticsearch
 4    Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
 5    Active: active (running) since Thu 2019-10-03 21:24:15 CST; 53min ago
 6      Docs: http://www.elastic.co
 7  Main PID: 89355 (java)
 8    CGroup: /system.slice/elasticsearch.service
 9            +-89355 /usr/share/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOn...
10            +-89447 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
11 
12 Oct 03 21:24:00 LogServer systemd[1]: Starting Elasticsearch...
13 Oct 03 21:24:01 LogServer elasticsearch[89355]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be... release.
14 Oct 03 21:24:15 LogServer systemd[1]: Started Elasticsearch.
15 Hint: Some lines were ellipsized, use -l to show in full.
View Code

查看Status时发现有Warning:OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.(即cms 垃圾收集器在 jdk9 就开始被标注为 @deprecated)

解决方案:

修改/etc/elasticsearch/jvm.options文件如下:

## GC configuration
#-XX:+UseConcMarkSweepGC      ##注释掉该行配置
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
## G1GC Configuration
# NOTE: G1GC is only supported on JDK version 10 or later.
# To use G1GC uncomment the lines below.
# 10-:-XX:-UseConcMarkSweepGC
# 10-:-XX:-UseCMSInitiatingOccupancyOnly
10-:-XX:+UseG1GC      ##JDK11支持的垃圾回收器
# 10-:-XX:G1ReservePercent=25
# 10-:-XX:InitiatingHeapOccupancyPercent=30
 
备注:jvm.options文件语法可参考https://www.elastic.co/guide/en/elasticsearch/reference/7.4/jvm-options.html
 
修改后的完整配置如下:
技术图片
  1 [root@LogServer elasticsearch]# more jvm.options 
  2 ## JVM configuration
  3 
  4 ################################################################
  5 ## IMPORTANT: JVM heap size
  6 ################################################################
  7 ##
  8 ## You should always set the min and max JVM heap
  9 ## size to the same value. For example, to set
 10 ## the heap to 4 GB, set:
 11 ##
 12 ## -Xms4g
 13 ## -Xmx4g
 14 ##
 15 ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
 16 ## for more information
 17 ##
 18 ################################################################
 19 
 20 # Xms represents the initial size of total heap space
 21 # Xmx represents the maximum size of total heap space
 22 
 23 -Xms1g
 24 -Xmx1g
 25 
 26 ################################################################
 27 ## Expert settings
 28 ################################################################
 29 ##
 30 ## All settings below this section are considered
 31 ## expert settings. Dont tamper with them unless
 32 ## you understand what you are doing
 33 ##
 34 ################################################################
 35 
 36 ## GC configuration
 37 #-XX:+UseConcMarkSweepGC
 38 -XX:CMSInitiatingOccupancyFraction=75
 39 -XX:+UseCMSInitiatingOccupancyOnly
 40 
 41 ## G1GC Configuration
 42 # NOTE: G1GC is only supported on JDK version 10 or later.
 43 # To use G1GC uncomment the lines below.
 44 # 10-:-XX:-UseConcMarkSweepGC
 45 # 10-:-XX:-UseCMSInitiatingOccupancyOnly
 46 10-:-XX:+UseG1GC
 47 # 10-:-XX:G1ReservePercent=25
 48 # 10-:-XX:InitiatingHeapOccupancyPercent=30
 49 
 50 ## DNS cache policy
 51 # cache ttl in seconds for positive DNS lookups noting that this overrides the
 52 # JDK security property networkaddress.cache.ttl; set to -1 to cache forever
 53 -Des.networkaddress.cache.ttl=60
 54 # cache ttl in seconds for negative DNS lookups noting that this overrides the
 55 # JDK security property networkaddress.cache.negative ttl; set to -1 to cache
 56 # forever
 57 -Des.networkaddress.cache.negative.ttl=10
 58 
 59 ## optimizations
 60 
 61 # pre-touch memory pages used by the JVM during initialization
 62 -XX:+AlwaysPreTouch
 63 
 64 ## basic
 65 
 66 # explicitly set the stack size
 67 -Xss1m
 68 
 69 # set to headless, just in case
 70 -Djava.awt.headless=true
 71 
 72 # ensure UTF-8 encoding by default (e.g. filenames)
 73 -Dfile.encoding=UTF-8
 74 
 75 # use our provided JNA always versus the system one
 76 -Djna.nosys=true
 77 
 78 # turn off a JDK optimization that throws away stack traces for common
 79 # exceptions because stack traces are important for debugging
 80 -XX:-OmitStackTraceInFastThrow
 81 
 82 # flags to configure Netty
 83 -Dio.netty.noUnsafe=true
 84 -Dio.netty.noKeySetOptimization=true
 85 -Dio.netty.recycler.maxCapacityPerThread=0
 86 -Dio.netty.allocator.numDirectArenas=0
 87 
 88 # log4j 2
 89 -Dlog4j.shutdownHookEnabled=false
 90 -Dlog4j2.disable.jmx=true
 91 
 92 -Djava.io.tmpdir=$ES_TMPDIR
 93 
 94 ## heap dumps
 95 
 96 # generate a heap dump when an allocation from the Java heap fails
 97 # heap dumps are created in the working directory of the JVM
 98 -XX:+HeapDumpOnOutOfMemoryError
 99 
100 # specify an alternative path for heap dumps; ensure the directory exists and
101 # has sufficient space
102 -XX:HeapDumpPath=/var/lib/elasticsearch
103 
104 # specify an alternative path for JVM fatal error logs
105 -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log
106 
107 ## JDK 8 GC logging
108 
109 8:-XX:+PrintGCDetails
110 8:-XX:+PrintGCDateStamps
111 8:-XX:+PrintTenuringDistribution
112 8:-XX:+PrintGCApplicationStoppedTime
113 8:-Xloggc:/var/log/elasticsearch/gc.log
114 8:-XX:+UseGCLogFileRotation
115 8:-XX:NumberOfGCLogFiles=32
116 8:-XX:GCLogFileSize=64m
117 
118 # JDK 9+ GC logging
119 9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
120 # due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
121 # time/date parsing will break in an incompatible way for some date patterns and locals
122 9-:-Djava.locale.providers=COMPAT
View Code

保存后重启,告警已消失,如下所示:

技术图片
 1 [root@LogServer elasticsearch]# sudo systemctl stop elasticsearch.service
 2 [root@LogServer elasticsearch]# sudo systemctl start elasticsearch.service
 3 [root@LogServer elasticsearch]# sudo systemctl status elasticsearch.service
 4 ? elasticsearch.service - Elasticsearch
 5    Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
 6    Active: active (running) since Thu 2019-10-03 22:18:42 CST; 1min 5s ago
 7      Docs: http://www.elastic.co
 8  Main PID: 90287 (java)
 9    CGroup: /system.slice/elasticsearch.service
10            +-90287 /usr/share/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseG1GC -Des.net...
11            +-90386 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
12 
13 Oct 03 22:18:27 LogServer systemd[1]: Starting Elasticsearch...
14 Oct 03 22:18:42 LogServer systemd[1]: Started Elasticsearch.
View Code

 

用netstat检查运行情况,9200和9300端口已正常启动

技术图片
 1 [root@LogServer elasticsearch]# netstat -ntpl
 2 Active Internet connections (only servers)
 3 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
 4 tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
 5 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1434/sshd           
 6 tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1659/master         
 7 tcp        0      0 0.0.0.0:514             0.0.0.0:*               LISTEN      880/rsyslogd        
 8 tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
 9 tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      90287/java          
10 tcp6       0      0 ::1:9200                :::*                    LISTEN      90287/java          
11 tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      90287/java          
12 tcp6       0      0 ::1:9300                :::*                    LISTEN      90287/java          
13 tcp6       0      0 :::22                   :::*                    LISTEN      1434/sshd           
14 tcp6       0      0 ::1:25                  :::*                    LISTEN      1659/master         
15 tcp6       0      0 :::514                  :::*                    LISTEN      880/rsyslogd        
View Code

 

Checking that Elasticsearch is running

You can test that your Elasticsearch node is running by sending an HTTP request to port 9200 on localhost:

which should give you a response something like this:


  "name" : "Cp8oag6",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
  "version" : 
    "number" : "7.4.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "f27399d",
    "build_date" : "2016-03-30T09:51:41.449Z",
    "build_snapshot" : false,
    "lucene_version" : "8.2.0",
    "minimum_wire_compatibility_version" : "1.2.3",
    "minimum_index_compatibility_version" : "1.2.3"
  ,
  "tagline" : "You Know, for Search"

用curl命令检查 

技术图片
 1 [root@LogServer zhangxm]# curl -iv localhost:9200
 2 * About to connect() to localhost port 9200 (#0)
 3 *   Trying ::1...
 4 * Connected to localhost (::1) port 9200 (#0)
 5 > GET / HTTP/1.1
 6 > User-Agent: curl/7.29.0
 7 > Host: localhost:9200
 8 > Accept: */*
 9 > 
10 < HTTP/1.1 200 OK
11 HTTP/1.1 200 OK
12 < content-type: application/json; charset=UTF-8
13 content-type: application/json; charset=UTF-8
14 < content-length: 534
15 content-length: 534
16 
17 < 
18 
19   "name" : "LogServer",
20   "cluster_name" : "elasticsearch",
21   "cluster_uuid" : "eeeqcNhnSAygPaRtsrw_Jg",
22   "version" : 
23     "number" : "7.4.0",
24     "build_flavor" : "default",
25     "build_type" : "rpm",
26     "build_hash" : "22e1767283e61a198cb4db791ea66e3f11ab9910",
27     "build_date" : "2019-09-27T08:36:48.569419Z",
28     "build_snapshot" : false,
29     "lucene_version" : "8.2.0",
30     "minimum_wire_compatibility_version" : "6.8.0",
31     "minimum_index_compatibility_version" : "6.0.0-beta1"
32   ,
33   "tagline" : "You Know, for Search"
34 
35 * Connection #0 to host localhost left intact
View Code

 

技术图片
[root@LogServer elasticsearch]# curl -v localhost:9300
* About to connect() to localhost port 9300 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9300 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9300
> Accept: */*
> 
* Connection #0 to host localhost left intact
This is not an HTTP port
View Code

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

以上是关于Centos7.4下安装ElasticSearch的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7.4到Elasticsearch一路坑

Elasticsearch 7.6集群搭建(基于Centos7.4)

CentOS7.4到Elasticsearch一路坑(零)

elasticsearch的安装部署

Centos7.4部署配置Elasticsearch5.6集群

CentOS7.4到Elasticsearch一路坑