Docker 运行ELK

Elastic Stack

Elastic Stack and Product Documentation | Elastic

1
docker pull sebp/elk:642

运行

1
2
3
4
5
6
7
docker run -d \
--name elk-642 \
-e LOGSTASH_START=0 \
-e ES_HEAP_SIZE="1g" \
--network=elk \
-p 5601:5601 -p 9200:9200 -p 5044:5044 \
sebp/elk:642

单独安装

安装 elasticsearch

Install Elasticsearch with Docker | Elasticsearch Reference [6.5] | Elastic

1
docker pull elasticsearch:6.5.4

安装 elasticsearch-head 扩展

1
docker pull mobz/elasticsearch-head:5

安装 kibana

Running Kibana on Docker | Kibana User Guide [6.5] | Elastic

1
docker pull kibana:6.5.4

安装 logstash

1
docker pull logstash:6.5.4

安装 filebeat

1
docker pull filebeat:6.5.4

安装 metricbeat

1
docker pull docker.elastic.co/beats/metricbeat:6.5.4

docker-compose

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
version: '3'
services:
es-master:
depends_on:
- es-head
image: elasticsearch:6.5.4
container_name: es-master
environment:
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./conf/es-master.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
- ~/docker/elk/es-master/data:/usr/share/elasticsearch/data
- ~/docker/elasticsearch/es-master/plugins:/usr/share/elasticsearch/plugins
ports:
- 9200:9200
- "9300:9300"
networks:
- esnet
es-head:
image: mobz/elasticsearch-head:5
container_name: es-head
restart: always
ports:
- "9100:9100"
networks:
- esnet
kibana:
depends_on:
- es-master
image: kibana:6.5.4
container_name: kibana
volumes:
- ./conf/kibana.yml:/usr/share/kibana/config/kibana.yml:ro
ports:
- "5601:5601"
networks:
- esnet

networks:
esnet:

文件配置

1
mkdir conf

conf/es-master.yml

1
2
3
4
5
6
7
8
9
10
11
12
cluster.name: es-cluster
node.name: es-master
node.master: true
node.data: true
bootstrap.memory_lock: true
# discovery.zen.minimum_master_nodes: 1
# discovery.zen.ping.unicast.hosts: ["es-master", "es-node1"]
# discovery.zen.ping.unicast.hosts: ["es-master"]
network.host: es-master
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.monitoring.collection.enabled: true

conf/kibana.yml

1
2
3
4
server.name: kibana
server.host: "0.0.0.0"
elasticsearch.url: http://es-master:9200
# xpack.monitoring.ui.container.elasticsearch.enabled: true

启动

1
docker-compose up -d

Inspect status of cluster

1
curl http://127.0.0.1:9200/_cat/health

http://localhost:9200/_cat/health?v

http://localhost:9200/_cat/health?format=json&bytes=b

安装插件

查看已安装的插件

1
elasticsearch-plugin list

IK Analysis Plugin (作者 Medcl)

简介:大名鼎鼎的ik分词,都懂的!

1
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip

测试

1
curl -XPUT http://localhost:9200/index
1
2
3
4
curl -XGET "http://localhost:9200/index/_analyze" -H 'Content-Type: application/json' -d'
{
"text":"中华人民共和国MN","tokenizer": "ik_max_word"
}'

参考

ElasticSearch安装(以Docker的方式)

docker-compose安装elasticsearch集群

elasticsearch 6.3.2 集群配置

Kibana + ElasticSearch

ElasticSearch常用插件整理

Elasticsearch-RTF

Running the Elastic Stack on Docker | Getting Started [7.5] | Elastic

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. Elastic Stack
    1. 1.1. 单独安装
      1. 1.1.1. 安装 elasticsearch
      2. 1.1.2. 安装 elasticsearch-head 扩展
      3. 1.1.3. 安装 kibana
      4. 1.1.4. 安装 logstash
      5. 1.1.5. 安装 filebeat
      6. 1.1.6. 安装 metricbeat
      7. 1.1.7. docker-compose
    2. 1.2. 安装插件
      1. 1.2.1. IK Analysis Plugin (作者 Medcl)
    3. 1.3. 参考
,