1.下载ElasticSearch
官网地址 https://www.elastic.co/
2.安装elasticsearch-1.4.4.tar.gz
tar -zxvf elasticsearch-1.4.4.tar.gz
cd elasticsearch-1.4.4
3.启动
[[email protected] bin]# ./elasticsearch Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
4.这是因为jdk的版本太低,需要至少jdk1.7(我本机的jdk是1.6的,升级到1.7)
5.安装ElasticSearch Head插件(elasticsearch-head是一个elasticsearch的集群管理工具,使用它可以在web页面查看ElasticSearch的集群数据)
[[email protected] bin]# ./plugin -install mobz/elasticsearch-head -> Installing mobz/elasticsearch-head... Trying https://github.com/mobz/elasticsearch-head/archive/master.zip... Downloading ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE Installed mobz/elasticsearch-head into /usr/local/es/plugins/head Identified as a _site plugin, moving to _site structure ...
6.启动ElasticSearch
[[email protected] bin]# ./elasticsearch [2015-05-15 16:00:46,005][INFO ][node ] [Slapstick] version[1.4.4], pid[15896], build[c88f77f/2015-02-19T13:05:36Z] [2015-05-15 16:00:46,006][INFO ][node ] [Slapstick] initializing ... [2015-05-15 16:00:46,011][INFO ][plugins ] [Slapstick] loaded [], sites [head] [2015-05-15 16:00:48,571][INFO ][node ] [Slapstick] initialized [2015-05-15 16:00:48,571][INFO ][node ] [Slapstick] starting ... [2015-05-15 16:00:48,683][INFO ][transport ] [Slapstick] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/10.10.6.101:9300]} [2015-05-15 16:00:48,696][INFO ][discovery ] [Slapstick] elasticsearch/yCVkS44kTSSlpskC1LAvAg [2015-05-15 16:00:52,478][INFO ][cluster.service ] [Slapstick] new_master [Slapstick][yCVkS44kTSSlpskC1LAvAg][ChenghyNewCms][inet[/10.10.6.101:9300]], reason: zen-disco-join (elected_as_master) [2015-05-15 16:00:52,567][INFO ][http ] [Slapstick] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/10.10.6.101:9200]} [2015-05-15 16:00:52,598][INFO ][node ] [Slapstick] started [2015-05-15 16:00:52,606][INFO ][gateway ] [Slapstick] recovered [0] indices into cluster_state
7.通过web页面访问ElashticSearch集群
http://localhost:9200/_plugin/head/
8.效果图
时间: 2024-10-12 21:26:23