• Elastic Stack之ElasticSearch分布式集群yum方式搭建


               Elastic Stack之ElasticSearch分布式集群yum方式搭建

                                      作者:尹正杰 

    版权声明:原创作品,谢绝转载!否则将追究法律责任。 

    一.搜索引擎及Lucene基本概念

    1>.什么是搜索引擎

      搜索引擎是由索引组件和搜索组件两部分组成。

      索引组件是面向数据存储和索引构建,搜索组件是面向用户提供搜索功能以及将用户提供的搜索请求转换成可用的查询语句并通过索引完成查询过程(或搜索过程)。对于搜索引擎来讲,有一个著名的索引类型叫做倒排索引。倒排索引的作用主要是通过关键词去查对应文档的。不像我们有一个表去找某一行数据。

      在索引组件比较出名就是Lucene,对于搜索组件比较出名的就是ElasticSearchSolrNutch,(后两者更偏向于数据获取组件,尤其是Nutch,一开始只是网络爬虫)。

    2>.什么是Lucene 

      Apache开元项目Lucene,Lucene只是一个索引链,它没有提供任何前端的可用界面。如下图所示,它可以帮我们把获取到的原始内容构建成文档,还能做文档分析,而且还能创建出索引来。换句话说,它自身不获取文档且不提供搜索界面。所以我们可以所Lucene只是一个开发库。因此我们可以利用Lucene来进行二次开发,我们只需要把前端页面写出来,让用户键入需要搜索的关键字,底层通过Lucene实现文档搜索,将搜索的结果在通过我们自己开发的web界面返回给前端用户,而搜索组件需要构建查询,进行切词以便对用户键入的关键字进行分析并运行查询,最终搜索引擎将查询结果返回给用户,这个功能已经有开源组件帮我们实现了,他就是著名的ElasticSearch工具。

     

      Lucene提供了类似传统关系型数据库的存储和查询能力,但是Lucene没有确定的全局模式。换句话说,luncene不像SQL数据库中的表一样,需要定义好表才能存储数据,它的内部文档存储无需提前定义好任何结构(我们称之为没有全局模式的)。

    3>.Lucene的基本概念

    一.文档(Document):
    
      文档是索引和搜索的最原子单位,它包含了一个或者多个域的容器。一个文档可以包含一个键值对,也可以包含N个键值对,而真正搜索时是搜索的value。
    
    二.域(field):
    
      文档中包含了大量的键值对,那个键我们称之为域,沿用了SQL中的叫法,也可以称之为字段。创建域的时候,我们可以为域指定多个选项(索引选项,存储选项,项向量使用选项)来控制Lucene将文档添加进域索引后对改域可以执行哪些操作,这个过程我们通常称为域的分析过程。
    
      索引选项用于通过倒排索引来控制文本是否被搜索:
    
        Index.ANYLYZED:分析(切词)并单独作为索引项(表示要使用分析器将域中的值分解成各个独立的分词,并且使得各个分词都能够被搜索)。
    
        Index.Not_ANYLYZED:和ANYYZED相反,表示不分析(不切词),把整个内容当做一个索引项。
    
        Index.ANYLYZED_NORMS:类似于Index.ANYLYZED,但不存储token和Norm(加权基准)信息。
    
        Index.Not_ANYLYZED_NORMS:类似于Index.Not_ANYLYZED,但不存储值Norm(加权基准)信息。
    
      存储选项,是否存储域的真实值:
    
        store.YES:存储真实值。
    
        store.NO:不存储真实值。
    
      域向量使用选项:
    
         域向量选项用于在搜索期间该文档所有的唯一项都能完全从文档中检索时使用。
    
    三.文档和域的加权操作
    
      需要定义加权计算标准。

    4>.如何执行搜索:

      查询Lucene索引时,它返回的是一个有序的scoreDoc对象,查询时,Luncen会为每个文档计算出其score,而后根据score进行排序。Lucene想要完成查询功能,它对外提供了大量的API,接下来我们简单的了解一下:

        IndexSearcher:搜索索引入口。

        Query及其子类。

        QueryParser :查询分析器。

        TopDocs:保存某一次查询操作当中,分值较高的前10个scoreDoc对象。

        scoreDoc:指的是搜索结果。

    5>.Lucene的多样化查询

      我们知道Lucene的查询操作最终都是通过调用IndexSearcher来完成搜索的。而IndexSearcher中有一个叫search方法完成搜索。同时完成搜索时还要传入Query实例作为参数来进行。

       TermQuery:

        对索引中的特定域进行搜索。Term是索引中的最小索引片段,每个Term包含了一个域名和一个文本值。

       TermRangeQuery:

        可以指明域方位可以在索引中的特定域中进行搜索,能搜索指定的多个域名。

      NumericRangeQuery:

        做数值范围搜索。

      PrefixQuery:

        用来搜索以指定字符串开头的项。

      BooleanQuery:

        用来实现组合搜索。组合逻辑有:AND,OR,NOT。

      PhraseQuery:

        根据位置信息来定位对应文档的。

      WildcardQuery:

        可以结合?或者*来完成通配查询。

      FuzzyQuery:

        模糊查询,Lenvenshtein。

     二.ElasticSearch基本概念

    1>.什么是ElasticSearch

      ElasticSearch就是基于Lucene的API封装成了一个搜索组件。但是除了搜索功能以外,ElasticSearch还提供了一些更强大的功能。ElasticSearch在Lucene所提供的API基础之上又额外新增了把自己构建为分布式。换句话说,ElasticSearch能够分布式的将Lucene所提供的索引组建成Shards的形式,分片分布于多个节点上,从而构建成分布式实时查询组件。

      上面我们用自己的话说了一下ES的概念,接下来我们用比较官方的话在来说一下ES的概念。ES是一个基于Lucene实现的开源,分布式,Restful的全文搜索引擎;此外,它还是一个分布式实时文档存储,其中每个文档的每个field均是被索引的数据,且可被搜索,也是一个带实时分析功能的分布式搜索引擎,能够扩展至数以百计的节点实时处理PB级别的数据。

    2>.ES的基本组件

       索引(index):

        文档容器,换句话说,索引是具有类似属性的文档的集合(索引就是一个拥有几分相似特征的文档的集合。)。类似于关系型数据库中的表。索引名必须使用小写字母。一个ES可以创建任意个索引。

      类型(type):

        类型是索引内部的逻辑分区,其意义完全取决于用户需求,一个索引内部可定义一个或多个类型。一般来说,类型就是拥有相同域的文档的预定义。

      文档(Document):

        文档是Lucene索引和搜索的原子单位(一个文档是可以被索引的基础信息单元。),它包含了一个或多个域(每个域的组成部分:一个名字,一个或多个值,拥有多个值的域,通常称为多值域),是域的容器,基于JSON格式表示。

      映射(mapping):

        原始内容存储为文档之前需要事先进行分析,例如:切词,过滤掉某些词等;映射用于定义此分析机制该如何实现。除此之外,ES还为映射提供了诸如将域中的内容排序等功能。

    3>.ES集群组件

       Cluster:

        ES的集群标识为集群名称,早期版本(ES1.x版本)默认是“elasticsearch”,本篇博客安装的是ES6.5,默认的名称为"my-application"。节点就是靠此名字来决定加入到哪个集群中。一个节点只能属于一个集群。

      Node:

        运行了单个ES实例的主机即节点。用于存储数据,参与集群索引即搜索操作。节点的标识靠节点名。

      Shard:

        将索引切割成为物理存储组件,但每一个shard都是一个独立且完整的索引,创建索引时,ES默认将其分割为5个shard。当然,用户也可以按需自定义。创建完成之后不可修改。shard有两种类型,即primary shard(主)和replica shard(从)

    primary shard(主):
      primary shard用于文档存储,每个新的索引都会自动创建出5个主shard(默认),每个primary shard都应该有一个副本(replica shard)。另外,到底有几个副本,用户是可以自定义的,可以支持动态改变。
    replica shard(从):   replica shard是primary shard的副本,用于冗余数据及查询时的负载均衡。

    4>.ES Cluster工作过程

      启动是,通过多播(默认)或单播方式在9300/tcp查找同一集群中的其他节点(依靠我们定义的集群名称),并与之建立通信。

      集群中的所有节点会选举出一个主节点负责管理整个集群状态,以及在集群范围内决定各shards的分布式,站在用户角度而言,每个均可接受相应用户的各类需求。

      集群有三种状态:green,red,yellow。

    yellow状态:
      集群处于修复状态,一旦启动修复过程,主节点可以检查所有可用shard,并确定primary shard(如果没有发现可用的primary shard,就会把replica shard提升为primary shard,此时replica shard的数量会减少一个,副本不够时会自动添加)。所以我们会说,在yellow状态时,各replica shard均处于未分配模式(也就是说,此时由primary shard负责写入和读取,并没有读写分离,吞吐能力相对较低!)。primary shard将会查找所有的replica shard并将其配置为副本。当primary shard发现找到可用replica shard少于用于定义的副本数量时,它会自动找一个节点并启动复制过程直到满足用于定义的副本数量。
    
    red状态:   集群处于不可用状态 green状态:   集群处于正常状态。

    5>.ElasticSearch官网 (https://www.elastic.co/

      Elastic官方products连接地址:https://www.elastic.co/cn/products

    三.ElasticSearch的集群部署实战

    1>.操作环境(学习阶段,我们就搭建3台ELK集群就好,安装过程重复2~6这个几个步骤即可,集群环境如下图所示)

    2>.下载elasticSearch

      下载地址:https://www.elastic.co/cn/downloads/elasticsearch

    3>.安装JDK

      由于ES是基于Java Ruby开发的,因此我们需要安装JDK,推荐使用openJDK,因为它不收费。官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-install.html

      如果使用oracle JDK的话官方已经声明是需要收费的我们安装时使用“yum list all | grep jdk” 推荐安装1.8及以上版本,如下图所示:我们需要找到"openjdk-devel","openjdk-headless","openjdk"三个安装包。如果你用yum安装了2个jdk版本,那么系统会自动帮我们切换到较新的版本!

     

    [root@node101 ~]# yum  -y install java-1.8.0-openjdk.x86_64
    Loaded plugins: fastestmirror
    base                                                                                                                               | 3.6 kB  00:00:00     
    extras                                                                                                                             | 3.4 kB  00:00:00     
    updates                                                                                                                            | 3.4 kB  00:00:00     
    Loading mirror speeds from cached hostfile
     * base: mirror.jdcloud.com
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed
    --> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.191.b12-1.el7_6 for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: fontconfig(x86-64) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libpng15.so.15()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjpeg.so.62()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libXtst.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libXrender.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libXi.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libXext.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libXcomposite.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: libX11.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
    --> Running transaction check
    ---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
    --> Processing Dependency: freetype >= 2.8-7 for package: fontconfig-2.13.0-4.3.el7.x86_64
    --> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64
    --> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64
    ---> Package giflib.x86_64 0:4.1.6-9.el7 will be installed
    --> Processing Dependency: libSM.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
    --> Processing Dependency: libICE.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
    ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed
    --> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: nss-softokn(x86-64) >= 3.36.0 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: nss(x86-64) >= 3.36.0 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: copy-jdk-configs >= 2.2 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: chkconfig >= 1.7 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: chkconfig >= 1.7 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    --> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64
    ---> Package libX11.x86_64 0:1.6.5-2.el7 will be installed
    --> Processing Dependency: libX11-common >= 1.6.5-2.el7 for package: libX11-1.6.5-2.el7.x86_64
    --> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-2.el7.x86_64
    ---> Package libXcomposite.x86_64 0:0.4.4-4.1.el7 will be installed
    ---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed
    ---> Package libXi.x86_64 0:1.7.9-1.el7 will be installed
    ---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed
    ---> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed
    ---> Package libjpeg-turbo.x86_64 0:1.2.90-6.el7 will be installed
    ---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed
    ---> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
    --> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
    --> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
    --> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
    --> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
    --> Running transaction check
    ---> Package chkconfig.x86_64 0:1.3.61-5.el7 will be updated
    ---> Package chkconfig.x86_64 0:1.7.4-1.el7 will be an update
    ---> Package copy-jdk-configs.noarch 0:3.3-10.el7_5 will be installed
    ---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
    --> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
    ---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
    ---> Package freetype.x86_64 0:2.4.11-11.el7 will be updated
    ---> Package freetype.x86_64 0:2.8-12.el7 will be an update
    ---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed
    --> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch
    --> Processing Dependency: libxslt for package: javapackages-tools-3.4.1-11.el7.noarch
    ---> Package libICE.x86_64 0:1.0.9-9.el7 will be installed
    ---> Package libSM.x86_64 0:1.2.2-2.el7 will be installed
    ---> Package libX11-common.noarch 0:1.6.5-2.el7 will be installed
    ---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
    --> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
    ---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed
    ---> Package nss.x86_64 0:3.19.1-18.el7 will be updated
    --> Processing Dependency: nss = 3.19.1-18.el7 for package: nss-sysinit-3.19.1-18.el7.x86_64
    --> Processing Dependency: nss(x86-64) = 3.19.1-18.el7 for package: nss-tools-3.19.1-18.el7.x86_64
    ---> Package nss.x86_64 0:3.36.0-7.el7_5 will be an update
    --> Processing Dependency: nss-util >= 3.36.0-1 for package: nss-3.36.0-7.el7_5.x86_64
    --> Processing Dependency: nspr >= 4.19.0 for package: nss-3.36.0-7.el7_5.x86_64
    --> Processing Dependency: nss-pem(x86-64) for package: nss-3.36.0-7.el7_5.x86_64
    --> Processing Dependency: libnssutil3.so(NSSUTIL_3.31)(64bit) for package: nss-3.36.0-7.el7_5.x86_64
    --> Processing Dependency: libnssutil3.so(NSSUTIL_3.24)(64bit) for package: nss-3.36.0-7.el7_5.x86_64
    --> Processing Dependency: libnssutil3.so(NSSUTIL_3.21)(64bit) for package: nss-3.36.0-7.el7_5.x86_64
    ---> Package nss-softokn.x86_64 0:3.16.2.3-13.el7_1 will be updated
    ---> Package nss-softokn.x86_64 0:3.36.0-5.el7_5 will be an update
    --> Processing Dependency: nss-softokn-freebl(x86-64) >= 3.36.0-5.el7_5 for package: nss-softokn-3.36.0-5.el7_5.x86_64
    ---> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
    ---> Package tzdata-java.noarch 0:2018i-1.el7 will be installed
    ---> Package xorg-x11-font-utils.x86_64 1:7.5-21.el7 will be installed
    --> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-21.el7.x86_64
    --> Running transaction check
    ---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
    ---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
    ---> Package libfontenc.x86_64 0:1.1.3-3.el7 will be installed
    ---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
    ---> Package nspr.x86_64 0:4.10.8-2.el7_1 will be updated
    ---> Package nspr.x86_64 0:4.19.0-1.el7_5 will be an update
    ---> Package nss-pem.x86_64 0:1.0.3-5.el7 will be installed
    ---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-13.el7_1 will be updated
    ---> Package nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5 will be an update
    ---> Package nss-sysinit.x86_64 0:3.19.1-18.el7 will be updated
    ---> Package nss-sysinit.x86_64 0:3.36.0-7.el7_5 will be an update
    ---> Package nss-tools.x86_64 0:3.19.1-18.el7 will be updated
    ---> Package nss-tools.x86_64 0:3.36.0-7.el7_5 will be an update
    ---> Package nss-util.x86_64 0:3.19.1-4.el7_1 will be updated
    ---> Package nss-util.x86_64 0:3.36.0-1.el7_5 will be an update
    ---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed
    --> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch
    --> Running transaction check
    ---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                                         Arch                       Version                                     Repository                   Size
    ==========================================================================================================================================================
    Installing:
     java-1.8.0-openjdk                              x86_64                     1:1.8.0.191.b12-1.el7_6                     updates                     254 k
    Installing for dependencies:
     copy-jdk-configs                                noarch                     3.3-10.el7_5                                base                         21 k
     dejavu-fonts-common                             noarch                     2.33-6.el7                                  base                         64 k
     dejavu-sans-fonts                               noarch                     2.33-6.el7                                  base                        1.4 M
     fontconfig                                      x86_64                     2.13.0-4.3.el7                              base                        254 k
     fontpackages-filesystem                         noarch                     1.44-8.el7                                  base                        9.9 k
     giflib                                          x86_64                     4.1.6-9.el7                                 base                         40 k
     java-1.8.0-openjdk-headless                     x86_64                     1:1.8.0.191.b12-1.el7_6                     updates                      32 M
     javapackages-tools                              noarch                     3.4.1-11.el7                                base                         73 k
     libICE                                          x86_64                     1.0.9-9.el7                                 base                         66 k
     libSM                                           x86_64                     1.2.2-2.el7                                 base                         39 k
     libX11                                          x86_64                     1.6.5-2.el7                                 base                        606 k
     libX11-common                                   noarch                     1.6.5-2.el7                                 base                        164 k
     libXau                                          x86_64                     1.0.8-2.1.el7                               base                         29 k
     libXcomposite                                   x86_64                     0.4.4-4.1.el7                               base                         22 k
     libXext                                         x86_64                     1.3.3-3.el7                                 base                         39 k
     libXi                                           x86_64                     1.7.9-1.el7                                 base                         40 k
     libXrender                                      x86_64                     0.9.10-1.el7                                base                         26 k
     libXtst                                         x86_64                     1.2.3-1.el7                                 base                         20 k
     libfontenc                                      x86_64                     1.1.3-3.el7                                 base                         31 k
     libjpeg-turbo                                   x86_64                     1.2.90-6.el7                                base                        134 k
     libpng                                          x86_64                     2:1.5.13-7.el7_2                            base                        213 k
     libxcb                                          x86_64                     1.13-1.el7                                  base                        214 k
     libxslt                                         x86_64                     1.1.28-5.el7                                base                        242 k
     lksctp-tools                                    x86_64                     1.0.17-2.el7                                base                         88 k
     nss-pem                                         x86_64                     1.0.3-5.el7                                 base                         74 k
     python-javapackages                             noarch                     3.4.1-11.el7                                base                         31 k
     python-lxml                                     x86_64                     3.2.1-4.el7                                 base                        758 k
     ttmkfdir                                        x86_64                     3.0.9-42.el7                                base                         48 k
     tzdata-java                                     noarch                     2018i-1.el7                                 updates                     187 k
     xorg-x11-font-utils                             x86_64                     1:7.5-21.el7                                base                        104 k
     xorg-x11-fonts-Type1                            noarch                     7.5-9.el7                                   base                        521 k
    Updating for dependencies:
     chkconfig                                       x86_64                     1.7.4-1.el7                                 base                        181 k
     freetype                                        x86_64                     2.8-12.el7                                  base                        380 k
     nspr                                            x86_64                     4.19.0-1.el7_5                              base                        127 k
     nss                                             x86_64                     3.36.0-7.el7_5                              base                        835 k
     nss-softokn                                     x86_64                     3.36.0-5.el7_5                              base                        315 k
     nss-softokn-freebl                              x86_64                     3.36.0-5.el7_5                              base                        222 k
     nss-sysinit                                     x86_64                     3.36.0-7.el7_5                              base                         62 k
     nss-tools                                       x86_64                     3.36.0-7.el7_5                              base                        515 k
     nss-util                                        x86_64                     3.36.0-1.el7_5                              base                         78 k
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package  (+31 Dependent packages)
    Upgrade             (  9 Dependent packages)
    
    Total download size: 40 M
    Downloading packages:
    Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
    warning: /var/cache/yum/x86_64/7/base/packages/copy-jdk-configs-3.3-10.el7_5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
    Public key for copy-jdk-configs-3.3-10.el7_5.noarch.rpm is not installed
    (1/41): copy-jdk-configs-3.3-10.el7_5.noarch.rpm                                                                                   |  21 kB  00:00:00     
    (2/41): chkconfig-1.7.4-1.el7.x86_64.rpm                                                                                           | 181 kB  00:00:00     
    (3/41): dejavu-fonts-common-2.33-6.el7.noarch.rpm                                                                                  |  64 kB  00:00:00     
    (4/41): fontconfig-2.13.0-4.3.el7.x86_64.rpm                                                                                       | 254 kB  00:00:00     
    (5/41): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                                              | 9.9 kB  00:00:00     
    (6/41): freetype-2.8-12.el7.x86_64.rpm                                                                                             | 380 kB  00:00:00     
    (7/41): giflib-4.1.6-9.el7.x86_64.rpm                                                                                              |  40 kB  00:00:00     
    (8/41): javapackages-tools-3.4.1-11.el7.noarch.rpm                                                                                 |  73 kB  00:00:00     
    (9/41): libICE-1.0.9-9.el7.x86_64.rpm                                                                                              |  66 kB  00:00:00     
    (10/41): dejavu-sans-fonts-2.33-6.el7.noarch.rpm                                                                                   | 1.4 MB  00:00:00     
    (11/41): libSM-1.2.2-2.el7.x86_64.rpm                                                                                              |  39 kB  00:00:00     
    Public key for java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64.rpm is not installed
    (12/41): java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64.rpm                                                                       | 254 kB  00:00:00     
    (13/41): libX11-common-1.6.5-2.el7.noarch.rpm                                                                                      | 164 kB  00:00:00     
    (14/41): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                                           |  29 kB  00:00:00     
    (15/41): libXcomposite-0.4.4-4.1.el7.x86_64.rpm                                                                                    |  22 kB  00:00:00     
    (16/41): libXext-1.3.3-3.el7.x86_64.rpm                                                                                            |  39 kB  00:00:00     
    (17/41): libX11-1.6.5-2.el7.x86_64.rpm                                                                                             | 606 kB  00:00:00     
    (18/41): libXi-1.7.9-1.el7.x86_64.rpm                                                                                              |  40 kB  00:00:00     
    (19/41): libXrender-0.9.10-1.el7.x86_64.rpm                                                                                        |  26 kB  00:00:00     
    (20/41): libXtst-1.2.3-1.el7.x86_64.rpm                                                                                            |  20 kB  00:00:00     
    (21/41): libfontenc-1.1.3-3.el7.x86_64.rpm                                                                                         |  31 kB  00:00:00     
    (22/41): libjpeg-turbo-1.2.90-6.el7.x86_64.rpm                                                                                     | 134 kB  00:00:00     
    (23/41): libpng-1.5.13-7.el7_2.x86_64.rpm                                                                                          | 213 kB  00:00:00     
    (24/41): libxcb-1.13-1.el7.x86_64.rpm                                                                                              | 214 kB  00:00:00     
    (25/41): lksctp-tools-1.0.17-2.el7.x86_64.rpm                                                                                      |  88 kB  00:00:00     
    (26/41): libxslt-1.1.28-5.el7.x86_64.rpm                                                                                           | 242 kB  00:00:00     
    (27/41): nspr-4.19.0-1.el7_5.x86_64.rpm                                                                                            | 127 kB  00:00:00     
    (28/41): nss-pem-1.0.3-5.el7.x86_64.rpm                                                                                            |  74 kB  00:00:00     
    (29/41): nss-softokn-3.36.0-5.el7_5.x86_64.rpm                                                                                     | 315 kB  00:00:00     
    (30/41): nss-3.36.0-7.el7_5.x86_64.rpm                                                                                             | 835 kB  00:00:00     
    (31/41): nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm                                                                              | 222 kB  00:00:00     
    (32/41): nss-sysinit-3.36.0-7.el7_5.x86_64.rpm                                                                                     |  62 kB  00:00:00     
    (33/41): nss-util-3.36.0-1.el7_5.x86_64.rpm                                                                                        |  78 kB  00:00:00     
    (34/41): python-javapackages-3.4.1-11.el7.noarch.rpm                                                                               |  31 kB  00:00:00     
    (35/41): nss-tools-3.36.0-7.el7_5.x86_64.rpm                                                                                       | 515 kB  00:00:00     
    (36/41): ttmkfdir-3.0.9-42.el7.x86_64.rpm                                                                                          |  48 kB  00:00:00     
    (37/41): xorg-x11-font-utils-7.5-21.el7.x86_64.rpm                                                                                 | 104 kB  00:00:00     
    (38/41): python-lxml-3.2.1-4.el7.x86_64.rpm                                                                                        | 758 kB  00:00:00     
    (39/41): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm                                                                                 | 521 kB  00:00:00     
    (40/41): tzdata-java-2018i-1.el7.noarch.rpm                                                                                        | 187 kB  00:00:00     
    (41/41): java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64.rpm                                                              |  32 MB  00:00:07     
    ----------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                     5.2 MB/s |  40 MB  00:00:07     
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    Importing GPG key 0xF4A80EB5:
     Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
     Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
     Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Updating   : nspr-4.19.0-1.el7_5.x86_64                                                                                                            1/50 
      Updating   : nss-util-3.36.0-1.el7_5.x86_64                                                                                                        2/50 
      Updating   : chkconfig-1.7.4-1.el7.x86_64                                                                                                          3/50 
      Installing : libxslt-1.1.28-5.el7.x86_64                                                                                                           4/50 
      Installing : libjpeg-turbo-1.2.90-6.el7.x86_64                                                                                                     5/50 
      Installing : fontpackages-filesystem-1.44-8.el7.noarch                                                                                             6/50 
      Installing : libICE-1.0.9-9.el7.x86_64                                                                                                             7/50 
      Installing : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                                        8/50 
      Updating   : freetype-2.8-12.el7.x86_64                                                                                                            9/50 
      Installing : ttmkfdir-3.0.9-42.el7.x86_64                                                                                                         10/50 
      Installing : libSM-1.2.2-2.el7.x86_64                                                                                                             11/50 
      Installing : dejavu-fonts-common-2.33-6.el7.noarch                                                                                                12/50 
      Installing : dejavu-sans-fonts-2.33-6.el7.noarch                                                                                                  13/50 
      Installing : fontconfig-2.13.0-4.3.el7.x86_64                                                                                                     14/50 
      Installing : python-lxml-3.2.1-4.el7.x86_64                                                                                                       15/50 
      Installing : python-javapackages-3.4.1-11.el7.noarch                                                                                              16/50 
      Installing : javapackages-tools-3.4.1-11.el7.noarch                                                                                               17/50 
      Updating   : nss-softokn-freebl-3.36.0-5.el7_5.x86_64                                                                                             18/50 
      Updating   : nss-softokn-3.36.0-5.el7_5.x86_64                                                                                                    19/50 
      Installing : nss-pem-1.0.3-5.el7.x86_64                                                                                                           20/50 
      Updating   : nss-sysinit-3.36.0-7.el7_5.x86_64                                                                                                    21/50 
      Updating   : nss-3.36.0-7.el7_5.x86_64                                                                                                            22/50 
      Installing : libfontenc-1.1.3-3.el7.x86_64                                                                                                        23/50 
      Installing : 1:xorg-x11-font-utils-7.5-21.el7.x86_64                                                                                              24/50 
      Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                                                25/50 
      Installing : libX11-common-1.6.5-2.el7.noarch                                                                                                     26/50 
      Installing : libXau-1.0.8-2.1.el7.x86_64                                                                                                          27/50 
      Installing : libxcb-1.13-1.el7.x86_64                                                                                                             28/50 
      Installing : libX11-1.6.5-2.el7.x86_64                                                                                                            29/50 
      Installing : libXext-1.3.3-3.el7.x86_64                                                                                                           30/50 
      Installing : libXi-1.7.9-1.el7.x86_64                                                                                                             31/50 
      Installing : libXtst-1.2.3-1.el7.x86_64                                                                                                           32/50 
      Installing : giflib-4.1.6-9.el7.x86_64                                                                                                            33/50 
      Installing : libXrender-0.9.10-1.el7.x86_64                                                                                                       34/50 
      Installing : libXcomposite-0.4.4-4.1.el7.x86_64                                                                                                   35/50 
      Installing : lksctp-tools-1.0.17-2.el7.x86_64                                                                                                     36/50 
      Installing : copy-jdk-configs-3.3-10.el7_5.noarch                                                                                                 37/50 
      Installing : tzdata-java-2018i-1.el7.noarch                                                                                                       38/50 
      Installing : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64                                                                           39/50 
      Installing : 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64                                                                                    40/50 
      Updating   : nss-tools-3.36.0-7.el7_5.x86_64                                                                                                      41/50 
      Cleanup    : nss-tools-3.19.1-18.el7.x86_64                                                                                                       42/50 
      Cleanup    : nss-sysinit-3.19.1-18.el7.x86_64                                                                                                     43/50 
      Cleanup    : nss-3.19.1-18.el7.x86_64                                                                                                             44/50 
      Cleanup    : nss-softokn-3.16.2.3-13.el7_1.x86_64                                                                                                 45/50 
      Cleanup    : nss-util-3.19.1-4.el7_1.x86_64                                                                                                       46/50 
      Cleanup    : nspr-4.10.8-2.el7_1.x86_64                                                                                                           47/50 
      Cleanup    : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64                                                                                          48/50 
      Cleanup    : chkconfig-1.3.61-5.el7.x86_64                                                                                                        49/50 
      Cleanup    : freetype-2.4.11-11.el7.x86_64                                                                                                        50/50 
      Verifying  : libXext-1.3.3-3.el7.x86_64                                                                                                            1/50 
      Verifying  : libXi-1.7.9-1.el7.x86_64                                                                                                              2/50 
      Verifying  : fontconfig-2.13.0-4.3.el7.x86_64                                                                                                      3/50 
      Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                                        4/50 
      Verifying  : giflib-4.1.6-9.el7.x86_64                                                                                                             5/50 
      Verifying  : libXrender-0.9.10-1.el7.x86_64                                                                                                        6/50 
      Verifying  : python-lxml-3.2.1-4.el7.x86_64                                                                                                        7/50 
      Verifying  : tzdata-java-2018i-1.el7.noarch                                                                                                        8/50 
      Verifying  : libICE-1.0.9-9.el7.x86_64                                                                                                             9/50 
      Verifying  : nss-3.36.0-7.el7_5.x86_64                                                                                                            10/50 
      Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                                                                                            11/50 
      Verifying  : ttmkfdir-3.0.9-42.el7.x86_64                                                                                                         12/50 
      Verifying  : freetype-2.8-12.el7.x86_64                                                                                                           13/50 
      Verifying  : nss-util-3.36.0-1.el7_5.x86_64                                                                                                       14/50 
      Verifying  : copy-jdk-configs-3.3-10.el7_5.noarch                                                                                                 15/50 
      Verifying  : python-javapackages-3.4.1-11.el7.noarch                                                                                              16/50 
      Verifying  : nss-pem-1.0.3-5.el7.x86_64                                                                                                           17/50 
      Verifying  : dejavu-fonts-common-2.33-6.el7.noarch                                                                                                18/50 
      Verifying  : libXcomposite-0.4.4-4.1.el7.x86_64                                                                                                   19/50 
      Verifying  : libXtst-1.2.3-1.el7.x86_64                                                                                                           20/50 
      Verifying  : libxcb-1.13-1.el7.x86_64                                                                                                             21/50 
      Verifying  : libjpeg-turbo-1.2.90-6.el7.x86_64                                                                                                    22/50 
      Verifying  : lksctp-tools-1.0.17-2.el7.x86_64                                                                                                     23/50 
      Verifying  : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                                                24/50 
      Verifying  : libxslt-1.1.28-5.el7.x86_64                                                                                                          25/50 
      Verifying  : libX11-1.6.5-2.el7.x86_64                                                                                                            26/50 
      Verifying  : 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64                                                                                    27/50 
      Verifying  : dejavu-sans-fonts-2.33-6.el7.noarch                                                                                                  28/50 
      Verifying  : nss-tools-3.36.0-7.el7_5.x86_64                                                                                                      29/50 
      Verifying  : javapackages-tools-3.4.1-11.el7.noarch                                                                                               30/50 
      Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64                                                                           31/50 
      Verifying  : nss-sysinit-3.36.0-7.el7_5.x86_64                                                                                                    32/50 
      Verifying  : libXau-1.0.8-2.1.el7.x86_64                                                                                                          33/50 
      Verifying  : nss-softokn-freebl-3.36.0-5.el7_5.x86_64                                                                                             34/50 
      Verifying  : libSM-1.2.2-2.el7.x86_64                                                                                                             35/50 
      Verifying  : nspr-4.19.0-1.el7_5.x86_64                                                                                                           36/50 
      Verifying  : libX11-common-1.6.5-2.el7.noarch                                                                                                     37/50 
      Verifying  : 1:xorg-x11-font-utils-7.5-21.el7.x86_64                                                                                              38/50 
      Verifying  : chkconfig-1.7.4-1.el7.x86_64                                                                                                         39/50 
      Verifying  : libfontenc-1.1.3-3.el7.x86_64                                                                                                        40/50 
      Verifying  : nss-softokn-3.36.0-5.el7_5.x86_64                                                                                                    41/50 
      Verifying  : freetype-2.4.11-11.el7.x86_64                                                                                                        42/50 
      Verifying  : nss-tools-3.19.1-18.el7.x86_64                                                                                                       43/50 
      Verifying  : nss-softokn-3.16.2.3-13.el7_1.x86_64                                                                                                 44/50 
      Verifying  : nss-3.19.1-18.el7.x86_64                                                                                                             45/50 
      Verifying  : nss-sysinit-3.19.1-18.el7.x86_64                                                                                                     46/50 
      Verifying  : chkconfig-1.3.61-5.el7.x86_64                                                                                                        47/50 
      Verifying  : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64                                                                                          48/50 
      Verifying  : nspr-4.10.8-2.el7_1.x86_64                                                                                                           49/50 
      Verifying  : nss-util-3.19.1-4.el7_1.x86_64                                                                                                       50/50 
    
    Installed:
      java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6                                                                                                       
    
    Dependency Installed:
      copy-jdk-configs.noarch 0:3.3-10.el7_5                        dejavu-fonts-common.noarch 0:2.33-6.el7        dejavu-sans-fonts.noarch 0:2.33-6.el7     
      fontconfig.x86_64 0:2.13.0-4.3.el7                            fontpackages-filesystem.noarch 0:1.44-8.el7    giflib.x86_64 0:4.1.6-9.el7               
      java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6    javapackages-tools.noarch 0:3.4.1-11.el7       libICE.x86_64 0:1.0.9-9.el7               
      libSM.x86_64 0:1.2.2-2.el7                                    libX11.x86_64 0:1.6.5-2.el7                    libX11-common.noarch 0:1.6.5-2.el7        
      libXau.x86_64 0:1.0.8-2.1.el7                                 libXcomposite.x86_64 0:0.4.4-4.1.el7           libXext.x86_64 0:1.3.3-3.el7              
      libXi.x86_64 0:1.7.9-1.el7                                    libXrender.x86_64 0:0.9.10-1.el7               libXtst.x86_64 0:1.2.3-1.el7              
      libfontenc.x86_64 0:1.1.3-3.el7                               libjpeg-turbo.x86_64 0:1.2.90-6.el7            libpng.x86_64 2:1.5.13-7.el7_2            
      libxcb.x86_64 0:1.13-1.el7                                    libxslt.x86_64 0:1.1.28-5.el7                  lksctp-tools.x86_64 0:1.0.17-2.el7        
      nss-pem.x86_64 0:1.0.3-5.el7                                  python-javapackages.noarch 0:3.4.1-11.el7      python-lxml.x86_64 0:3.2.1-4.el7          
      ttmkfdir.x86_64 0:3.0.9-42.el7                                tzdata-java.noarch 0:2018i-1.el7               xorg-x11-font-utils.x86_64 1:7.5-21.el7   
      xorg-x11-fonts-Type1.noarch 0:7.5-9.el7                      
    
    Dependency Updated:
      chkconfig.x86_64 0:1.7.4-1.el7       freetype.x86_64 0:2.8-12.el7                nspr.x86_64 0:4.19.0-1.el7_5         nss.x86_64 0:3.36.0-7.el7_5       
      nss-softokn.x86_64 0:3.36.0-5.el7_5  nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5  nss-sysinit.x86_64 0:3.36.0-7.el7_5  nss-tools.x86_64 0:3.36.0-7.el7_5 
      nss-util.x86_64 0:3.36.0-1.el7_5    
    
    Complete!
    [root@node101 ~]# 
    安装JRE环境([root@node101 ~]# yum -y install java-1.8.0-openjdk.x86_64)
    [root@node101 ~]# yum  -y install  java-1.8.0-openjdk-devel.x86_64
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.jdcloud.com
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                                      Arch                       Version                                        Repository                   Size
    ==========================================================================================================================================================
    Installing:
     java-1.8.0-openjdk-devel                     x86_64                     1:1.8.0.191.b12-1.el7_6                        updates                     9.8 M
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package
    
    Total download size: 9.8 M
    Installed size: 40 M
    Downloading packages:
    java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64.rpm                                                                          | 9.8 MB  00:00:01     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : 1:java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64                                                                                1/1 
      Verifying  : 1:java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64                                                                                1/1 
    
    Installed:
      java-1.8.0-openjdk-devel.x86_64 1:1.8.0.191.b12-1.el7_6                                                                                                 
    
    Complete!
    [root@node101 ~]# 
    安装JDK的devel开发环境([root@node101 ~]# yum -y install java-1.8.0-openjdk-devel.x86_64)
    [root@node101 ~]# java -version
    openjdk version "1.8.0_191"
    OpenJDK Runtime Environment (build 1.8.0_191-b12)
    OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# which java
    /usr/bin/java
    [root@node101 ~]# 
    [root@node101 ~]# ll /usr/bin/java
    lrwxrwxrwx. 1 root root 22 Jan 19 04:28 /usr/bin/java -> /etc/alternatives/java
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# ll /etc/alternatives/java
    lrwxrwxrwx. 1 root root 73 Jan 19 04:28 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin/java
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# echo "export JAVA_HOME=/usr" >> /etc/profile.d/java.sh          #我们这里需要配置一下Java的环境变量
    [root@node101 ~]# 
    [root@node101 ~]# cat /etc/profile.d/java.sh
    export JAVA_HOME=/usr
    [root@node101 ~]# 

    4>.安装Elasticsearch

       我们可以直接在服务器上下载Elasticsearch软件,当然我们得需要安装下载工具wget。

    [root@node101 ~]# yum -y install wget
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.jdcloud.com
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package wget.x86_64 0:1.14-18.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                           Arch                                Version                                    Repository                         Size
    ==========================================================================================================================================================
    Installing:
     wget                              x86_64                              1.14-18.el7                                base                              547 k
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package
    
    Total download size: 547 k
    Installed size: 2.0 M
    Downloading packages:
    wget-1.14-18.el7.x86_64.rpm                                                                                                        | 547 kB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : wget-1.14-18.el7.x86_64                                                                                                                1/1 
      Verifying  : wget-1.14-18.el7.x86_64                                                                                                                1/1 
    
    Installed:
      wget.x86_64 0:1.14-18.el7                                                                                                                               
    
    Complete!
    [root@node101 ~]# 
    安装下载工具([root@node101 ~]# yum -y install wget)
    [root@node101 ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.rpm

      当然你也可以在Windows上自己下载好后上传到服务器,可以使用winsScp等工具上传,当然也可以使用rz命令进行上传,默认是没有安装该工具的,安装一下即可。

    [root@node101 ~]# yum -y install lrzsz
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.jdcloud.com
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package lrzsz.x86_64 0:0.12.20-36.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                           Arch                               Version                                      Repository                        Size
    ==========================================================================================================================================================
    Installing:
     lrzsz                             x86_64                             0.12.20-36.el7                               base                              78 k
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package
    
    Total download size: 78 k
    Installed size: 181 k
    Downloading packages:
    lrzsz-0.12.20-36.el7.x86_64.rpm                                                                                                    |  78 kB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : lrzsz-0.12.20-36.el7.x86_64                                                                                                            1/1 
      Verifying  : lrzsz-0.12.20-36.el7.x86_64                                                                                                            1/1 
    
    Installed:
      lrzsz.x86_64 0:0.12.20-36.el7                                                                                                                           
    
    Complete!
    [root@node101 ~]# 
    [root@node101 ~]# yum -y install lrzsz
    [root@node101 ~]# ll -h
    total 109M
    -rw-r--r--. 1 root root 109M Jan 18 15:13 elasticsearch-6.5.4.rpm
    [root@node101 ~]# 
    [root@node101 ~]# yum -y install elasticsearch-6.5.4.rpm           #下载完成后,我们手动安装即可
    Loaded plugins: fastestmirror
    Examining elasticsearch-6.5.4.rpm: elasticsearch-6.5.4-1.noarch
    Marking elasticsearch-6.5.4.rpm to be installed
    Resolving Dependencies
    --> Running transaction check
    ---> Package elasticsearch.noarch 0:6.5.4-1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                               Arch                           Version                          Repository                                    Size
    ==========================================================================================================================================================
    Installing:
     elasticsearch                         noarch                         6.5.4-1                          /elasticsearch-6.5.4                         160 M
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package
    
    Total size: 160 M
    Installed size: 160 M
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Creating elasticsearch group... OK
    Creating elasticsearch user... OK
      Installing : elasticsearch-6.5.4-1.noarch                                                                                                           1/1 
    ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
     sudo systemctl daemon-reload                  #这里告诉我们如何去启动服务
     sudo systemctl enable elasticsearch.service
    ### You can start elasticsearch service by executing
     sudo systemctl start elasticsearch.service
    Created elasticsearch keystore in /etc/elasticsearch    #这里存放的是ES的配置文件
      Verifying  : elasticsearch-6.5.4-1.noarch                                                                                                           1/1 
    
    Installed:
      elasticsearch.noarch 0:6.5.4-1                                                                                                                          
    
    Complete!
    [root@node101 ~]# 

    5>.修改ES的配置文件

    [root@node101 ~]# ll /etc/elasticsearch/      #查看该目录的配置文件
    total 36
    -rw-rw----. 1 root elasticsearch   207 Jan 19 04:43 elasticsearch.keystore
    -rw-rw----. 1 root elasticsearch  2869 Dec 17 13:21 elasticsearch.yml
    -rw-rw----. 1 root elasticsearch  3266 Dec 17 13:21 jvm.options
    -rw-rw----. 1 root elasticsearch 12423 Dec 17 13:21 log4j2.properties
    -rw-rw----. 1 root elasticsearch   473 Dec 17 13:21 role_mapping.yml
    -rw-rw----. 1 root elasticsearch   197 Dec 17 13:21 roles.yml
    -rw-rw----. 1 root elasticsearch     0 Dec 17 13:21 users
    -rw-rw----. 1 root elasticsearch     0 Dec 17 13:21 users_roles
    [root@node101 ~]# 
    [root@node101 ~]# cp /etc/elasticsearch/elasticsearch.yml  /etc/elasticsearch/elasticsearch.yml.`date +%F`      #这里备份一下配置文件,如果你改错了,随时可以恢复到原来的内容
    [root@node101 ~]# 
    [root@node101 ~]# grep "cluster.name" /etc/elasticsearch/elasticsearch.yml       #查看默认的集群名称
    cluster.name: my-application
    [root@node101 ~]# 
    [root@node101 ~]# sed -i "s@^#cluster.name: my-application@cluster.name: yinzhengjie-elasticsearch@" /etc/elasticsearch/elasticsearch.yml
    [root@node101 ~]# 
    [root@node101 ~]# grep "cluster.name" /etc/elasticsearch/elasticsearch.yml       #我们这里把ES的集群名称改一下,我这里不推荐大家使用默认的集群名称
    cluster.name: yinzhengjie-elasticsearch
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# grep "node.name" /etc/elasticsearch/elasticsearch.yml 
    #node.name: node-1
    [root@node101 ~]# 
    [root@node101 ~]# sed -i "s@^#node.name: node-1@node.name: node101.yinzhengjie.org.cn@" /etc/elasticsearch/elasticsearch.yml
    [root@node101 ~]# 
    [root@node101 ~]# grep "node.name" /etc/elasticsearch/elasticsearch.yml         #修改当前node的名称,我这里使用了当前的主机名
    node.name: node101.yinzhengjie.org.cn
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# grep 9200 /etc/elasticsearch/elasticsearch.yml             #ES用于接收请求的端口,默认是9200/TCP,参与集群事物的默认是9300/TCP
    #http.port: 9200
    [root@node101 ~]#
    [root@node101 ~]# 
    [root@node101 ~]# grep  network.host /etc/elasticsearch/elasticsearch.yml           #官方给我们提供了配置文件,告诉我们怎么配置,如果不修改的话,默认只能通过127.0.0.1访问
    #network.host: 192.168.0.1
    [root@node101 ~]# 
    [root@node101 ~]# sed -i "s@^#network.host: 192.168.0.1@network.host: node101.yinzhengjie.org.cn@" /etc/elasticsearch/elasticsearch.yml               #我这里改为本机的IP地址
    [root@node101 ~]# 
    [root@node101 ~]# grep  network.host /etc/elasticsearch/elasticsearch.yml
    network.host: node101.yinzhengjie.org.cn
    [root@node101 ~]# 
    [root@node101 ~]# 

        以上修改,只是单机部署所需要修改上面配置的参数即可,如果有集群的话,应该还需要修改一个参数,具体修改内容如下:

    [root@node101 ~]# cat /etc/elasticsearch/elasticsearch.yml | egrep -v "^#|^$"
    cluster.name: yinzhengjie-elasticsearch
    node.name: node101.yinzhengjie.org.cn
    network.host: node101.yinzhengjie.org.cn
    discovery.zen.ping.unicast.hosts: ["node101.yinzhengjie.org.cn:9300", "node102.yinzhengjie.org.cn:9300","node103.yinzhengjie.org.cn:9300"]     #这里是集群的各个节点的IP地址,一定别忘记把端口加上哟!因为不加端口,可能有各别节点检测不到到情况!
    [root@node101 ~]#

    6>.启动ES服务并设置开机自启动

    [root@node101 ~]# systemctl daemon-reload
    [root@node101 ~]# 
    [root@node101 ~]# systemctl enable elasticsearch.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
    [root@node101 ~]# 
    [root@node101 ~]# systemctl start elasticsearch.service
    [root@node101 ~]# 
    [root@node101 ~]# systemctl status elasticsearch.service
    ● elasticsearch.service - Elasticsearch
       Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
       Active: active (running) since Sat 2019-01-19 05:09:59 PST; 7s ago
         Docs: http://www.elastic.co
     Main PID: 10064 (java)
       CGroup: /system.slice/elasticsearch.service
               ├─10064 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+Always...      #这里的默认使用最大堆内存是1G,在实际生产环境中显然是不够的!我们需要手动调优!测试环境就无所谓了~
               └─10117 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
    
    Jan 19 05:09:59 node101.yinzhengjie.org.cn systemd[1]: Started Elasticsearch.
    Jan 19 05:09:59 node101.yinzhengjie.org.cn systemd[1]: Starting Elasticsearch...
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# ss -tnl
    State Recv-Q Send-Q Local Address:Port Peer Address:Port 
    LISTEN 0 128 *:22 *:* 
    LISTEN 0 100 127.0.0.1:25 *:* 
    LISTEN 0 128 ::ffff:172.30.1.101:9200 :::*        #注意,这个9200端口是用来接收请求的!
    LISTEN 0 128 ::ffff:172.30.1.101:9300 :::*        #这个9300端口是用来参与集群事物的!
    LISTEN 0 128 :::22 :::* 
    LISTEN 0 100 ::1:25 :::* 
    [root@node101 ~]#
    [root@node101 ~]# ss -tnl
    State      Recv-Q Send-Q                                Local Address:Port                                               Peer Address:Port              
    LISTEN     0      128                                               *:22                                                            *:*                  
    LISTEN     0      100                                       127.0.0.1:25                                                            *:*                  
    LISTEN     0      128                                ::ffff:127.0.0.1:9200                                                         :::*                  #注意,这个9200端口是用来接收请求的!  
    LISTEN     0      128                                             ::1:9200                                                         :::*                    
    LISTEN     0      128                                ::ffff:127.0.0.1:9300                                                         :::*                  
    LISTEN     0      128                                             ::1:9300                                                         :::*                   #注意,这个9300端口是用来参与集群事物的!
    LISTEN     0      128                                              :::22                                                           :::*                  
    LISTEN     0      100                                             ::1:25                                                           :::*                  
    [root@node101 ~]# 
    没有修改ES的网络主机地址时,默认只允许本地访问,我们可以通过相应的参数查看([root@node101 ~]# ss -tnl)

    7>.等待集群每个节点都启动成功后,我们任意选取一个节点在9300端口进行抓包(部署过程重复上述的2~6步骤)

    [root@node101 ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2019-01-18 16:03:53 PST; 13h ago
     Main PID: 760 (firewalld)
       CGroup: /system.slice/firewalld.service
               └─760 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
    
    Jan 18 16:03:51 node101.yinzhengjie.org.cn systemd[1]: Starting firewalld - dynamic firewall daemon...
    Jan 18 16:03:53 node101.yinzhengjie.org.cn systemd[1]: Started firewalld - dynamic firewall daemon.
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# 
    [root@node101 ~]# systemctl stop firewalld
    [root@node101 ~]# 
    [root@node101 ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: inactive (dead) since Sat 2019-01-19 05:50:10 PST; 22s ago
     Main PID: 760 (code=exited, status=0/SUCCESS)
    
    Jan 18 16:03:51 node101.yinzhengjie.org.cn systemd[1]: Starting firewalld - dynamic firewall daemon...
    Jan 18 16:03:53 node101.yinzhengjie.org.cn systemd[1]: Started firewalld - dynamic firewall daemon.
    Jan 19 05:50:09 node101.yinzhengjie.org.cn systemd[1]: Stopping firewalld - dynamic firewall daemon...
    Jan 19 05:50:10 node101.yinzhengjie.org.cn systemd[1]: Stopped firewalld - dynamic firewall daemon.
    [root@node101 ~]# 
    [root@node101 ~]# systemctl disable firewalld
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
    [root@node101 ~]# 
    [root@node101 ~]# 
    关闭防火墙([root@node101 ~]# systemctl stop firewalld)
    [root@node101 ~]# yum -y install tcpdump
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.jdcloud.com
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.tuna.tsinghua.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package tcpdump.x86_64 14:4.9.2-3.el7 will be installed
    --> Processing Dependency: libpcap >= 14:1.5.3-10 for package: 14:tcpdump-4.9.2-3.el7.x86_64
    --> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: 14:tcpdump-4.9.2-3.el7.x86_64
    --> Running transaction check
    ---> Package libpcap.x86_64 14:1.5.3-8.el7 will be updated
    ---> Package libpcap.x86_64 14:1.5.3-11.el7 will be an update
    ---> Package openssl-libs.x86_64 1:1.0.1e-42.el7.9 will be updated
    --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-42.el7.9 for package: 1:openssl-1.0.1e-42.el7.9.x86_64
    ---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be an update
    --> Running transaction check
    ---> Package openssl.x86_64 1:1.0.1e-42.el7.9 will be updated
    ---> Package openssl.x86_64 1:1.0.2k-16.el7 will be an update
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==========================================================================================================================================================
     Package                                Arch                             Version                                     Repository                      Size
    ==========================================================================================================================================================
    Installing:
     tcpdump                                x86_64                           14:4.9.2-3.el7                              base                           421 k
    Updating for dependencies:
     libpcap                                x86_64                           14:1.5.3-11.el7                             base                           138 k
     openssl                                x86_64                           1:1.0.2k-16.el7                             base                           493 k
     openssl-libs                           x86_64                           1:1.0.2k-16.el7                             base                           1.2 M
    
    Transaction Summary
    ==========================================================================================================================================================
    Install  1 Package
    Upgrade             ( 3 Dependent packages)
    
    Total download size: 2.2 M
    Downloading packages:
    Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
    (1/4): libpcap-1.5.3-11.el7.x86_64.rpm                                                                                             | 138 kB  00:00:00     
    (2/4): openssl-1.0.2k-16.el7.x86_64.rpm                                                                                            | 493 kB  00:00:00     
    (3/4): tcpdump-4.9.2-3.el7.x86_64.rpm                                                                                              | 421 kB  00:00:00     
    (4/4): openssl-libs-1.0.2k-16.el7.x86_64.rpm                                                                                       | 1.2 MB  00:00:00     
    ----------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                     2.2 MB/s | 2.2 MB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Updating   : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                                    1/7 
      Updating   : 14:libpcap-1.5.3-11.el7.x86_64                                                                                                         2/7 
      Installing : 14:tcpdump-4.9.2-3.el7.x86_64                                                                                                          3/7 
      Updating   : 1:openssl-1.0.2k-16.el7.x86_64                                                                                                         4/7 
      Cleanup    : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                                       5/7 
      Cleanup    : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                                                  6/7 
      Cleanup    : 14:libpcap-1.5.3-8.el7.x86_64                                                                                                          7/7 
      Verifying  : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                                    1/7 
      Verifying  : 14:tcpdump-4.9.2-3.el7.x86_64                                                                                                          2/7 
      Verifying  : 1:openssl-1.0.2k-16.el7.x86_64                                                                                                         3/7 
      Verifying  : 14:libpcap-1.5.3-11.el7.x86_64                                                                                                         4/7 
      Verifying  : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                                                  5/7 
      Verifying  : 14:libpcap-1.5.3-8.el7.x86_64                                                                                                          6/7 
      Verifying  : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                                       7/7 
    
    Installed:
      tcpdump.x86_64 14:4.9.2-3.el7                                                                                                                           
    
    Dependency Updated:
      libpcap.x86_64 14:1.5.3-11.el7                   openssl.x86_64 1:1.0.2k-16.el7                   openssl-libs.x86_64 1:1.0.2k-16.el7                  
    
    Complete!
    [root@node101 ~]# 
    安装tcpdump管理工具([root@node101 ~]# yum -y install tcpdump)

       抓包操作:

    [root@node101 ~]# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 00:0c:29:ef:58:29 brd ff:ff:ff:ff:ff:ff
        inet 172.30.1.101/24 brd 172.30.1.255 scope global eno16777736
           valid_lft forever preferred_lft forever
        inet6 fe80::20c:29ff:feef:5829/64 scope link 
           valid_lft forever preferred_lft forever
    [root@node101 ~]# 
    [root@node101 ~]# tcpdump -i eno16777736 -nn tcp port 9300
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eno16777736, link-type EN10MB (Ethernet), capture size 262144 bytes

    8>.Restful API

       Elasticsearch有四类API:
    
        第一:检查集群,节点,索引等健康与否,以及获取其相应状态;
    
        第二:管理集群,节点,索引及元数据;
    
        第三:执行CRUD(增删查改)操作;
    
        第四:执行高级操作,例如:paging,filtering等
    
      ES访问接口:9200/TCP,它是HTTP请求,我们可以通过curl命令访问,格式为:“curl -x<VERB> ‘<PROTOCOL>://HOST:PORT/<PATH>?<QUERY_STRING> -d '<BODY>' ”
    
        VERB        :GET,PUT,DELETE等;
    
        PROTOCOL     :http,https
    
        QUERY_STRING     :查询参数,例如?pretty表示用易读的JSON格式输出。
    
        BODY        :请求的主题
    
        案例展示:      
            查看ES集群的工作状态:
                curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat'                #查看ES可以查看的方法
                curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes'           #查看各个node节点信息,不显示头部信息
                curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes?v'        #查看各个node节点信息,显示头部信息    
                curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/master?v'        #显示主节点信息,显示头部信息    
                curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/health?v'        #查看集群的节点状态
                
        
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat' 
    =^.^=
    /_cat/allocation
    /_cat/shards
    /_cat/shards/{index}
    /_cat/master
    /_cat/nodes
    /_cat/tasks
    /_cat/indices
    /_cat/indices/{index}
    /_cat/segments
    /_cat/segments/{index}
    /_cat/count
    /_cat/count/{index}
    /_cat/recovery
    /_cat/recovery/{index}
    /_cat/health
    /_cat/pending_tasks
    /_cat/aliases
    /_cat/aliases/{alias}
    /_cat/thread_pool
    /_cat/thread_pool/{thread_pools}
    /_cat/plugins
    /_cat/fielddata
    /_cat/fielddata/{fields}
    /_cat/nodeattrs
    /_cat/repositories
    /_cat/snapshots/{repository}
    /_cat/templates
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat'
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes'  
    172.30.1.103 15 96 0 0.01 0.06 0.06 mdi - node103.yinzhengjie.org.cn
    172.30.1.101 16 96 0 0.01 0.06 0.06 mdi * node101.yinzhengjie.org.cn
    172.30.1.102 14 97 0 0.01 0.06 0.06 mdi - node102.yinzhengjie.org.cn
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes'
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes?v'
    ip           heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
    172.30.1.103           15          96   0    0.01    0.06     0.06 mdi       -      node103.yinzhengjie.org.cn
    172.30.1.101           16          96   0    0.01    0.06     0.06 mdi       *      node101.yinzhengjie.org.cn
    172.30.1.102           14          95   0    0.01    0.05     0.05 mdi       -      node102.yinzhengjie.org.cn
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/nodes?v'
    [root@node101 ~]#  curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/master?v'
    id                     host                       ip           node
    8OL373vmQz-esCKlutSQ2g node101.yinzhengjie.org.cn 172.30.1.101 node101.yinzhengjie.org.cn
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/master?v'
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/health'   
    1548147620 09:00:20 yinzhengjie-elasticsearch green 3 3 0 0 0 0 0 0 - 100.0%
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/health'
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/health?v' 
    epoch      timestamp cluster                   status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
    1548147621 09:00:21  yinzhengjie-elasticsearch green           3         3      0   0    0    0        0             0                  -                100.0%
    [root@node101 ~]# 
    [root@node101 ~]# curl -X GET 'http://node101.yinzhengjie.org.cn:9200/_cat/health?v'

    9>.博主推荐阅读:

      二进制部署方式,可参考我的笔记:https://www.cnblogs.com/yinzhengjie/p/10230708.html    

      官方安装ES部署链接:https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-install.html

      ElasticSearch的基本使用:https://www.cnblogs.com/yinzhengjie/p/10246993.html

       ElasticSearch的API官方参考链接:https://www.elastic.co/guide/en/elasticsearch/reference/6.5/index.html

  • 相关阅读:
    RabbitMQ
    虚拟化解决方案
    如何制作Windows镜像
    2018-2019-2 网络对抗技术 20165202 Exp9 Web安全基础
    2018-2019-2 网络对抗技术 20165202 Exp8 Web基础
    2018-2019-2 网络对抗技术 20165202 Exp7 网络欺诈防范
    2018-2019-2 网络对抗技术 20165202 Exp6 信息搜集与漏洞扫描
    2018-2019-2 网络对抗技术 20165202 Exp5 MSF基础应用
    2018-2019-2 网络对抗技术 20165202 Exp4 恶意代码分析
    2018-2019-2 网络对抗技术 20165202 Exp3 免杀原理与实践
  • 原文地址:https://www.cnblogs.com/yinzhengjie/p/10226567.html
Copyright © 2020-2023  润新知