一、环境
系统 CentOS6.4x64最小化安装
elk-search1 192.168.3.71
elk-search2 192.168.3.72
二、安装jdk
[root@elk-search1 ~]# ll |grep tar.gz-rw-r--r-- 1 root root 28478292 Mar 17 15:36 elasticsearch-1.7.2.tar.gz-rw-r--r-- 1 root root 173271626 Mar 17 15:39 jdk-8u45-linux-x64.tar.gz-rw-r--r-- 1 root root 10675082 Mar 17 15:39 kibana-4.1.0-linux-x64.tar.gz-rw-r--r-- 1 root root 89853616 Mar 17 15:40 logstash-1.5.5.tar.gz#解压安装包[root@elk-search1 ~]# tar xf jdk-8u45-linux-x64.tar.gz [root@elk-search1 ~]# cp -r jdk1.8.0_45 /usr/local/[root@elk-search1 ~]# cat /etc/profile.d/java.shJAVA_HOME=/usr/local/jdk1.8.0_45JAVA_BIN=/usr/local/jdk1.8.0_45/binJRE_HOME=/usr/local/jdk1.8.0_45/jrePATH=$PATH:/usr/local/jdk1.8.0_45/bin:/usr/local/jdk1.8.0_45/jre/binCLASSPATH=/usr/local/jdk1.8.0_45/jre/lib:/usr/local/jdk1.8.0_45/lib:/usr/local/jdk1.8.0_45/jre/lib/charsets.jar#让环境变量生效[root@elk-search1 ~]# source /etc/profile.d/java.sh#测试结果[root@elk-search1 ~]# java -versionjava version "1.8.0_45"Java(TM) SE Runtime Environment (build 1.8.0_45-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
三、安装Elasticsearch
[root@elk-search1 ~]# pwd /root[root@elk-search1 ~]# ll |grep search-rw-r--r-- 1 root root 28478292 Mar 17 15:36 elasticsearch-1.7.2.tar.gz[root@elk-search1 ~]# tar xf elasticsearch-1.7.2.tar.gz -C /usr/local/#目录结构[root@elk-search1 ~]# cd /usr/local/elasticsearch-1.7.2/[root@elk-search1 elasticsearch-1.7.2]# lltotal 40drwxr-xr-x 2 root root 4096 Mar 17 15:51 bindrwxr-xr-x 2 root root 4096 Mar 17 15:51 configdrwxr-xr-x 3 root root 4096 Mar 17 15:51 lib-rw-rw-r-- 1 root root 11358 Sep 14 2015 LICENSE.txt-rw-rw-r-- 1 root root 150 Sep 14 2015 NOTICE.txt-rw-rw-r-- 1 root root 8700 Sep 14 2015 README.textile[root@elk-search1 elasticsearch-1.7.2]# egrep -v '^#|^$' config/elasticsearch.yml #修改集群名称cluster.name: ELK-search#修改节点名称node.name: "elk-search1"#启动Elasticsearch服务#以后台启动的方式启动Elasticsearch[root@elk-search1 elasticsearch-1.7.2]# /usr/local/elasticsearch-1.7.2/bin/elasticsearch -d [root@elk-search1 elasticsearch-1.7.2]# netstat -tunlp |grep 9200tcp 0 0 :::9200 :::* LISTEN 1239/java #检查结果[root@elk-search1 ~]# curl http://192.168.3.71:9200{ "status" : 200, "name" : "elk-search1", #自定义的节点名称 "cluster_name" : "ELK-search", #自定义的集群名称 "version" : { "number" : "1.7.2", "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec", "build_timestamp" : "2015-09-14T09:49:53Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }, "tagline" : "You Know, for Search"}
四、将Elasticsearch配置成系统启动服务
[root@elk-search1 ~]# curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz[root@elk-search1 ~]# mv *servicewrapp*/service /usr/local/elasticsearch-1.7.2/bin/[root@elk-search1 ~]# /usr/local/elasticsearch-1.7.2/bin/service/elasticsearch install#测试启动脚本[root@elk-search1 ~]# ll /etc/init.d/elasticsearch lrwxrwxrwx 1 root root 56 Mar 17 16:10 /etc/init.d/elasticsearch -> /usr/local/elasticsearch-1.7.2/bin/service/elasticsearch [root@elk-search1 ~]# netstat -tunlp |grep 9200tcp 0 0 :::9200 :::* LISTEN 1239/java#关闭elasticsearch服务,直接用kill命令杀掉进程[root@elk-search1 ~]# netstat -tunlp |grep 9200[root@elk-search1 ~]# ps aux |grep elas |grep -v grep#使用系统服务启动脚本的start方法启动Elasticsearch[root@elk-search1 ~]# /etc/init.d/elasticsearch startStarting Elasticsearch...Waiting for Elasticsearch......running: PID:2490[root@elk-search1 ~]# netstat -tunlp |grep 9200tcp 0 0 :::9200 :::* LISTEN 2492/java [root@elk-search1 ~]# curl http://192.168.3.71:9200{ "status" : 200, "name" : "elk-search1", "cluster_name" : "ELK-search", "version" : { "number" : "1.7.2", "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec", "build_timestamp" : "2015-09-14T09:49:53Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }, "tagline" : "You Know, for Search"}#使用stop方法停止Elasticsearch服务[root@elk-search1 ~]# /etc/init.d/elasticsearch stopStopping Elasticsearch...Stopped Elasticsearch.[root@elk-search1 ~]# netstat -tunlp |grep 9200 |grep -v grep#使用restart方法重启Elaeticsearch服务[root@elk-search1 ~]# /etc/init.d/elasticsearch restartStopping Elasticsearch...Elasticsearch was not running.Starting Elasticsearch...Waiting for Elasticsearch......running: PID:2757[root@elk-search1 ~]# netstat -tunlp |grep 9200tcp 0 0 :::9200 :::* LISTEN 2759/java [root@elk-search1 ~]# curl http://192.168.3.71:9200{ "status" : 200, "name" : "elk-search1", "cluster_name" : "ELK-search", "version" : { "number" : "1.7.2", "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec", "build_timestamp" : "2015-09-14T09:49:53Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }, "tagline" : "You Know, for Search"}
五、安装head插件
[root@elk-search1 ~]# /usr/local/elasticsearch-1.7.2/bin/plugin -install mobz/elasticsearch-head#查看结果[root@elk-search1 ~]# ll /usr/local/elasticsearch-1.7.2/plugins/total 4drwxr-xr-x 5 root root 4096 Mar 17 16:34 head
在浏览器查看结果,访问地址http://192.168.3.71:9200/_plugin/head/
六、安装bigdesk插件
[root@elk-search1 ~]# /usr/local/elasticsearch-1.7.2/bin/plugin -install lukas-vlcek/bigdesk#查看结果[root@elk-search1 ~]# ll /usr/local/elasticsearch-1.7.2/plugins/total 8drwxr-xr-x 3 root root 4096 Mar 17 16:39 bigdeskdrwxr-xr-x 5 root root 4096 Mar 17 16:34 head
浏览器查看结果,访问地址http://192.168.3.71:9200/_plugin/bigdesk
七、安装marvel插件
[root@elk-search1 ~]# /usr/local/elasticsearch-1.7.2/bin/plugin -install elasticsearch/marvel/latest[root@elk-search1 ~]# ll /usr/local/elasticsearch-1.7.2/plugins/total 12drwxr-xr-x 3 root root 4096 Mar 17 16:39 bigdeskdrwxr-xr-x 5 root root 4096 Mar 17 16:34 headdrwxr-xr-x 3 root root 4096 Mar 18 10:21 marvel
在浏览器查看结果,访问地址是http://192.168.3.71:9200/_plugin/marvel