CentOS 6.5下安装配置ELK及收集Nginx日志(2)

tar -xf elasticsearch-2.2.0.tar.gz -C /usr/local/
vim /usr/local/elasticsearch-2.2.0/config/elasticsearch.yml
  network.host: 192.168.50.119  # 端口绑定ip地址
  http.port: 9200

启动

这里遇到一个坑:es用户默认是不能用root用户启动的。所以要切到普通用户启动

chown -R es.elk /usr/local/elasticsearch-2.2.0
su - es
nohup  /usr/local/elasticsearch-2.2.0/bin/elasticsearch >/usr/local/elasticsearch-2.2.0/nohub &

[root@localhost ELK]# netstat -tunpl | grep 9200
tcp        0      0 ::ffff:192.168.50.119:9200  :::*                        LISTEN      2183/java

[root@localhost ELK]# curl :9200  #查看状态
{
  "name" : "Blood Brothers",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.2.0",
    "build_hash" : "8ff36d139e16f8720f2947ef62c8167a888992fe",
    "build_timestamp" : "2016-01-27T13:32:39Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

CentOS 6.5下安装配置ELK及收集Nginx日志

安装kopf和head插件

[root@localhost conf]# cd /usr/local/elasticsearch-2.2.0/bin/
[root@localhost bin]# ./plugin  install lmenezes/elasticsearch-kopf
-> Installing lmenezes/elasticsearch-kopf...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip ...
Downloading ............................................................ DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed kopf into /usr/local/elasticsearch-2.2.0/plugins/kopf

[root@localhost bin]# ./plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
Downloading .........................................................DONE
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed head into /usr/local/elasticsearch-2.2.0/plugins/head

7.安装kibana

192.168.50.119 ELK服务器

安装

[root@localhost ELK]# tar -xf kibana-4.4.0-linux-x64.tar.gz  -C /usr/local/
[root@localhost ELK]# cd /usr/local/kibana-4.4.0-linux-x64/

配置

[root@localhost kibana-4.4.0-linux-x64]# vim config/kibana.yml
elasticsearch.url: "http://192.168.50.119:9200"
server.port: 5601
server.host: "0.0.0.0"

启动

[root@localhost kibana-4.4.0-linux-x64]# nohup  /usr/local/kibana-4.4.0-linux-x64/bin/kibana > /usr/local/kibana-4.4.0-linux-x64/nohub.out &

[root@localhost ELK]# netstat -tunpl | grep 5601
tcp        0      0 0.0.0.0:5601                0.0.0.0:*

浏览器访问:5601/

CentOS 6.5下安装配置ELK及收集Nginx日志

8.安装logstash-server服务器

192.168.50.120  服务器

安装jdk和logstash

tar -zxf jdk-8u45-linux-x64.tar.gz -C /usr/local/
vim /etc/profile  #设置环境变量
export JAVA_HOME=/usr/local/jdk1.8.0_45
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
source /etc/profile  #使环境变量生效

tar –zxf logstash-2.4.0.tar.gz -C /usr/local/
mkdir /usr/local/logstash-2.4.0/conf

将redis 中的数据发送到elasticsearch中

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27f39ec3f354b022dcac1d8aaae51ea6.html