设为首页 收藏本站
查看: 1032|回复: 0

[经验分享] Elasticsearch基础教程之安装

[复制链接]

尚未签到

发表于 2017-5-20 11:48:28 | 显示全部楼层 |阅读模式
  主机采用的是Ubuntu-desktop-14.04
  1、JDK
    Elasticsearch依赖Java 7。本文使用的 java version "1.7.0_67",通过如下命令可以查看JDK版本:

<span style="color:#000099;">   java -version
echo $JAVA_HOME</span>
   2、Elasticsearch
  http://www.elasticsearch.org/download里下载。 (当前是 1.4.4版本)
   对于每个版本,你可以在zip、tar、DEB、RPM类型的包中选择下载。简单起见,我们使用tar包。

  curl -L -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.tar.gz
    tar -xzvf elasticsearch-1.4.4.tar.gz
  可以看到生成一个elasticsearch-1.4.4文件夹,下面有如下目录:



  • bin:elasticsearch相关执行程序,如启动命令(elasticsearch),默认包括linux和windows的。
  • config: 配置文件,其中elasticsearch.ymelasticsearch系统功能相关的配置,如node节点名称等,logging.yml则是log的配置,和系统功能无关。

  • data: 索引数据文件,按照集群分成不同的文件目录。
  • lib: 依赖的第三方jar包
  • logs: 日志文件,文件的目录结构和格式取决于于config/logging.yml中的配置。
    至此,我们已经准备好开启我们的节点和单节点集群(Windows用户应该运行elasticsearch.bat文件)
    然后,我们进入到bin目录下:


      cd elasticsearch-1.4.4/bin
./elasticsearch
  如果一切顺利,你将看到大量的如下信息:
./elasticsearch<span style="color:#333333;">[2015-03-10 10:28:02,085][INFO ][node                     ] [Kang the Conqueror] version[1.4.4], pid[2685], build[c88f77f/2015-02-19T13:05:36Z]
[2015-03-10 10:28:02,086][INFO ][node                     ] [Kang the Conqueror] initializing ...
[2015-03-10 10:28:02,114][INFO ][plugins                  ] [Kang the Conqueror] loaded [], sites []
[2015-03-10 10:28:06,239][INFO ][node                     ] [Kang the Conqueror] initialized
[2015-03-10 10:28:06,240][INFO ][node                     ] [Kang the Conqueror] starting ...
[2015-03-10 10:28:06,448][INFO ][transport                ] [Kang the Conqueror] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/172.30.40.72:9300]}
[2015-03-10 10:28:06,489][INFO ][discovery                ] [Kang the Conqueror] elasticsearch/2FjTWGy0QmuPr5n7hWwEMg
[2015-03-10 10:28:10,275][INFO ][cluster.service          ] [Kang the Conqueror] new_master [Kang the Conqueror][2FjTWGy0QmuPr5n7hWwEMg][hayden-VirtualBox][inet[/172.30.40.72:9300]], reason: zen-disco-join (elected_as_master)
[2015-03-10 10:28:10,312][INFO ][http                     ] [Kang the Conqueror] bound_address {inet[/0:0:0:0:0:0:0:0:</span><strong style="color: rgb(51, 51, 51);">9200</strong><span style="color:#333333;">]}, publish_address {inet[/</span><strong><span style="color:#cc0000;">172.30.40.72:9200</span></strong><span style="color:#333333;">]}
[2015-03-10 10:28:10,313][INFO ][node                     ] [Kang the Conqueror] started
[2015-03-10 10:28:10,351][INFO ][gateway                  ] [Kang the Conqueror] recovered [0] indices into cluster_state
[2015-03-10 10:28:40,304][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:28:40,306][INFO ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark exceeded on one or more nodes, rerouting shards
[2015-03-10 10:29:10,293][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:29:40,293][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:30:10,294][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:30:10,297][INFO ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark exceeded on one or more nodes, rerouting shards
[2015-03-10 10:30:40,295][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:31:10,297][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:31:10,300][INFO ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark exceeded on one or more nodes, rerouting shards
[2015-03-10 10:31:40,297][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node
[2015-03-10 10:32:10,298][WARN ][cluster.routing.allocation.decider] [Kang the Conqueror] high disk watermark [10%] exceeded on [2FjTWGy0QmuPr5n7hWwEMg][Kang the Conqueror] free: 484.2mb[8.3%], shards will be relocated away from this node</span>
  至此系统启动完毕, 也要注意一下有http标记的那一行,它提供了有关HTTP地址(172.30.40.72)和端口(9200)的信息,通过这个地址和端口我们就可以访问我们的节点了。
  默认情况下,Elasticsearch使用9200来提供对其REST API的访问。如果有必要,这个端口是可以配置的。通过如下url请求验证启动状态(http://172.30.40.72:9200/):

{
"status" : 200,
"name" : "Quasar",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.4.4",
"build_hash" : "c88f77ffc81301dfa9dfd81ca2232f09588bd512",
"build_timestamp" : "2015-02-19T13:05:36Z",
"build_snapshot" : false,
"lucene_version" : "4.10.3"
},
"tagline" : "You Know, for Search"
}

   此外 我们可以看到,启动的时候会有一个节点成为默认的master。
注1: 可以覆盖集群或者节点的名字,只需Elasticsearch的时候通过命令行来指定,如下:
   ./elasticsearch --cluster.name my_cluster_name --node.name my_node_name

  注2:可以通过在启动时增加“-d”参数让其在后台运行:
  ./elasticsearch
-d -Xms512m -Xmx512m


  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-379318-1-1.html 上篇帖子: Elasticsearch Bulk API 下篇帖子: elasticsearch配置小记
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表