原创

Elasticsearch 安装和使用配置

ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便,下面将讲解一下ElasticSearch简单安装。


1、Linux中下载:
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.tar.gz

2、解压下载包执行 tar -xzvf elasticsearch-1.4.2.tar.gz 命令如下:

[root@yoodb tmp]# tar -xzvf elasticsearch-1.4.2.tar.gz 
elasticsearch-1.4.2/config/elasticsearch.yml
elasticsearch-1.4.2/config/logging.yml
elasticsearch-1.4.2/bin/elasticsearch.bat
elasticsearch-1.4.2/bin/plugin.bat
elasticsearch-1.4.2/bin/service.bat
elasticsearch-1.4.2/bin/elasticsearch.in.bat
elasticsearch-1.4.2/bin/elasticsearch-service-mgr.exe
elasticsearch-1.4.2/bin/elasticsearch-service-x64.exe
elasticsearch-1.4.2/bin/elasticsearch-service-x86.exe
elasticsearch-1.4.2/bin/plugin
elasticsearch-1.4.2/bin/elasticsearch
elasticsearch-1.4.2/bin/elasticsearch.in.sh
elasticsearch-1.4.2/lib/sigar/libsigar-amd64-freebsd-6.so
elasticsearch-1.4.2/lib/sigar/libsigar-amd64-linux.so
elasticsearch-1.4.2/lib/sigar/libsigar-amd64-solaris.so
elasticsearch-1.4.2/lib/sigar/libsigar-ia64-linux.so
elasticsearch-1.4.2/lib/sigar/libsigar-sparc-solaris.so
elasticsearch-1.4.2/lib/sigar/libsigar-sparc64-solaris.so
elasticsearch-1.4.2/lib/sigar/libsigar-universal-macosx.dylib
elasticsearch-1.4.2/lib/sigar/libsigar-universal64-macosx.dylib
elasticsearch-1.4.2/lib/sigar/libsigar-x86-freebsd-5.so
elasticsearch-1.4.2/lib/sigar/libsigar-x86-freebsd-6.so
elasticsearch-1.4.2/lib/sigar/libsigar-x86-linux.so
elasticsearch-1.4.2/lib/sigar/libsigar-x86-solaris.so
elasticsearch-1.4.2/lib/sigar/sigar-1.6.4.jar
elasticsearch-1.4.2/lib/sigar/sigar-amd64-winnt.dll
elasticsearch-1.4.2/lib/sigar/sigar-x86-winnt.dll
elasticsearch-1.4.2/lib/sigar/sigar-x86-winnt.lib
elasticsearch-1.4.2/README.textile
elasticsearch-1.4.2/LICENSE.txt
elasticsearch-1.4.2/NOTICE.txt
elasticsearch-1.4.2/lib/lucene-core-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-analyzers-common-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-queries-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-memory-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-highlighter-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-queryparser-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-sandbox-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-suggest-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-misc-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-join-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-grouping-4.10.2.jar
elasticsearch-1.4.2/lib/lucene-spatial-4.10.2.jar
elasticsearch-1.4.2/lib/spatial4j-0.4.1.jar
elasticsearch-1.4.2/lib/lucene-expressions-4.10.2.jar
elasticsearch-1.4.2/lib/antlr-runtime-3.5.jar
elasticsearch-1.4.2/lib/asm-4.1.jar
elasticsearch-1.4.2/lib/asm-commons-4.1.jar
elasticsearch-1.4.2/lib/jts-1.13.jar
elasticsearch-1.4.2/lib/groovy-all-2.3.2.jar
elasticsearch-1.4.2/lib/log4j-1.2.17.jar
elasticsearch-1.4.2/lib/jna-4.1.0.jar
elasticsearch-1.4.2/lib/elasticsearch-1.4.2.jar


3、进入解压后的elasticsearch-1.4.2目录中,执行 ./bin/elasticsearch 单机运行,如下:

[root@localhost elasticsearch-1.4.2]# ./bin/elasticsearch
[2015-01-12
 11:09:00,795][INFO ][node                     ] [Hamilton Slade] 
version[1.4.2], pid[3989], build[927caff/2014-12-16T14:11:12Z]
[2015-01-12 11:09:00,799][INFO ][node                     ] [Hamilton Slade] initializing ...
[2015-01-12 11:09:00,806][INFO ][plugins                  ] [Hamilton Slade] loaded [], sites []
[2015-01-12 11:09:05,327][INFO ][node                     ] [Hamilton Slade] initialized
[2015-01-12 11:09:05,328][INFO ][node                     ] [Hamilton Slade] starting ...
[2015-01-12
 11:09:05,477][INFO ][transport                ] [Hamilton Slade] 
bound_address {inet[/0.0.0.0:9300]}, publish_address 
{inet[/192.168.20.244:9300]}
[2015-01-12 11:09:05,498][INFO ][discovery                ] [Hamilton Slade] elasticsearch/HOB2St62RZ2ILL_ouCwLKw
[2015-01-12
 11:09:09,287][INFO ][cluster.service          ] [Hamilton Slade] 
new_master [Hamilton 
Slade][HOB2St62RZ2ILL_ouCwLKw][wangdg][inet[/192.168.20.244:9300]], 
reason: zen-disco-join (elected_as_master)
[2015-01-12 
11:09:09,378][INFO ][http                     ] [Hamilton Slade] 
bound_address {inet[/0.0.0.0:9200]}, publish_address 
{inet[/192.168.20.244:9200]}
[2015-01-12 11:09:09,379][INFO ][node                     ] [Hamilton Slade] started
[2015-01-12 11:09:09,484][INFO ][gateway                  ] [Hamilton Slade] recovered [0] indices into cluster_state


4、通过浏览器访问http://www.yoodb.com:9200,如果显示如下:

{
  "status" : 200,
  "name" : "Hamilton Slade",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.4.2",
    "build_hash" : "927caff6f05403e936c20bf4529f144f0c89fd8c",
    "build_timestamp" : "2014-12-16T14:11:12Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.2"
  },
  "tagline" : "You Know, for Search"
}

此时说明已经启动。

5、按ctrl+c退出服务并停止,显示如下:

^C[2015-01-12 11:11:50,772][INFO ][node                     ] [Hamilton Slade] stopping ...
[2015-01-12 11:11:50,816][INFO ][node                     ] [Hamilton Slade] stopped
[2015-01-12 11:11:50,816][INFO ][node                     ] [Hamilton Slade] closing ...
[2015-01-12 11:11:50,828][INFO ][node                     ] [Hamilton Slade] closed

说明已经停止服务。

关注下方微信公众号“Java精选”(w_z90110),回复关键字领取资料:如HadoopDubboCAS源码等等,免费领取资料视频和项目。 

涵盖:程序人生、搞笑视频、算法与数据结构、黑客技术与网络安全、前端开发、Java、Python、Redis缓存、Spring源码、各大主流框架、Web开发、大数据技术、Storm、Hadoop、MapReduce、Spark、elasticsearch、单点登录统一认证、分布式框架、集群、安卓开发、iOS开发、C/C++、.NET、Linux、Mysql、Oracle、NoSQL非关系型数据库、运维等。

相关推荐

评论

分享:

支付宝

微信