一、环境
系统 CentOS6.4x64最小化安装
elk-search1 192.168.3.71
elk-search2 192.168.3.72
二、安装jdk
[[email protected] ~]# 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 #解压安装包 [[email protected] ~]# tar xf jdk-8u45-linux-x64.tar.gz [[email protected] ~]# cp -r jdk1.8.0_45 /usr/local/ [[email protected] ~]# cat /etc/profile.d/java.sh JAVA_HOME=/usr/local/jdk1.8.0_45 JAVA_BIN=/usr/local/jdk1.8.0_45/bin JRE_HOME=/usr/local/jdk1.8.0_45/jre PATH=$PATH:/usr/local/jdk1.8.0_45/bin:/usr/local/jdk1.8.0_45/jre/bin CLASSPATH=/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 #让环境变量生效 [[email protected] ~]# source /etc/profile.d/java.sh #测试结果 [[email protected] ~]# java -version java 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
[[email protected] ~]# pwd /root [[email protected] ~]# ll |grep search -rw-r--r-- 1 root root 28478292 Mar 17 15:36 elasticsearch-1.7.2.tar.gz [[email protected] ~]# tar xf elasticsearch-1.7.2.tar.gz -C /usr/local/ #目录结构 [[email protected] ~]# cd /usr/local/elasticsearch-1.7.2/ [[email protected] elasticsearch-1.7.2]# ll total 40 drwxr-xr-x 2 root root 4096 Mar 17 15:51 bin drwxr-xr-x 2 root root 4096 Mar 17 15:51 config drwxr-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 [[email protected] elasticsearch-1.7.2]# egrep -v ‘^#|^$‘ config/elasticsearch.yml #修改集群名称 cluster.name: ELK-search #修改节点名称 node.name: "elk-search1" #启动Elasticsearch服务 #以后台启动的方式启动Elasticsearch [[email protected] elasticsearch-1.7.2]# /usr/local/elasticsearch-1.7.2/bin/elasticsearch -d [[email protected] elasticsearch-1.7.2]# netstat -tunlp |grep 9200 tcp 0 0 :::9200 :::* LISTEN 1239/java #检查结果 [[email protected] ~]# 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配置成系统启动服务
[[email protected] ~]# curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz [[email protected] ~]# mv *servicewrapp*/service /usr/local/elasticsearch-1.7.2/bin/ [[email protected] ~]# /usr/local/elasticsearch-1.7.2/bin/service/elasticsearch install #测试启动脚本 [[email protected] ~]# 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 [[email protected] ~]# netstat -tunlp |grep 9200 tcp 0 0 :::9200 :::* LISTEN 1239/java #关闭elasticsearch服务,直接用kill命令杀掉进程 [[email protected] ~]# netstat -tunlp |grep 9200 [[email protected] ~]# ps aux |grep elas |grep -v grep #使用系统服务启动脚本的start方法启动Elasticsearch [[email protected] ~]# /etc/init.d/elasticsearch start Starting Elasticsearch... Waiting for Elasticsearch...... running: PID:2490 [[email protected] ~]# netstat -tunlp |grep 9200 tcp 0 0 :::9200 :::* LISTEN 2492/java [[email protected] ~]# 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服务 [[email protected] ~]# /etc/init.d/elasticsearch stop Stopping Elasticsearch... Stopped Elasticsearch. [[email protected] ~]# netstat -tunlp |grep 9200 |grep -v grep #使用restart方法重启Elaeticsearch服务 [[email protected] ~]# /etc/init.d/elasticsearch restart Stopping Elasticsearch... Elasticsearch was not running. Starting Elasticsearch... Waiting for Elasticsearch...... running: PID:2757 [[email protected] ~]# netstat -tunlp |grep 9200 tcp 0 0 :::9200 :::* LISTEN 2759/java [[email protected] ~]# 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插件
[[email protected] ~]# /usr/local/elasticsearch-1.7.2/bin/plugin -install mobz/elasticsearch-head #查看结果 [[email protected] ~]# ll /usr/local/elasticsearch-1.7.2/plugins/ total 4 drwxr-xr-x 5 root root 4096 Mar 17 16:34 head
在浏览器查看结果,访问地址http://192.168.3.71:9200/_plugin/head/
六、安装bigdesk插件
[[email protected] ~]# /usr/local/elasticsearch-1.7.2/bin/plugin -install lukas-vlcek/bigdesk #查看结果 [[email protected] ~]# ll /usr/local/elasticsearch-1.7.2/plugins/ total 8 drwxr-xr-x 3 root root 4096 Mar 17 16:39 bigdesk drwxr-xr-x 5 root root 4096 Mar 17 16:34 head
浏览器查看结果,访问地址http://192.168.3.71:9200/_plugin/bigdesk
时间: 2024-10-12 21:06:22