docker-compose安装elk
# 安装文件
version: "3"
services:
es-master:
container_name: es-master
hostname: es-master
image: elasticsearch:7.12.1
restart: always
ports:
- 9200:9200
- 9300:9300
volumes:
- ./elasticsearch/master/conf/es-master.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/elk/es-master/data:/usr/share/elasticsearch/data
- /data/elk/es-master/logs:/usr/share/elasticsearch/logs
- /etc/localtime:/etc/localtime
- ./elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
environment:
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
es-slave1:
container_name: es-slave1
image: elasticsearch:7.12.1
restart: always
ports:
- 9201:9200
#- 9301:9300
volumes:
- ./elasticsearch/slave1/conf/es-slave1.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/elk/es-slave1/data:/usr/share/elasticsearch/data
- /data/elk/es-slave1/logs:/usr/share/elasticsearch/logs
- /etc/localtime:/etc/localtime
- ./elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
environment:
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
es-slave2:
container_name: es-slave2
image: elasticsearch:7.12.1
restart: always
ports:
- 9202:9200
#- 9302:9300
volumes:
- ./elasticsearch/slave2/conf/es-slave2.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/elk/es-slave2/data:/usr/share/elasticsearch/data
- /data/elk/es-slave2/logs:/usr/share/elasticsearch/logs
- /etc/localtime:/etc/localtime
- ./elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
environment:
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
kibana:
container_name: kibana
hostname: kibana
image: kibana:7.12.1
restart: always
ports:
- 5601:5601
volumes:
- ./kibana/conf/kibana.yml:/usr/share/kibana/config/kibana.yml
- /etc/localtime:/etc/localtime
environment:
- elasticsearch.hosts=http://es-master:9200
depends_on:
- es-master
- es-slave1
- es-slave2
logstash:
container_name: logstash
hostname: logstash
image: logstash:7.12.1
command: logstash -f ./conf/logstash-kafka.conf
restart: always
volumes:
# 映射到容器中
- ./logstash/conf/logstash-kafka.conf:/usr/share/logstash/conf/logstash-kafka.conf
- ./logstash/ssl:/usr/share/logstash/ssl
- ./logstash/template:/template
environment:
- elasticsearch.hosts=http://es-master:9200
- /etc/localtime:/etc/localtime
# 解决logstash监控连接报错
- xpack.monitoring.elasticsearch.hosts=http://es-master:9200
- xpack.monitoring.elasticsearch.username="logstash_system"
- xpack.monitoring.elasticsearch.password="xxx"
ports:
- 5044:5044
depends_on:
- es-master
- es-slave1
- es-slave2
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
上次更新: 2023/01/31, 21:32:57