安装环境:

[root@node- src]# cat /etc/redhat-release
CentOS Linux release 7.5. (Core)

安装之前关闭防火墙 firewalld 和 selinux:

[root@node- logs]# systemctl stop firewalld
[root@node- logs]# setenforce

安装流程:

Kibana->Elasticsearch->Logstash

一、安装运行所需的Java环境,Elasticsearch、Logstash依赖于java环境,使用官方的二进制包解压安装,先下载java linux 64位tar.gz包,java 1.8的下载链接:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

配置JAVA环境:

[root@node- src]# cd /usr/local/src
[root@node- src]# tar xf jdk-8u191-linux-x64.tar.gz
[root@node- src]# mv jdk1..0_191 /usr/local #用全路径验证java是否安装成功
/usr/local/jdk1..0_191/bin/java -version #配置java环境变量
vim /etc/profile加入
export JAVA_HOME=/usr/local/jdk1..0_191/
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH #环境变量生效
source /etc/profile #java版本查看
[root@node- ~]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) -Bit Server VM (build 25.191-b12, mixed mode)

安装Kibana:

#kibana下载地址(kibana主要用来展现数据,它本身不存储数据)
https://artifacts.elastic.co/downloads/kibana/kibana-6.2.3-linux-x86_64.tar.gz #准备工作,添加elk用户,用elk用户来启动elk
useradd elk
usermod -s /sbin/nologin elk #不让elk用户来登录系统
#解压安装kibana:
tar -zxf kibana-6.2.-linux-x86_64.tar.gz
mv kibana-6.2.-linux-x86_64 /usr/local/kibana-6.2. #kibana配置文件
vim /usr/local/kibana-6.2./config/kibana.yml修改:
server.port:
server.host: "0.0.0.0"(监听在所有网卡,有风险)
#elasticsearch.url: "http://localhost:9200" (默认是连接elasticsearch的9200端口)
#elasticsearch.username: "user" (配置连接elasticsearch的用户名和密码)
#elasticsearch.password: "pass" #把kibana目录改为elk用户
chown -R elk:elk /usr/local/kibana-6.2./ #新增启动脚本vim /usr/local/kibana-6.2./bin/start.sh
nohup /usr/local/kibana-6.2./bin/kibana >>/tmp/kibana.log >>/tmp/kibana.log & chmod a+x /usr/local/kibana-6.2./bin/start.sh #用普通用户启动
su -s /bin/bash elk '/usr/local/kibana-6.2.3/bin/start.sh' 访问kibana,如有防火墙需要放开tcp 5601端口

Nginx限制访问kibana:

默认的kibana是没有任何的权限控制,先把kibana改到监听127.0.0.,借助nginx来限制访问

:借助nginx来限制访问,控制源ip的访问
worker_processes ;
events {
worker_connections ;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout ;
server {
listen ;
access_log /usr/local/nginx/logs/kibana_access.log main;
error_log /usr/local/nginx/logs/kibana_error.log error;
location / {
allow 127.0.0.1;
deny all;
proxy_pass http://127.0.0.1:5601;
}
}
} 可以在日志里面找到源ip地址:tail -f /usr/local/nginx/logs/kibana_access.log : 如果ip经常变化,就会很麻烦。nginx支持简单的用户名密码认证。
location / {
auth_basic "elk auth";
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
proxy_pass http://127.0.0.1:5601;
} printf "elk:$(openssl passwd -1 elkpass)\n" >/usr/local/nginx/conf/htpasswd : nginx源码编译安装脚本
if [ -d "/usr/local/nginx/" ];then
echo "nginx is install"
exit
else
echo "nginx in not install"
fi for softpack in wget tar gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel;do
soft_result=`rpm -qa $softpack`
if [ -z "$soft_result" ];then
echo "${softpack} is not exist,install it"
yum -y install ${softpack}
else
echo "${softpack} is exist"
fi
done cd /usr/local/src
wget 'http://nginx.org/download/nginx-1.12.2.tar.gz'
tar -zxvf nginx-1.12..tar.gz
cd nginx-1.12.
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-stream --with-stream_ssl_module
make
make install
exit ln -sf /usr/local/nginx/sbin/nginx /usr/local/bin/

elasticsearch安装配置:

elasticsearch未安装之前,kibana网页上报错,提示找不到elasticsearch。

: elasticsearch的下载地址(elasticsearch主要用来存储数据,供kibana调取并进行展现)
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz 解压安装:
cd /usr/local/src/
tar -zxf elasticsearch-6.2..tar.gz
mv elasticsearch-6.2. /usr/local/ : elasticsearch配置
vim /usr/local/elasticsearch-6.2./config/elasticsearch.yml 修改:
path.data: /usr/local/elasticsearch-6.2./data
path.logs: /usr/local/elasticsearch-6.2./logs
network.host: 127.0.0.1
http.port:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false : 把elasticsearch目录的用户和属主都更新为elk
chown -R elk:elk /usr/local/elasticsearch-6.2./ : 更改jvm的内存限制(看个人配置)
vim /usr/local/elasticsearch-6.2./config/jvm.options
-Xms100M
-Xmx100M : 编辑elasticsearch启动脚本,使用-d进行后台启动。elasticsearch
vim /usr/local/elasticsearch-6.2./bin/start.sh
/usr/local/elasticsearch-6.2./bin/elasticsearch -d chmod a+x /usr/local/elasticsearch-6.2./bin/start.sh : 启动elasticsearch
su -s /bin/bash elk '/usr/local/elasticsearch-6.2.3/bin/start.sh'
观察日志
观察kibana网页,看下还会不会报elasticsearch的错误 : elasticsearch如果监听在非127.0.0.,需要配置内核参数等
network.host: 0.0.0.0 vim /etc/security/limits.conf(处理max file descriptors [] for elasticsearch process is too low, increase to at least [])
* soft nofile
* hard nofile vim /etc/security/limits.d/-nproc.conf(处理max number of threads [] for user [elk] is too low, increase to at least [])
* soft nproc
* hard nproc sysctl.conf添加(处理max virtual memory areas vm.max_map_count [] is too low, increase to at least [])
vm.max_map_count = #需要运行sysctl -p生效

Logstash安装配置:

: logstash的下载地址(用来读取日志,正则分析日志,发送给elasticsearch数据库)
https://artifacts.elastic.co/downloads/logstash/logstash-6.2.3.tar.gz 解压安装:
tar -zxf logstash-6.2..tar.gz
mv logstash-6.2. /usr/local/
ll -h /usr/local/logstash-6.2. : 更改logstash jvm配置vim /usr/local/logstash-6.2./config/jvm.options
-Xms150M
-Xmx150M : logstash配置 vim /usr/local/logstash-6.2./config/logstash.conf
input {
file {
path => "/usr/local/nginx/logs/kibana_access.log"
}
}
output {
elasticsearch {
hosts => ["http://127.0.0.1:9200"]
}
} : logstash的启动脚本:
vim /usr/local/logstash-6.2./bin/start.sh
nohup /usr/local/logstash-6.2./bin/logstash -f /usr/local/logstash-6.2./config/logstash.conf >>/tmp/logstash.log >>/tmp/logstash.log & chmod a+x /usr/local/logstash-6.2./bin/start.sh : 启动logstash
/usr/local/logstash-6.2./bin/start.sh logstash的启动时间会有点慢,等启动过后查看kibana的界面,会有可以创建索引的地方。

Elasticsearch+Kibana+Logstash安装的更多相关文章

  1. elasticsearch+kibana+metricbeat安装部署方法

    elasticsearch+kibana+metricbeat安装部署方法 本文是elasticsearch + kibana + metricbeat,没有涉及到logstash部分.通过beat收 ...

  2. Docker安装部署ELK教程(Elasticsearch+Kibana+Logstash+Filebeat)

    Elasticsearch 是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等. Logstash 是一个完全开 ...

  3. elasticsearch kibana logstash(ELK)的安装集成应用

    官网关于kibana的学习指导网址是:https://www.elastic.co/guide/en/kibana/current/index.html Kibana是一个开源的分析和可视化平台,设计 ...

  4. Elasticsearch,Kibana,Logstash,NLog实现ASP.NET Core 分布式日志系统

    Elasticsearch - 简介 Elasticsearch 作为核心的部分,是一个具有强大索引功能的文档存储库,并且可以通过 REST API 来搜索数据.它使用 Java 编写,基于 Apac ...

  5. 【ELK】【docker】【elasticsearch】2.使用elasticSearch+kibana+logstash+ik分词器+pinyin分词器+繁简体转化分词器 6.5.4 启动 ELK+logstash概念描述

    官网地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod ...

  6. ELK(elasticsearch+kibana+logstash)搜索引擎(一): 环境搭建

    1.ELK简介 这里简单介绍一下elk架构中的各个组件,关于elk的详细介绍的请自行百度 Elasticsearch是个开源分布式搜索引擎,是整个ELK架构的核心 Logstash可以对数据进行收集. ...

  7. Elasticsearch + Kibana 简单安装使用

    1.资料来源官网,参考: https://www.elastic.co/cn/downloads/elasticsearch https://www.elastic.co/cn/downloads/k ...

  8. elasticsearch kibana的安装部署与简单使用(一)

    1.先说说es 我早两年使用过es5.x的版本,记得当时部署还是很麻烦,因为es是java写的,要先在机器上部署java环境jvm之类的一堆东西,然后才能安装es 但是现在我使用的是目前最新的7.6版 ...

  9. ELK (elasticsearch+kibana+logstash+elasticsearch-head) 华为云下载地址

    https://mirrors.huaweicloud.com/elasticsearch https://mirrors.huaweicloud.com/kibana https://mirrors ...

随机推荐

  1. MySql指令大全(转载)

    1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root ...

  2. 170414、zookeeper和dubbo的关系

    Dubbo建议使用Zookeeper作为服务的注册中心. 1.   Zookeeper的作用:         zookeeper用来注册服务和进行负载均衡,哪一个服务由哪一个机器来提供必需让调用者知 ...

  3. 170331、58到家MQ如何快速实现流量削峰填谷

    问:为什么会有本文? 答:上一篇文章<到底什么时候该使用MQ?>引起了广泛的讨论,有朋友回复说,MQ的还有一个典型应用场景是缓冲流量,削峰填谷,本文将简单介绍下,MQ要实现什么细节,才能缓 ...

  4. C# 使用KingAOP面向切面编程

    1. 在Nuget中安装KingAOP 2. 日志DEMO public class Test : IDynamicMetaObjectProvider { [LogAspec] public voi ...

  5. MongoDB 聚合结果大小限制

    The aggregate command can return either a cursor or store the results in a collection. When returnin ...

  6. linux UIO

    UIO(linux Userspace I/O子系统)用户空间设备驱动I/O技术介绍(由www.169it.com搜集整理) UIO(Userspace I/O)是运行在用户空间的I/O技术.Linu ...

  7. ROS 笔记

    ros的编程范式 - ros认为,linux平台下,机器人的软件由一个个小程序组成,这些小程序称为node,每个小程序负责一部分功能 - ros实现的框架就是,小程序的并发执行+相互通信,程序(进程) ...

  8. 转:Java多线程学习(吐血超详细总结)

    版权声明:本文为博主林炳文Evankaka原创文章,转载请注明出处http://blog.csdn.net/evankaka 目录(?)[+] 林炳文Evankaka原创作品.转载请注明出处http: ...

  9. Spring AOP和事务的相关陷阱

    1.前言 2.嵌套方法拦截失效 2.1 问题场景 2.2 解决方案 2.3 原因分析 2.3.1 原理 2.3.2 源代码分析 3.Spring事务在多线程环境下失效 3.1 问题场景 3.2 解决方 ...

  10. RHEL6.×配置Centos YUM源

    Step1: 清除原有的yum源rpm -aq|grep yum|xargs rpm -e --nodeps Step2:下载新的yum()源进行安装,注意操作系统支持64位还是32位wget htt ...