ELK-“线上标准文档”——测试
- Elasticstack官网:https://www.elastic.co
- 本文档仅限搭建过程参考,使用相关的文档,不在本文档讨论范围之内。
- 一切依据的核心即是Elasticstack官网。
- 查看支持的操作系统:
- Elasticstack各版本软件支持的系统等:https://www.elastic.co/support/matrix#show_os
- 必备软件:
- Elasticsearch:elasticsearch-5.3.0.tar.gz
- Logstash:logstash-5.3.0.tar.gz
- Kibana:kibana-5.3.0-linux-x86_64.tar.gz
- Beats:filebeat-5.3.0-linux-x86_64.tar.gz
- X-pack:x-pack-5.3.0.zip
- jdk1.8:jdk-8u121-linux-i586.tar
- 搭建流程:
- Elasticsearch:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
- 修改时区(如必要):
- cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- 安装JDK1.8,先安装yum install -y glibc.i686
- root权限下
- sysctl -w vm.max_map_count=262144
- /etc/security/limits.conf 增加
- * soft nproc 2048 (第一列为Linux账户名)
- * hard nproc 4096(第一列为Linux账户)
- * soft nofile 65536
- * hard nofile 131072
- /etc/security/limits.d/90-nproc.conf 修改
- * soft nproc 2048
- sudo sysctl -p
- 生产环境需要的配置
- Elasticsearch通过name判断所属的集群
- ● path.data and path.logs
- ○ 不要和安装目录放一起,防止升级的时候数据丢失
- ○ 可以配置多个目录
- ● cluster.name
- ○ 各节点通过cluster.name加入集群
- ● node.name
- ○ 保证重启机器名称不变
- ○ 可以设置成机器名例如node.name:${HOSTNAME}
- ● bootstrap.memory_lock
- ○ bootstrap.memory_lock: true(遇到问题,见博客园博客)
- ○ /etc/sysctl.conf 增加vm.swappiness=0
- ● network.host
- ○ 一旦配置标志进入生产环境
- ● discovery.zen.ping.unicast.hosts
- ○ 自动入集群
- ● discovery.zen.minimum_master_nodes
- ○ 避免脑裂
- 生产环境需要设置bootstrap.memory_lock: true
- 节点如下配置,承担的角色为负载均衡
- node.master: false
- node.data: false
- node.ingest: false
- 配置文件elasticsearch.yml参考:
- cluster.name: rokid-test
- node.name: node-41
- node.master: true
- node.data: true
- path.data: /home/zhangzhenghai/elk/data/elasticsearch/data
- path.logs: /home/zhangzhenghai/elk/data/elasticsearch/logs
- bootstrap.memory_lock: true
- bootstrap.system_call_filter: false
- network.host: test41
- http.port: 9200
- discovery.zen.ping.unicast.hosts:
- - test41
- - test42
- - test43
- discovery.zen.minimum_master_nodes: 2
- action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
- 启动方式:bin/elasticsearch -d -p pid
- 停止方式:kill `cat pid`
- 重启方式:kill `cat pid`
- bin/elasticsearch -d -p pid
- Logstash:
- 参考https://www.elastic.co/guide/en/logstash/current/index.html
- grok正则表达式参考:https://grokdebug.herokuapp.com/
- 配置文件:
- input {
- beats {
- port => "5043"
- }
- }
- filter {
- grok {
- match => {
- "message" => "%{HOSTNAME:hostabc} %{DAY:zhouji} %{WORD:month} %{MONTHDAY:jihao} %{TIME:shijian} %{TZ:biaozhun} %{YEAR:nian} %{TIMESTAMP_ISO8601:shijianquan} \[%{WORD:zhonglei}\] %{WORD:caozuo} %{NOTSPACE:info}"
- }
- }
- }
- output {
- file {
- codec => line {format => "%{message}"}
- path => "/home/zhangzhenghai/elk/data/logstash/%{hostabc}.log"
- }
- elasticsearch {
- hosts => ["test41:9200","test42:9200","test43:9200"]
- index => "%{hostabc}"
- document_type => "%{hostabc}"
- flush_size => 100
- idle_flush_time => 10
- user => "elastic"
- password => "baoshan"
- }
- }
- 上面的正则表达式对应的原始日志参考:
- test-41.dev.rokid-inc.com Tue Apr 25 14:54:36 CST 2017 2017-04-16 23:37:44,282 [DEBUG] add service:com.rokid.open.nlp.facade.NLPService
- 启动方式(自动加载配置文件,修改配置文件不用重启Logstash):
- bin/logstash -f config/firtst.conf --config.reload.automatic
- Kibana:
- 配置文件参考:
- server.port: 5601
- server.host: "test43"
- elasticsearch.url: "http://test43:9200"
- elasticsearch.preserveHost: true
- kibana.index: ".kibana"
- kibana.defaultAppId: "discover"
- elasticsearch.username: "elastic"
- elasticsearch.password: "xxx"
- 启动方式:
- bin/kibana
- X-Pack
- bin/elasticsearch-plugin install x-pack 或者线下安装方式
- bin/elasticsearch-plugin install file:///path/to/file/x-pack-5.3.1.zip
- bin/kibana-plugin install file:///path/to/file/x-pack-5.3.1.zip
- 查看是否安装成功:
- bin/kibana-plugin list
- bin/elasticsearch-plugin list
- (如是elastic集群,需要将所有节点安装x-pack后重启,默认用户名密码elastic/changeme才生效)
- elasticsearch.yml配置如下信息
- action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
- 卸载x-pack
- bin/elasticsearch-plugin remove x-pack
- Beats(可直接写入Elasticseatch):
- filebeat-5.3.0-linux-x86_64.tar.gz
- 配置文件参考:
- filebeat.prospectors:
- - input_type: log
- paths:
- - /home/zhangzhenghai/elk/data/filebeat/testdate.log
- document_type: typetest42
- output.elasticsearch:
- hosts: ["test41:9200","test42:9200","test43:9200"]
- index: "indextest42"
- username: "elastic"
- password: "xxx"
- output.logstash:
- hosts: ["test39:5043"]
- 启动方式:
- ./filebeat -e -c filebeat.yml -d "publish"
- 可能短期内将会部署到线上,随着部署的进行,逐步更新完善本文档。
- (发现每当需要文档的时候,经常嫌弃写得少;当需要自己写文档的时候,总感觉没得写?OMG)
如更新忘记更新此文档,请参考链接:
http://note.youdao.com/noteshare?id=d9b4d5c0f5991c63c5b8ae965722f619
ELK-“线上标准文档”——测试的更多相关文章
- day 41 标准文档流 浮动
一.标准文档流 什么是标准文档流 宏观的将,我们的web页面和ps等设计软件有本质的区别,web 网页的制作,是个“流”,从上而下 ,像 “织毛衣”.而设计软件 ,想往哪里画东西,就去哪里画 标准文档 ...
- python 全栈开发,Day48(标准文档流,块级元素和行内元素,浮动,margin的用法,文本属性和字体属性)
昨日内容回顾 高级选择器: 后代选择 : div p 子代选择器 : div>p 并集选择器: div,p 交集选择器: div.active 属性选择器: [属性~='属性值'] 伪类选择器 ...
- {03--CSS布局设置} 盒模型 二 padding bode margin 标准文档流 块级元素和行内元素 浮动 margin的用法 文本属性和字体属性 超链接导航栏 background 定位 z-index
03--CSS布局设置 本节目录 一 盒模型 二 padding(内边距) 三 boder(边框) 四 简单认识一下margin(外边距) 五 标准文档流 六 块级元素和行内元素 七 浮动 八 mar ...
- AVS、MPEG-2、H264标准文档
联合信源对AVS解码源码和相应的AVS码流.AVS码流太大,可以从http://cosoft.org.cn/projects/avsdec下载.解压avsdec_source.zip后,用VC6编译a ...
- 页面标准文档流、浮动层、float属性(转)
CSS float 浮动属性介绍 float属性:定义元素朝哪个方向浮动. 1.页面标准文档流.浮动层.float属性 1.1 文档流 HTML页面的标准文档流(默认布局)是:从上到下,从左到右,遇块 ...
- Unit 6.标准文档流,浮动,清除浮动以及margin塌陷问题
一. 什么是标准文档流 文本流其实就是文档的读取和输出顺序,也就是我们通常看到的由左到右.由上而下的读取和输出形式,在网页中每个元素都是按照这个顺序进行排序和显示的,而float和position两个 ...
- python全栈开发 * 继承性 层叠性 盒模型 标准文档流 * 180809
---恢复内容开始--- 一继承性 1.继承: 给父级设置一些属性,子级继承了父级的该属性,这就是我们的css中的继承. 2. 可继承: color . font-*(size). text-*(de ...
- css标准文档流
css标准文档流 所谓的标准文档流指的是网页当中的一个渲染顺序,就如同人类读书一样,从上向下,从左向右.网页的渲染顺序也是如此.而我们使用的标签默认都是存在于标准文档流当中. 标准文档流当中的特性 空 ...
- padding(内边框), border(边框), margin, 标准文档流, 块级元素和行内元素, 浮动 ,margin的用法
盒模型 在CSS中,"box model"这一术语是用来设计和布局时使用,然后在网页中基本上都会显示一些方方正正的盒子.我们称为这种盒子叫盒模型. 盒模型有两种:标准模型和IE模型 ...
随机推荐
- 数学图形(2.12)spherical cycloid球面外摆曲线
查了半天也没搜到其具体的定义,先把脚本代码和截图发下. #http://www.mathcurve.com/courbes3d/cycloidspheric/cycloidspheric.shtml ...
- C# 操作Excel大全
//引用Microsoft.Office.Interop.Excel.dll文件 //添加using using Microsoft.Office.Interop.Excel; using Excel ...
- 【转】word排版宏的使用
原文: https://blog.csdn.net/bruce_shan/article/details/73302756 -------------------------------------- ...
- android开发之MediaPlayer+Service MP3播放器
import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Lis ...
- NCBI SRA数据预处理
SRA数据的的处理流程大概如下 一.SRA数据下载. NCBI 上存储的数据现在大都存储为SRA格式. 下载以后就是以SRA为后缀名. 这里可以通过三种方式下载SRA格式的数据. 1.通过http方式 ...
- TP框架中ajax post请求时提示404
ajax post请求时提示404错误 TP框架中ajax post请求时提示404 找了半天是 控制器中方法有错误! 下次再遇到去控制器方法中找一步一步找,肯定能找到,我是单词拼错了!
- apk签名相关文章
签名详解:https://stackoverflow.com/questions/4245303/android-sf-file 使用不同的keystore,签名后生成SF文件一模一样正常吗? 正常 ...
- Java 的抽象特性:抽象类与接口深度解析
要点: 抽象类 接口 抽象类与接口的差别 一. 抽象 对于面向对象编程来说,抽象是它的四大特征之中的一个. 在Java中,能够通过两种形式来体现OOP的抽象:接口和抽象类. 接口和抽象类为我们提供了一 ...
- mysql max和count、limit优化
1.max 的优化记得要对max里面的字段使用索引,可以大大加快速度 2.count的优化,count(*)和count(id) 的结果可能是不一样的,因为可能存在null的情况 3.distinct ...
- Linux命令-网络命令:write
write只能给登录用户发送消息,所以先登录两个用户root和wangyunpeng root登录: wangyunpeng登录: who 查看登录用户 root发送信息给wangyunpeng: w ...