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模型 ...
随机推荐
- Symfony安装及使用
安装Symfony,使用 brew install homebrew/php/symfony-installer 开始一直下载不了包,我手动浏览器下载了几个,发现好像都是Permission问题,运行 ...
- C#特性杂谈
文中充满了各种C#与其他语言的对比及吐槽, 希望介意者勿观… 当然, 鉴于太乱, 我怀疑有没有人能看完. 学习C# Hello World 变量与表达式 动态类型 值类型和引用类型 checked支持 ...
- 【python】如何安装requests
在cmd窗口输入pip install requests 即可,如下 C:\Users\horn1\Desktop\python\4>pip install requestsCollecting ...
- Qt 之 QtConcurrent
本文以 Qt 中的 QtConcurrent::run() 函数为例,介绍如何将函数运行在单独的某一个线程中. 1 QtConcurrent::run() QtConcurrent 是一个命名空间, ...
- Jmeter--google plugin插件监控被測系统资源方法
一.插件准备 1.插件下载地址 http://jmeter-plugins.org/downloads/all/ 下面有两个版本号的.1.1.2和1.1.3.注意Jmeter版本号 1.1.2支持Jm ...
- hdu 4983 Goffi and GCD(数论)
题目链接:hdu 4983 Goffi and GCD 题目大意:求有多少对元组满足题目中的公式. 解题思路: n = 1或者k=2时:答案为1 k > 2时:答案为0(n≠1) k = 1时: ...
- 【PAT】1028. List Sorting (25)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1028 题目描述: Excel can sort records according to an ...
- 总想自己动动手系列·1·本地和外网(Liunx服务器上部署的web项目)按照自定义的报文格式进行交互(准备篇)
一.准备工作 (1)有一台属于自己的云服务器,并成功部署和发布一个web项目(当然,本质上来说Java-Project也没问题),通过外网IP可以正常访问该web项目. 需要说明的是:任何web项目, ...
- poj 1125 (floyed 最短路径)
Stockbroker Grapevine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26395 Accepted: ...
- python urllib2 httplib HTTPConnection
httplib实现了HTTP和HTTPS的客户端协议,一般不直接使用,在python更高层的封装模块中(urllib,urllib2)使用了它的http实现. import httplib conn ...