热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

elk,centos7,filebeat,elasticsearch-head详细安装步骤

先来张图,大致结构应该晓得,对吧!安装jdk:至少1.8以上yum-ylocalinstalljdk-8u73-linux-x64.rpm安装elasticse

 

先来张图,大致结构应该晓得,对吧!

 

 

安装jdk:至少1.8以上

yum -y localinstall jdk-8u73-linux-x64.rpm

安装elasticsearch5.2.1 用普通用户安装es:

 tar -zxvf elasticsearch-5.2.1.tar.gz

 [es@node elasticsearch-5.2.1]$ ./bin/elasticsearch

处理错误:

ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

cat /etc/security/limits.conf 加上下面这个:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

cat /etc/sysctl.conf

vm.max_map_count=262144
fs.file-max=65536

然后启动成功!

也可以指定名字启动:

./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name

健康基本检测

[es@node bin]$ curl -XGET '192.168.36.141:9200/_cat/master?v&pretty'
id host ip node
lbWUxIvITHy_0SufW6fBtw 192.168.36.141 192.168.36.141 my_node_name

[es@node bin]$ curl -XGET '192.168.36.141:9200/_cat/health?v&pretty'
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1499173093 08:58:13 my_cluster_name green 1 1 0 0 0 0 0 0 - 100.0%
[es@node bin]$

练习索引和文档:

新建索引,显示索引:

[es@node bin]$ curl -XPUT 'localhost:9200/customer?pretty&pretty'
[2017-07-04T09:02:16,302][INFO ][o.e.c.m.MetaDataCreateIndexService] [my_node_name] [customer] creating index, cause [api], templates [], shards [5]/[1], mappings []
{
"acknowledged" : true,
"shards_acknowledged" : true
}
[es@node bin]$ curl -XGET 'localhost:9200/_cat/indices?v&pretty'
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open customer gtxHBupjSQ-4DNgMAMnuqQ 5 1 0 0 650b 650b
[es@node bin]$

56 curl -XPUT 'localhost:9200/customer?pretty&pretty'
57 curl -XGET 'localhost:9200/_cat/indices?v&pretty'
58 curl -XPUT 'localhost:9200/customer/external/1?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"name": "John Doe"
}
'
59 curl -XGET 'localhost:9200/customer/external/1?pretty&pretty'
60 curl -XDELETE 'localhost:9200/customer?pretty&pretty'
61 curl -XGET 'localhost:9200/_cat/indices?v&pretty'
62 curl -XPUT 'localhost:9200/customer/external/1?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"name": "John Doe"
}
'
63 PUT /customer/external/1?pretty
64 { "name": "Jane Doe"; }
65 curl -XPUT 'localhost:9200/customer/external/1?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"name": "Jane Doe"
}
'
66 PUT /customer/external/2?pretty
67 { "name": "Jane Doe"; }
68 curl -XPUT 'localhost:9200/customer/external/2?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"name": "Jane Doe"
}
'
69 curl -XDELETE 'localhost:9200/customer/external/2?pretty&pretty'

官方文档说可以在kibana里面写更加直观。

反正这个装好了!下一个

 安装kibana:

tar zxvf kibana-5.2.1-linux-x86_64.tar.gz

./kibana &

http://192.168.36.141:5601/status#?_g=()

先安装filebeat:

docker run -itd --name java -p 5000:22 bc74bce8afa1 镜像是我以前做的,直接用,在另外自己的一个网站上,有时间弄下来:

测试:启动我的java包nohup java -jar /data/exchange/exchange-1.4.jar & > nohup.out >/dev/null 

获取 nohup.out

 tar zxvf filebeat-5.2.1-linux-x86_64.tar.gz

配置:

[root@4e07f322e28f ~]# cat filebeat-5.2.1-linux-x86_64/filebeat.yml
#filebeat.prospectors:
#- input_type: log
# paths:
# - /root/logstash-tutorial.log
#output.logstash:
# hosts: ["192.168.36.150:5043"]
filebeat.prospectors:
- input_type: log
paths:
- /root/nohup.out
# - /var/log/secure
# - /var/log/messages
# - /var/log/*.log
fields:
type: syslog
output.logstash:
hosts: ["192.168.36.141:5043"]

[root@4e07f322e28f ~]#

启动filebeat:./filebeat-5.2.1-linux-x86_64/filebeat -e -c filebeat-5.2.1-linux-x86_64/filebeat.yml -d "publish"

 

安装logstach:

tar zxvf logstash-5.2.1.tar.gz 

配置pip:

[root@node logstash-5.2.1]# cat first-pipline.conf
input {
beats {
port => 5043
# ssl => true
# ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
# ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
elasticsearch {
hosts => ["192.168.36.141:9200"]
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}

 启动起来:

./bin/logstash -f first-pipline.conf --config.reload.automatic

最后在kibana上面建一个索引:

好了数据出来了:

 安装一个elasticsearch-head:

这里下载:https://github.com/mobz/elasticsearch-head

1050 unzip elasticsearch-head-master.zip
1051 wget https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-x64.tar.gz
1052 tar zxvf node-v5.10.1-linux-x64.tar.gz
1053 ln -s /root/node-v5.10.1-linux-x64/bin/node /usr/local/bin/node
1054 ln -s /root/node-v5.10.1-linux-x64/bin/npm /usr/local/bin/npm
1055 cd elasticsearch-head-master
1056 npm install
1057 npm install -g cnpm --registry=https://registry.npm.taobao.org
1058 su es
1059 ll
1060 vi Gruntfile.js
1061 npm install -g grunt--registry=https://registry.npm.taobao.org
1062 npm install

cat _site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.36.141:9200";

cat Gruntfile.js:

server: {
options: {
hostname: '192.168.36.141',
port: 9100,
base: '.',
keepalive: true


1063 cd node_modules/
1064 cd grunt
1065 cd bin/
1066 ./grunt server

 

OK!!!!!

  ---------------我是有底线的-------------------- 
作者:jt
出处:http://www.cnblogs.com/Jt00/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
如果文中有什么错误,欢迎指出。以免更多的人被误导。

 


推荐阅读
  • >>>CentOS7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下1、直接关闭防火墙systemctlstopfirewalld.serv ... [详细]
  • Centos7安装MySql5.6
    如何在CentO ... [详细]
  • asp.net core 应用docke部署到centos7
    前言前期准备win10(不要安装hyper-V)VMware-Workstation-Pro15.0Xshell6(非必需)VS2019以上环境请自行安装都是默认安装没什么可说的不 ... [详细]
  • 基于CentOS7的服务器环境搭建(LAMP环境)一、安装MySQL组件  1.由于在CentOS7中,默认yum安装库中不含有mysql,我们可以下载mysql的分支Mari ... [详细]
  • 这里我们采用两台Nginx服务器作为前端,一主一从,Keepalived实现状态监测,保证Nginx正常对外提供服务,即主Nginx服务进程死掉之后,keepalived能够通过其自身的检测机制 ... [详细]
  • centos7.2下编译安装php7.1.3步骤教程centos7编译安装php-7.1.3的步骤在官网下载php-7.1.3的php压缩包,centos7安装php-7.1.3的 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 本文介绍了作者在开发过程中遇到的问题,即播放框架内容安全策略设置不起作用的错误。作者通过使用编译时依赖注入的方式解决了这个问题,并分享了解决方案。文章详细描述了问题的出现情况、错误输出内容以及解决方案的具体步骤。如果你也遇到了类似的问题,本文可能对你有一定的参考价值。 ... [详细]
  • Linux如何安装Mongodb的详细步骤和注意事项
    本文介绍了Linux如何安装Mongodb的详细步骤和注意事项,同时介绍了Mongodb的特点和优势。Mongodb是一个开源的数据库,适用于各种规模的企业和各类应用程序。它具有灵活的数据模式和高性能的数据读写操作,能够提高企业的敏捷性和可扩展性。文章还提供了Mongodb的下载安装包地址。 ... [详细]
  • 本文介绍了在CentOS上安装Python2.7.2的详细步骤,包括下载、解压、编译和安装等操作。同时提供了一些注意事项,以及测试安装是否成功的方法。 ... [详细]
  • 篇首语:本文由编程笔记#小编为大家整理,主要介绍了软件测试知识点之数据库压力测试方法小结相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 本文介绍了5个基本Linux命令行工具的现代化替代品,包括du、top和ncdu。这些替代品在功能上进行了改进,提高了可用性,并且适用于现代化系统。其中,ncdu是du的替代品,它提供了与du类似的结果,但在一个基于curses的交互式界面中,重点关注占用磁盘空间较多的目录。 ... [详细]
  • linux下编译安装lnmp
    2019独角兽企业重金招聘Python工程师标准#######################安装依赖#####################安装必要的包:y ... [详细]
  • centos 编译安装 php 5.5,CentOS 5.5上编译安装 PHP 5.3.6
    编译并安装#make&&makeinstall安装结果摘要,里面有几个主要的安装路径变量libtool:install:warning:remembertorunli ... [详细]
  • 为PHP5安装curl和gd
    2019独角兽企业重金招聘Python工程师标准一、查看php5是否安装了curl:1在web服务器目录(Ubuntu下通常为varwww ... [详细]
author-avatar
曾经
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有