ElasticSearch的安装和相关插件的安装

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/whxaing2011/article/details/18237733

         本文主要介绍如下内容:

         1、ElasticSearch的安装(Windows 和 Linux)

         2、ElasticSearch插件安装

         3、ElasticSearch源码集成到Eclipse

 

         1、ElasticSearch的安装  

              1)Windows环境

                (1)下载ElasticSearch

                (2)选择电脑上某个磁盘,新建一个文件夹,命名为elasticsearch(可随意命名),将下载好的压缩包解压在该文件夹下面

                (3)进入到bin目录,找到elasticsearch.bat文件,双击执行,在bin的同级目录就会生成data和logs文件夹

                执行中可以看到如下界面:

               

        (4)验证安装成功

                      在浏览器地址栏上输入:http://localhost:9200

                      IE下,会提示下载Json数据

                      Firefox下,会显示出:                               

{
  "ok" : true,
  "status" : 200,
  "name" : "Belathauzer",
  "version" : {
    "number" : "0.90.0.Beta1",
    "snapshot_build" : false
  },
  "tagline" : "You Know, for Search"
}

        

          出现以上结果,表示安装成功。

             2)Linux环境(2014年4月24日补充)

              (1)在elasticsearch官网下载相应的安装包,支持tar、deb、rpm三种安装版本,根据自己的系统环境选择相应的安装包。这里我以tar包来说明安装过程。

              (2)解压缩安装包:tar -zxvf elasticsearch-1.1.1.tar.gz 
                        重命名压缩后的安装目录(非必须操作,只是个人习惯):mv elasticsearch-1.1.1 elasticsearch

   以后台方式启动elasticsearch(参数-d可能因为版本不同而不同,以前有的版本是-f):/usr/local/elasticsearch/bin/elasticsearch -d 

                       启动后可以通过 ps -aux | grep elasticsearch检测elasticsearch服务有没有启动:

例如:[root@slave225 bin]# ps -aux | grep elasticsearch

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root      5906  8.5 19.8 2391324 201824 pts/0  Sl   09:21   0:07 /usr/java/jdk1.7.0_25/bin/java -Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=/usr/local/elasticsearch -cp :/usr/local/elasticsearch/lib/elasticsearch-1.1.1.jar:/usr/local/elasticsearch/lib/*:/usr/local/elasticsearch/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch

root      5987  0.0  0.0 103236   868 pts/0    S+   09:22   0:00 grep elasticsearch

此时,说明服务已经启动成功了。

验证:在浏览器中输入http://ip:9200/,可以看到如下信息

{

    "status": 200,

    "name": "Omen",

    "version": {

        "number": "1.1.1",

        "build_hash": "f1585f096d3f3985e73456debdc1a0745f512bbc",

        "build_timestamp": "2014-04-16T14:27:12Z",

        "build_snapshot": false,

        "lucene_version": "4.7"

    },

    "tagline": "You Know, for Search"

}

安装elasticsearch-head插件:/usr/local/elasticsearch/bin/plugin -install mobz/elasticsearch-head

安装bigdesk插件:/usr/local/elasticsearch/bin/plugin -install lukas-vlcek/bigdesk

安装完成后进入到/usr/local/elasticsearch目录下,可以看到多了一个plugins目录,插件都会安装在该目录下。

         2、ElasticSearch插件安装            

               (1)elasticsearch-head插件:

                 安装命令:D:\elasticsearch\bin>plugin -install mobz/elasticsearch-head

                 安装完成后在D:\elasticsearch\plugins目录下会有head的文件夹

                 打开head\_site\index.html(或者在浏览器地址栏输入http://localhost:9200/_plugin/head/),

                 会显示如下界面:

             (2)bigdesk插件

                   安装命令:D:\elasticsearch\bin>plugin -install lukas-vlcek/bigdesk

                  

         3、ElasticSearch源码集成到Eclipse

         (1)下载ElasticSearch源码,解压到某个目录下

         (2)eclipseIDE——>import Maven项目——>选择elasticsearch源码项目,导入过程可能比较长,请耐心等待

         (3)导入项目完成之后,如果出现了感叹号,说明缺少依赖的jar包,找到出错位置,看看缺少什么包(一般是由于jar包版本不一致引起的,可以修改pom.xml中的version来解决该问题),然后去下载想应的包,将其放入相应位置(可以通过bulid path查看)

         (4)找到org.elasticsearch.bootstrap包中的Bootstrap.java,在

                  if (System.getProperty("wrapper.service", "XXX").equalsIgnoreCase("true")) {
                        foreground = false;
                  }

                  处增加 foreground = true;//显示在console,然后直接运行,启动效果和运行.bat文件相同,不过,因为可以看到源码,方便直接修改源码。

猜你喜欢

转载自blog.csdn.net/whxaing2011/article/details/18237733
今日推荐