怎么又是你

docker-compose启动elk失败,elasticsearch启动后仅能成功启动logstash或kibana其中一个,另一个卡启动

Logstash | 作者 youku | 发布于2019年07月23日 | 阅读数:8376

这次是尝试在win10的wsl下使用docker.之前尝试docker分别启动各个服务可以成功后,就想使用docker-compose构建启动elk套件.但是就遇到了标题的问题.
一开始使用 docker-compose up 启动遇到报错,
-------------------
root@ideapapa-PC:/mnt/c/dockerPath/elk# docker-compose up
WARNING: Some networks were defined but are not used by any service: elkNetwork
Creating network "elk_default" with the default driver
Creating elkes ...
Creating elkes ... done
Creating elkls ...
Creating elkkbn ...
Creating elkls
Creating elkkbn ... done
Attaching to elkes, elkls, elkkbn
elkes | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will li
kely be removed in a future release.
elkls | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will li
kely be removed in a future release.
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,097+0000", "level": "INFO", "component": "o.e.e.
NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "using [1] data paths, moun
ts [[/usr/share/elasticsearch/data (//10.0.75.1/C)]], net usable_space [579.4gb], net total_space [930.9gb], types [cifs
]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,128+0000", "level": "INFO", "component": "o.e.e.
NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "heap size [495.3mb], compr
essed ordinary object pointers [true]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,763+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "node name [818c7582e1fe], node ID [LE
jDFFoyQgWG5ugv2Zqq3Q], cluster name [docker-cluster]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,764+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "version[7.2.0], pid[1], build[default
/docker/508c38a/2019-06-20T15:54:18.811730Z], OS[Linux/4.9.125-linuxkit/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Se
rver VM/12.0.1/12.0.1+12]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,765+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "JVM home [/usr/share/elasticsearch/jd
k]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:49,766+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "JVM arguments [-Xms1g, -Xmx1g, -XX:+U
seConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.
ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encodin
g=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=tru
e, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.t
mpdir=/tmp/elasticsearch-16119863115666589816, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=log
s/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava
.locale.providers=COMPAT, -Des.cgroups.hierarchy.override=/, -Xms512m, -Xmx512m, -Dio.netty.allocator.type=unpooled, -XX
:MaxDirectMemorySize=268435456, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config,
-Des.distribution.flavor=default, -Des.distribution.type=docker, -Des.bundled_jdk=true]" }
elkls | WARNING: An illegal reflective access operation has occurred
elkls | WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/usr/share/logstash
/logstash-core/lib/jars/jruby-complete-9.2.7.0.jar) to field java.io.FileDescriptor.fd
elkls | WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
elkls | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
elkls | WARNING: All illegal access operations will be denied in a future release
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:59,983+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [aggs-matrix-
stats]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:59,984+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [analysis-com
mon]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:31:59,989+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [data-frame]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,017+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [ingest-commo
n]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,018+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [ingest-geoip
]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,019+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [ingest-user-
agent]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,030+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [lang-express
ion]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,049+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [lang-mustach
e]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,050+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [lang-painles
s]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,051+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [mapper-extra
s]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,052+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [parent-join]
" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,053+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [percolator]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,053+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [rank-eval]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,054+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [reindex]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,055+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [repository-u
rl]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,056+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [transport-ne
tty4]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,057+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-ccr]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,060+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-core]
" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,070+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-depre
cation]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,071+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-graph
]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,073+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-ilm]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,079+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-logst
ash]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,081+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-ml]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,084+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-monit
oring]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,086+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-rollu
p]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,090+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-secur
ity]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,091+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-sql]"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,092+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "loaded module [x-pack-watch
er]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:00,113+0000", "level": "INFO", "component": "o.e.p.
PluginsService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "no plugins loaded" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:24,589+0000", "level": "INFO", "component": "o.e.x.
s.a.s.FileRolesStore", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "parsed [0] roles from
file [/usr/share/elasticsearch/config/roles.yml]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:29,579+0000", "level": "INFO", "component": "o.e.x.
m.p.l.CppLogMessageHandler", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "[controller/101
] [Main.cc@110] controller (64 bit): Version 7.2.0 (Build 65aefcbfce449b) Copyright (c) 2019 Elasticsearch BV" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:32,764+0000", "level": "DEBUG", "component": "o.e.a
.ActionModule", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "Using REST wrapper from plug
in org.elasticsearch.xpack.security.Security" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:35,472+0000", "level": "INFO", "component": "o.e.d.
DiscoveryModule", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "using discovery type [sing
le-node] and seed hosts providers [settings]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:40,873+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "initialized" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:40,874+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "starting ..." }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:41,910+0000", "level": "INFO", "component": "o.e.t.
TransportService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "publish_address {172.20.0
.2:9300}, bound_addresses {0.0.0.0:9300}" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:42,178+0000", "level": "INFO", "component": "o.e.c.
c.Coordinator", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "cluster UUID [-0BbHqThT5SQi2
S1j6yQFg]" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:43,403+0000", "level": "INFO", "component": "o.e.c.
c.JoinHelper", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "failed to join {818c7582e1fe}
{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.machine_memory=2076532736, xpack.instal
led=true, ml.max_open_jobs=20} with JoinRequest{sourceNode={818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct8aSfR3YQ
}{172.20.0.2}{172.20.0.2:9300}{ml.machine_memory=2076532736, xpack.installed=true, ml.max_open_jobs=20}, optionalJoin=Op
tional[Join{term=16, lastAcceptedTerm=15, lastAcceptedVersion=139, sourceNode={818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR
1q5MIR96Jct8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.machine_memory=2076532736, xpack.installed=true, ml.max_open_jobs=2
0}, targetNode={818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.machine_me
mory=2076532736, xpack.installed=true, ml.max_open_jobs=20}}]}" ,
elkes | "stacktrace": ["org.elasticsearch.transport.RemoteTransportException: [818c7582e1fe][172.20.0.2:9300]
[internal:cluster/coordination/join]",
elkes | "Caused by: org.elasticsearch.cluster.coordination.CoordinationStateRejectedException: incoming term
16 does not match current term 17",
elkes | "at org.elasticsearch.cluster.coordination.CoordinationState.handleJoin(CoordinationState.java:218) ~
[elasticsearch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.cluster.coordination.Coordinator.handleJoin(Coordinator.java:942) ~[elasticsear
ch-7.2.0.jar:7.2.0]",
elkes | "at java.util.Optional.ifPresent(Optional.java:183) ~[?:?]",
elkes | "at org.elasticsearch.cluster.coordination.Coordinator.processJoinRequest(Coordinator.java:511) ~[ela
sticsearch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.cluster.coordination.Coordinator.handleJoinRequest(Coordinator.java:478) ~[elas
ticsearch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.cluster.coordination.JoinHelper.lambda$new$0(JoinHelper.java:124) ~[elasticsear
ch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredReque
stHandler$1.doRun(SecurityServerTransportInterceptor.java:250) [x-pack-security-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elastics
earch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredReque
stHandler.messageReceived(SecurityServerTransportInterceptor.java:308) [x-pack-security-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.
java:63) [elasticsearch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:703) [elasticsearch-7.
2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(Th
readContext.java:758) [elasticsearch-7.2.0.jar:7.2.0]",
elkes | "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elastics
earch-7.2.0.jar:7.2.0]",
elkes | "at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]",
elkes | "at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]",
elkes | "at java.lang.Thread.run(Thread.java:835) [?:?]"] }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:43,751+0000", "level": "INFO", "component": "o.e.c.
s.MasterService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "elected-as-master ([1] nod
es joined)[{818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.machine_memory
=2076532736, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 17
, version: 140, reason: master node changed {previous , current [{818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct
8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.machine_memory=2076532736, xpack.installed=true, ml.max_open_jobs=20}]}" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:44,791+0000", "level": "INFO", "component": "o.e.c.
s.ClusterApplierService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "message": "master node change
d {previous , current [{818c7582e1fe}{LEjDFFoyQgWG5ugv2Zqq3Q}{flR1q5MIR96Jct8aSfR3YQ}{172.20.0.2}{172.20.0.2:9300}{ml.
machine_memory=2076532736, xpack.installed=true, ml.max_open_jobs=20}]}, term: 17, version: 140, reason: Publication{ter
m=17, version=140}" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:45,240+0000", "level": "INFO", "component": "o.e.h.
AbstractHttpServerTransport", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "cluster.uuid": "-0BbHqThT5
SQi2S1j6yQFg", "node.id": "LEjDFFoyQgWG5ugv2Zqq3Q", "message": "publish_address {172.20.0.2:9200}, bound_addresses {0.0
.0.0:9200}" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:45,249+0000", "level": "INFO", "component": "o.e.n.
Node", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "cluster.uuid": "-0BbHqThT5SQi2S1j6yQFg", "node.id
": "LEjDFFoyQgWG5ugv2Zqq3Q", "message": "started" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:48,447+0000", "level": "INFO", "component": "o.e.l.
LicenseService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "cluster.uuid": "-0BbHqThT5SQi2S1j6yQFg"
, "node.id": "LEjDFFoyQgWG5ugv2Zqq3Q", "message": "license [1caaf2f0-d168-461d-8773-aa807cce62cb] mode [basic] - valid"
}
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:48,527+0000", "level": "INFO", "component": "o.e.g.
GatewayService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "cluster.uuid": "-0BbHqThT5SQi2S1j6yQFg"
, "node.id": "LEjDFFoyQgWG5ugv2Zqq3Q", "message": "recovered [5] indices into cluster_state" }
elkes | {"type": "server", "timestamp": "2019-07-23T09:32:58,529+0000", "level": "INFO", "component": "o.e.c.
r.a.AllocationService", "cluster.name": "docker-cluster", "node.name": "818c7582e1fe", "cluster.uuid": "-0BbHqThT5SQi2S1
j6yQFg", "node.id": "LEjDFFoyQgWG5ugv2Zqq3Q", "message": "Cluster health status changed from [RED] to [YELLOW] (reason:
[shards started [[.kibana_task_manager][0]] ...])." }
 
 
于是就指定服务一个个启动.但当es启动完成后,发现
logstash和kibana永远只能启动成功一个,另个一在attach命令就卡住不动,像被另一个阻塞.
elkls.png

kill先启动的容器时,另一个容器才继续输出日志

lskbn.png

困扰了2天的问题实在是找不到原因.不知道是哪出的错.有用docker构建elk的朋友可以分享下经验么?
下面我把配置文件贴出来,看下是不是有问题.
 
1.docker-compose.yml
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
ports:
- "9200:9200"
- "9300:9300"
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.type=single-node"
volumes:
- /c/dockerPath/elk/elasticsearch/config/:/usr/share/elasticsearch/config/
- /c/dockerPath/elk/elasticsearch/data/:/usr/share/elasticsearch/data/
- /c/dockerPath/elk/elasticsearch/logs/:/usr/share/elasticsearch/logs/
container_name: elkes
kibana:
image: docker.elastic.co/kibana/kibana:7.2.0
ports:
- "5601:5601"
volumes:
- /c/dockerPath/elk/kibana/config/:/usr/share/kibana/config/
container_name: elkkbn
links:
- "elasticsearch"
depends_on:
- elasticsearch
logstash:
image: docker.elastic.co/logstash/logstash:7.2.0
ports:
- "5044:5044"
- "9600:9600"
- "9601:9601"
volumes:
- /c/dockerPath/elk/logstash/config/:/usr/share/logstash/config/
container_name: elkls
links:
- "elasticsearch"
depends_on:
- elasticsearch


networks:
elkNetwork:
external: true

2.elasticsearch.yml
cluster.name: "docker-cluster"
network.host: 0.0.0.0



3.kibana.yml
#
# ** THIS IS AN AUTO-GENERATED FILE **
#

# Default Kibana configuration for docker target
server.name: kibana
server.host: "0"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
i18n.locale: zh-CN
xpack.monitoring.ui.container.elasticsearch.enabled: true

4.logstash.conf
# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.

input {
beats {
port => 5044
}
tcp {
host => "0.0.0.0"
port => 9601
mode => "server"
tags => ["tags"]
codec => json_lines
}

}

output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
index => "server-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
}
stdout { codec => rubydebug }
}



5.logstash.yml
http.host: "0.0.0.0"
xpack.monitoring.elasticsearch.hosts: [ "http://elasticsearch:9200" ]



6.pipelines.yml
# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
# https://www.elastic.co/guide/e ... .html

- pipeline.id: main
path.config: "/usr/share/logstash/config/logstash.conf"
pipeline.workers: 3



 
 
 
 
已邀请:

l769829723

赞同来自:

你是否可以为每个容器增加一个确定的hostname,例如:
hostname: elasticsearch
还有你可以使用link方式,将这三个容器链接到一起,这样可以试下,会不会有一些改善?

youku

赞同来自:

docker单独启3个容器和使用compose启3个服务需要的资源会不一样么
TIM截图20190725091908.png

 

要回复问题请先登录注册