Skip to content

Commit

Permalink
Merge pull request onebirdrocks#4 from onebirdrocks/master
Browse files Browse the repository at this point in the history
更新
  • Loading branch information
geektime-geekbang authored Jul 9, 2019
2 parents 9f1f5c2 + 8b46d36 commit a7cdc51
Show file tree
Hide file tree
Showing 41 changed files with 2,230 additions and 124 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
5. 单字符串多字段查询:Dis Max Query
6. 单字符串多字段查询:Multi Match
7. 多语言及中文分词与检索
8. Space Jam,一次全文搜索的实例
8. Space Jam,一次全文搜索的实例
9. 使用 Search Template 和 Index Alias 查询
10. 综合排序:Function Score Query 优化算分
11. Term & Phrase Suggester
Expand All @@ -58,9 +58,9 @@
### 第 7 章:数据建模
1. 对象及 Nested 对象
2. 文档的父子关系
3. Update By Query & Reindex API
4. Ingest Pipeline & Painless Script
5. Elasticsearch 数据建模最佳实践
3. Elasticsearch 数据建模最佳实践
4. Update By Query & Reindex API
5. Ingest Pipeline & Painless Script
6. 第二部分总结回顾
## 第三部分:管理 Elasticsearch 集群
### 第 8 章:保护你的数据
Expand Down Expand Up @@ -95,7 +95,7 @@
1. 使用 Index Pattern 配置数据
2. 使用 Kibana Discover 探索数据
3. 基本可视化组件介绍
4. Visual Builder 介绍
4. Visual Builder 介绍
5. 构建 Dashboard
## 第 14 章:探索 X-Pack 套件
1. 用 Monitoring 和 Alerting 监控 Elasticsearch 集群
Expand All @@ -117,3 +117,6 @@
### 备战:Elastic 认证
1. Elastic 认证介绍
2. 考点梳理

# ELK 相关下载资源
1. ELK 7.x 推荐官网直接下载,如网速低,可使用以下链接 - 百度网盘下载(https://pan.baidu.com/s/1CRT3W4wEESglCBDnslk2AA)
19 changes: 11 additions & 8 deletions part-1/2.1-Elasticsearch的安装与简单配置/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
# Elasticsearch 的安装与简单配置
## 课程Demo
```
//启动单节点
#启动单节点
bin/elasticsearch -E node.name=node0 -E cluster.name=geektime -E path.data=node0_data
//安装插件
#安装插件
bin/elasticsearch-plugin install analysis-icu
//查看插件
#查看插件
bin/elasticsearch-plugin list
//查看安装的插件
#查看安装的插件
GET http://localhost:9200/_cat/plugins?v
//start multi-nodes Cluster
#start multi-nodes Cluster
bin/elasticsearch -E node.name=node0 -E cluster.name=geektime -E path.data=node0_data
bin/elasticsearch -E node.name=node1 -E cluster.name=geektime -E path.data=node1_data
bin/elasticsearch -E node.name=node2 -E cluster.name=geektime -E path.data=node2_data
bin/elasticsearch -E node.name=node3 -E cluster.name=geektime -E path.data=node3_data
//查看集群
#查看集群
GET http://localhost:9200
//查看nodes
#查看nodes
GET _cat/nodes
GET _cluster/health
```
## 相关阅读
- https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
- 安装指南 https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.
- Elastic Support Matrix(OS / JDK ) https://www.elastic.co/cn/support/matrix
- Elasticsearch 的一些重要配置 https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html
- https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html
- https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html
- Elasticsearch on Kuvernetes https://www.elastic.co/cn/blog/introducing-elastic-cloud-on-kubernetes-the-elasticsearch-operator-and-beyond
Expand Down
4 changes: 2 additions & 2 deletions part-1/2.2-Kibana的安装与界面快速浏览/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Kibana 的安装与界面快速浏览
## 课程Demo
```
//启动kibana
#启动kibana
bin/kibana
//查看插件
#查看插件
bin/kibana-plugin list
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
进入 7.x-docker-2-es-instance目录

```
//启动
#启动
docker-compose up
//停止容器
#停止容器
docker-compose down
//停止容器并且移除数据
#停止容器并且移除数据
docker-compose down -v
//一些docker 命令
#一些docker 命令
docker ps
docker stop Name/ContainerId
docker start Name/ContainerId
删除单个容器
#删除单个容器
$docker rm Name/ID
-f, –force=false; -l, –link=false Remove the specified link and not the underlying container; -v, –volumes=false Remove the volumes associated to the container
删除所有容器
#删除所有容器
$docker rm `docker ps -a -q`
停止、启动、杀死、重启一个容器
$docker stop Name/ID
Expand All @@ -39,3 +39,4 @@ $docker restart name/ID
- 如何设置 Docker 网络 - https://www.elastic.co/cn/blog/docker-networking
- Cerebro 源码 https://github.com/lmenezes/cerebro
- 一个开源的 ELK(Elasticsearch + Logstash + Kibana) docker-compose 配置 https://github.com/deviantony/docker-elk
- Install Elasticsearch with Docker https://www.elastic.co/guide/en/elasticsearch/reference/7.2/docker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
version: '2.2'
services:
cerebro:
image: lmenezes/cerebro:0.8.3
container_name: cerebro
ports:
- "9000:9000"
command:
- -Dhosts.0.host=http://elasticsearch:9200
networks:
- es72net
kibana:
image: docker.elastic.co/kibana/kibana:7.2.0
container_name: kibana72
environment:
#- I18N_LOCALE=zh-CN
- XPACK_GRAPH_ENABLED=true
- TIMELION_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED="true"
ports:
- "5601:5601"
networks:
- es72net
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es72_01
environment:
- cluster.name=geektime
- node.name=es72_01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=es72_01
- network.publish_host=elasticsearch
- cluster.initial_master_nodes=es72_01,es72_02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es72data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- es72net
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es72_02
environment:
- cluster.name=geektime
- node.name=es72_02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=es72_01
- network.publish_host=elasticsearch
- cluster.initial_master_nodes=es72_01,es72_02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es72data2:/usr/share/elasticsearch/data
networks:
- es72net


volumes:
es72data1:
driver: local
es72data2:
driver: local

networks:
es72net:
driver: bridge
8 changes: 4 additions & 4 deletions part-1/2.4-Logstash安装与导入数据/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
- movielens/logstash6.conf //logstash 6.x 配置文件

```
//下载与ES相同版本号的logstash,(7.1.0),并解压到相应目录
//修改movielens目录下的logstash.conf文件
//path修改为,你实际的movies.csv路径
#下载与ES相同版本号的logstash,(7.1.0),并解压到相应目录
#修改movielens目录下的logstash.conf文件
#path修改为,你实际的movies.csv路径
input {
file {
path => "YOUR_FULL_PATH_OF_movies.csv"
Expand All @@ -18,7 +18,7 @@ input {
}
}
//启动Elasticsearch实例,然后启动 logstash,并制定配置文件导入数据
#启动Elasticsearch实例,然后启动 logstash,并制定配置文件导入数据
bin/logstash -f /YOUR_PATH_of_logstash.conf
```
Expand Down
18 changes: 9 additions & 9 deletions part-1/3.1-基本概念1索引文档和RESTAPI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@

Index 相关 API
```
//查看索引相关信息
#查看索引相关信息
GET kibana_sample_data_ecommerce
//查看索引的文档总数
#查看索引的文档总数
GET kibana_sample_data_ecommerce/_count
//查看前10条文档,了解文档格式
#查看前10条文档,了解文档格式
POST kibana_sample_data_ecommerce/_search
{
}
//_cat indices API
//查看indices
#_cat indices API
#查看indices
GET /_cat/indices/kibana*?v&s=index
//查看状态为绿的索引
#查看状态为绿的索引
GET /_cat/indices?v&health=green
//按照文档个数排序
#按照文档个数排序
GET /_cat/indices?v&s=docs.count:desc
//查看具体的字段
#查看具体的字段
GET /_cat/indices/kibana*?pri&v&h=health,index,pri,rep,docs.count,mt
//How much memory is used per index?
#How much memory is used per index?
GET /_cat/indices?v&h=i,tm&s=tm:desc
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ strict
//写入文档,查看 Mapping
#写入文档,查看 Mapping
PUT mapping_test/_doc/1
{
"firstName":"Chan",
"lastName": "Jackie",
"loginDate":"2018-07-24T10:29:48.103Z"
}
//查看 Mapping文件
#查看 Mapping文件
GET mapping_test/_mapping
//Delete index
#Delete index
DELETE mapping_test
//dynamic mapping,推断字段的类型
#dynamic mapping,推断字段的类型
PUT mapping_test/_doc/1
{
"uid" : "123",
Expand All @@ -46,17 +46,17 @@ PUT mapping_test/_doc/1
"heigh":180
}
//查看 Dynamic
#查看 Dynamic
GET mapping_test/_mapping
//默认Mapping支持dynamic,写入的文档中加入新的字段
#默认Mapping支持dynamic,写入的文档中加入新的字段
PUT dynamic_mapping_test/_doc/1
{
"newField":"someValue"
}
//该字段可以被搜索,数据也在_source中出现
#该字段可以被搜索,数据也在_source中出现
POST dynamic_mapping_test/_search
{
"query":{
Expand All @@ -67,20 +67,20 @@ POST dynamic_mapping_test/_search
}
//修改为dynamic false
#修改为dynamic false
PUT dynamic_mapping_test/_mapping
{
"dynamic": false
}
//新增 anotherField
#新增 anotherField
PUT dynamic_mapping_test/_doc/10
{
"anotherField":"someValue"
}
//该字段不可以被搜索,应为dynamic已经被设置为false
#该字段不可以被搜索,应为dynamic已经被设置为false
POST dynamic_mapping_test/_search
{
"query":{
Expand All @@ -92,15 +92,15 @@ POST dynamic_mapping_test/_search
get dynamic_mapping_test/_doc/10
//修改为strict
#修改为strict
PUT dynamic_mapping_test/_mapping
{
"dynamic": "strict"
}
//写入数据出错,HTTP Code 400
#写入数据出错,HTTP Code 400
PUT dynamic_mapping_test/_doc/12
{
"lastField":"value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## 课程Demos
```
//设置 index 为 false
#设置 index 为 false
DELETE users
PUT users
{
Expand Down Expand Up @@ -41,7 +41,7 @@ POST /users/_search
//设定Null_value
#设定Null_value
DELETE users
PUT users
Expand Down Expand Up @@ -90,7 +90,7 @@ GET users/_search
//设置 Copy to
#设置 Copy to
DELETE users
PUT users
{
Expand Down Expand Up @@ -128,7 +128,7 @@ POST users/_search
}
//数组类型
#数组类型
PUT users/_doc/1
{
"name":"onebird",
Expand Down
Loading

0 comments on commit a7cdc51

Please sign in to comment.