Skip to content

Commit 3acc61e

Browse files
committed
update docs
1 parent 157d49d commit 3acc61e

30 files changed

+4039
-65
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
- [Redis 复制](docs/nosql/redis/redis-replication.md)
5454
- [Redis 哨兵](docs/nosql/redis/redis-sentinel.md)
5555
- [Redis 集群](docs/nosql/redis/redis-cluster.md)
56-
- [Redis 事务](docs/nosql/redis/redis-transaction.md)
5756
- [Redis 发布与订阅](docs/nosql/redis/redis-pub-sub.md)
5857
- [Redis 运维](docs/nosql/redis/redis-ops.md) 🔨
5958

@@ -106,6 +105,6 @@
106105
- [CRUG | Redisson PRO vs. Jedis: Which Is Faster? 翻译](https://www.jianshu.com/p/82f0d5abb002)
107106
- [redis 分布锁 Redisson 性能测试](https://blog.csdn.net/everlasting_188/article/details/51073505)
108107

109-
## 🚪 传送门
108+
## 🚪 传送
110109

111110
◾ 🏠 [LINUX-TUTORIAL 首页](https://github.com/dunwu/linux-tutorial) ◾ 🎯 [我的博客](https://github.com/dunwu/blog)

assets/Nosql数据库.xmind

1 Byte
Binary file not shown.

assets/mysql/Mysql.xmind

-1.17 KB
Binary file not shown.

docs/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ footer: CC-BY-SA-4.0 Licensed | Copyright © 2018-Now Dunwu
5454
- [Redis 复制](nosql/redis/redis-replication.md)
5555
- [Redis 哨兵](nosql/redis/redis-sentinel.md)
5656
- [Redis 集群](nosql/redis/redis-cluster.md)
57-
- [Redis 事务](nosql/redis/redis-transaction.md)
5857
- [Redis 发布与订阅](nosql/redis/redis-pub-sub.md)
5958
- [Redis 运维](nosql/redis/redis-ops.md) 🔨
6059

@@ -110,3 +109,10 @@ footer: CC-BY-SA-4.0 Licensed | Copyright © 2018-Now Dunwu
110109
## 🚪 传送门
111110

112111
◾ 🏠 [LINUX-TUTORIAL 首页](https://github.com/dunwu/linux-tutorial) ◾ 🎯 [我的博客](https://github.com/dunwu/blog)
112+
113+
114+
115+
116+
117+
118+

docs/nosql/elasticsearch/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Java 和搜索引擎
2+
3+
## 📖 内容
4+
5+
### ElasticSearch
6+
7+
> [ElasticSearch](https://www.elastic.co/products/elasticsearch) 是一个基于 [Lucene](http://lucene.apache.org/core/documentation.html) 构建的开源,分布式,RESTful 搜索引擎。
8+
9+
- [ElasticSearch 入门指南](elasticsearch/elasticsearch.md)
10+
- [ElasticSearch 运维](nosql/elasticsearch/elasticsearch-ops.md)
11+
12+
### Elastic 技术栈
13+
14+
> **Elastic 技术栈通常被用来作为日志采集、检索、可视化解决方案。**
15+
>
16+
> ELK 是 elastic 公司旗下三款产品 [ElasticSearch](https://www.elastic.co/products/elasticsearch)[Logstash](https://www.elastic.co/products/logstash)[Kibana](https://www.elastic.co/products/kibana) 的首字母组合。
17+
>
18+
> [Logstash](https://www.elastic.co/products/logstash) 传输和处理你的日志、事务或其他数据。
19+
>
20+
> [Kibana](https://www.elastic.co/products/kibana) 将 Elasticsearch 的数据分析并渲染为可视化的报表。
21+
>
22+
> Elastic 技术栈,在 ELK 的基础上扩展了一些新的产品,如:[Beats](https://www.elastic.co/products/beats)[X-Pack](https://www.elastic.co/products/x-pack)
23+
24+
- [Elastic 技术栈快速入门](nosql/elasticsearch/elastic/elastic-quickstart.md)
25+
- [Beats 入门指南](nosql/elasticsearch/elastic/elastic-beats.md)
26+
- [Beats 运维](nosql/elasticsearch/elastic/elastic-beats-ops.md)
27+
- [Kibana 入门指南](nosql/elasticsearch/elastic/elastic-kibana.md)
28+
- [Kibana 运维](nosql/elasticsearch/elastic/elastic-kibana-ops.md)
29+
- [Logstash 入门指南](nosql/elasticsearch/elastic/elastic-logstash.md)
30+
- [Logstash 运维](nosql/elasticsearch/elastic/elastic-logstash-ops.md)
31+
32+
## 📚 资料
33+
34+
- **官方**
35+
- [Elasticsearch 官网](https://www.elastic.co/cn/products/elasticsearch)
36+
- [Elasticsearch Github](https://github.com/elastic/elasticsearch)
37+
- [Elasticsearch 官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)
38+
- [Logstash 官网](https://www.elastic.co/cn/products/logstash)
39+
- [Logstash Github](https://github.com/elastic/logstash)
40+
- [Logstash 官方文档](https://www.elastic.co/guide/en/logstash/current/index.html)
41+
- [Kibana 官网](https://www.elastic.co/cn/products/kibana)
42+
- [Kibana Github](https://github.com/elastic/kibana)
43+
- [Kibana 官方文档](https://www.elastic.co/guide/en/kibana/current/index.html)
44+
- [Beats 官网](https://www.elastic.co/cn/products/beats)
45+
- [Beats Github](https://github.com/elastic/beats)
46+
- [Beats 官方文档](https://www.elastic.co/guide/en/beats/libbeat/current/index.html)
47+
- **第三方工具**
48+
- [logstash-logback-encoder](https://github.com/logstash/logstash-logback-encoder)
49+
- **教程**
50+
- [Elasticsearch 权威指南(中文版)](https://es.xiaoleilu.com/index.html)
51+
- [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn)
52+
- **博文**
53+
- [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html)
54+
- [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md)
55+
56+
## 🚪 传送
57+
58+
◾ 🏠 [JAVACORE 首页](https://github.com/dunwu/javatech) ◾ 🎯 [我的博客](https://github.com/dunwu/blog)
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
# Filebeat 运维
2+
3+
> Beats 平台集合了多种单一用途数据采集器。它们从成百上千或成千上万台机器和系统向 Logstash 或 Elasticsearch 发送数据。
4+
>
5+
> 因为我只接触过 Filebeat,所有本文仅介绍 Filebeat 的日常运维。
6+
7+
## 1. Filebeat 安装
8+
9+
### 1.1. 环境要求
10+
11+
> 版本:Elastic Stack 7.4
12+
13+
### 1.2. 安装步骤
14+
15+
Unix / Linux 系统建议使用下面方式安装,因为比较通用。
16+
17+
```
18+
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.1.1-linux-x86_64.tar.gz
19+
tar -zxf filebeat-6.1.1-linux-x86_64.tar.gz
20+
```
21+
22+
> 更多内容可以参考:[filebeat-installation](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation.html)
23+
24+
## 2. Filebeat 配置
25+
26+
> 首先,必须要知道的是:`filebeat.yml` 是 filebeat 的配置文件。其路径会因为你安装方式而有所不同。
27+
>
28+
> Beat 所有系列产品的配置文件都基于 [YAML](http://www.yaml.org/) 格式,FileBeat 当然也不例外。
29+
>
30+
> 更多 filebeat 配置内容可以参考:[配置 filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html)
31+
>
32+
> 更多 filebeat.yml 文件格式内容可以参考:[filebeat.yml 文件格式](https://www.elastic.co/guide/en/beats/libbeat/6.1/config-file-format.html)
33+
34+
filebeat.yml 部分配置示例:
35+
36+
```yml
37+
filebeat:
38+
prospectors:
39+
- type: log
40+
paths:
41+
- /var/log/*.log
42+
multiline:
43+
pattern: '^['
44+
match: after
45+
```
46+
47+
### 2.1. 重要配置项
48+
49+
> 下面我将列举 Filebeat 的较为重要的配置项。
50+
>
51+
> 如果想了解更多配置信息,可以参考:
52+
>
53+
> 更多 filebeat 配置内容可以参考:[配置 filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html)
54+
>
55+
> 更多 filebeat.yml 文件格式内容可以参考:[filebeat.yml 文件格式](https://www.elastic.co/guide/en/beats/libbeat/6.1/config-file-format.html)
56+
57+
#### 2.1.1. filebeat.prospectors
58+
59+
(文件监视器)用于指定需要关注的文件。
60+
61+
**示例**
62+
63+
```yaml
64+
filebeat.prospectors:
65+
- type: log
66+
enabled: true
67+
paths:
68+
- /var/log/*.log
69+
```
70+
71+
#### 2.1.2. output.elasticsearch
72+
73+
如果你希望使用 filebeat 直接向 elasticsearch 输出数据,需要配置 output.elasticsearch 。
74+
75+
**示例**
76+
77+
```yaml
78+
output.elasticsearch:
79+
hosts: ['192.168.1.42:9200']
80+
```
81+
82+
#### 2.1.3. output.logstash
83+
84+
如果你希望使用 filebeat 向 logstash 输出数据,然后由 logstash 再向 elasticsearch 输出数据,需要配置 output.logstash。
85+
86+
> **注意**
87+
>
88+
> 相比于向 elasticsearch 输出数据,个人更推荐向 logstash 输出数据。
89+
>
90+
> 因为 logstash 和 filebeat 一起工作时,如果 logstash 忙于处理数据,会通知 FileBeat 放慢读取速度。一旦拥塞得到解决,FileBeat 将恢复到原来的速度并继续传播。这样,可以减少管道超负荷的情况。
91+
92+
**示例**
93+
94+
```yaml
95+
output.logstash:
96+
hosts: ['127.0.0.1:5044']
97+
```
98+
99+
此外,还需要在 logstash 的配置文件(如 logstash.conf)中指定 beats input 插件:
100+
101+
```yaml
102+
input {
103+
beats {
104+
port => 5044 # 此端口需要与 filebeat.yml 中的端口相同
105+
}
106+
}
107+
108+
# The filter part of this file is commented out to indicate that it is
109+
# optional.
110+
# filter {
111+
#
112+
# }
113+
114+
output {
115+
elasticsearch {
116+
hosts => "localhost:9200"
117+
manage_template => false
118+
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
119+
document_type => "%{[@metadata][type]}"
120+
}
121+
}
122+
```
123+
124+
#### 2.1.4. setup.kibana
125+
126+
如果打算使用 Filebeat 提供的 Kibana 仪表板,需要配置 setup.kibana 。
127+
128+
**示例**
129+
130+
```yaml
131+
setup.kibana:
132+
host: 'localhost:5601'
133+
```
134+
135+
#### 2.1.5. setup.template.settings
136+
137+
在 Elasticsearch 中,[索引模板](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/indices-templates.html)用于定义设置和映射,以确定如何分析字段。
138+
139+
在 Filebeat 中,setup.template.settings 用于配置索引模板。
140+
141+
Filebeat 推荐的索引模板文件由 Filebeat 软件包安装。如果您接受 filebeat.yml 配置文件中的默认配置,Filebeat 在成功连接到 Elasticsearch 后自动加载模板。
142+
143+
您可以通过在 Filebeat 配置文件中配置模板加载选项来禁用自动模板加载,或加载自己的模板。您还可以设置选项来更改索引和索引模板的名称。
144+
145+
> **参考**
146+
>
147+
> 更多内容可以参考:[filebeat-template](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-template.html)
148+
>
149+
> **说明**
150+
>
151+
> 如无必要,使用 Filebeat 配置文件中的默认索引模板即可。
152+
153+
#### 2.1.6. setup.dashboards
154+
155+
Filebeat 附带了示例 Kibana 仪表板。在使用仪表板之前,您需要创建索引模式 `filebeat- *`,并将仪表板加载到 Kibana 中。为此,您可以运行 `setup` 命令或在 `filebeat.yml` 配置文件中配置仪表板加载。
156+
157+
为了在 Kibana 中加载 Filebeat 的仪表盘,需要在 `filebeat.yml` 配置中启动开关:
158+
159+
```
160+
setup.dashboards.enabled: true
161+
```
162+
163+
> **参考**
164+
>
165+
> 更多内容可以参考:[configuration-dashboards](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-dashboards.html)
166+
167+
## 3. Filebeat 命令
168+
169+
filebeat 提供了一系列命令来完成各种功能。
170+
171+
执行命令方式:
172+
173+
```bash
174+
./filebeat COMMAND
175+
```
176+
177+
> **参考**
178+
>
179+
> 更多内容可以参考:[command-line-options](https://www.elastic.co/guide/en/beats/filebeat/current/command-line-options.html)
180+
>
181+
> **说明**
182+
>
183+
> 个人认为命令行没有必要一一掌握,因为绝大部分功能都可以通过配置来完成。且通过命令行指定功能这种方式要求每次输入同样参数,不利于固化启动方式。
184+
>
185+
> 最重要的当然是启动命令 run 了。
186+
>
187+
> **示例** 指定配置文件启动
188+
>
189+
> ```bash
190+
> ./filebeat run -e -c filebeat.yml -d "publish"
191+
> ./filebeat -e -c filebeat.yml -d "publish" # run 可以省略
192+
> ```
193+
194+
## 4. Filebeat 模块
195+
196+
> [Filebeat](https://www.elastic.co/cn/products/beats/filebeat) 和 [Metricbeat](https://www.elastic.co/cn/products/beats/metricbeat) 内部集成了一系列模块,用以简化常见日志格式(例如 NGINX、Apache 或诸如 Redis 或 Docker 等系统指标)的收集、解析和可视化过程。
197+
198+
- 配置 elasticsearch 和 kibana
199+
200+
```
201+
output.elasticsearch:
202+
hosts: ["myEShost:9200"]
203+
username: "elastic"
204+
password: "elastic"
205+
setup.kibana:
206+
host: "mykibanahost:5601"
207+
username: "elastic"
208+
password: "elastic
209+
```
210+
211+
> username 和 password 是可选的,如果不需要认证则不填。
212+
213+
- 初始化环境
214+
215+
执行下面命令,filebeat 会加载推荐索引模板。
216+
217+
```
218+
./filebeat setup -e
219+
```
220+
221+
- 指定模块
222+
223+
执行下面命令,指定希望加载的模块。
224+
225+
```
226+
./filebeat -e --modules system,nginx,mysql
227+
```
228+
229+
> 更多内容可以参考:
230+
>
231+
> - [配置 filebeat 模块](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-filebeat-modules.html)
232+
> - [filebeat 支持模块](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-modules.html)
233+
234+
## 5. 参考资料
235+
236+
- [Beats 官网](https://www.elastic.co/cn/products/beats)
237+
- [Beats Github](https://github.com/elastic/beats)
238+
- [Beats 官方文档](https://www.elastic.co/guide/en/beats/libbeat/current/index.html)

0 commit comments

Comments
 (0)