gpt4 book ai didi

elasticsearch - Docker-compose.yml 不适用于 elasticsearch

转载 作者:行者123 更新时间:2023-11-29 02:52:41 26 4
gpt4 key购买 nike

使用的版本:

Docker-compose = 1.3.2
Docker = 1.12.3
Os: Ubuntu-14.04LTS

1:撰写文件内容:

docker-compose.yml

elk: 
image: elasticsearch:latest
ports:
- "9200:9200"
- "9300:9300"
volumes:
- ./Elasticsearch/data:/etc/elasticsearch/data
- ./Elasticsearch/config/elasticsearch.yml:/etc/elasticsearch/config/elasticsearch.yml
command: bash -c "service elasticsearch start"
tty : true

2: $ 运行撰写文件:

docker-compose up

获得关注:

Attaching to elkdockerdir_elk_1
elk_1 | [2016-11-14T06:28:18,458][INFO ][o.e.n.Node ] [] initializing ...
elk_1 | [2016-11-14T06:28:18,573][INFO ][o.e.e.NodeEnvironment ] [UERHECj] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda6)]], net usable_space [409.6gb], net total_space [442.8gb], spins? [possibly], types [ext4]
elk_1 | [2016-11-14T06:28:18,573][INFO ][o.e.e.NodeEnvironment ] [UERHECj] heap size [1.9gb], compressed ordinary object pointers [true]
elk_1 | [2016-11-14T06:28:18,576][INFO ][o.e.n.Node ] [UERHECj] node name [UERHECj] derived from node ID; set [node.name] to override
elk_1 | [2016-11-14T06:28:18,579][INFO ][o.e.n.Node ] [UERHECj] version[5.0.0], pid[1], build[253032b/2016-10-26T05:11:34.737Z], OS[Linux/3.13.0-32-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111/25.111-b14]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [aggs-matrix-stats]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [ingest-common]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [lang-expression]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [lang-groovy]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [lang-mustache]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [lang-painless]
elk_1 | [2016-11-14T06:28:19,066][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [percolator]
elk_1 | [2016-11-14T06:28:19,067][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [reindex]
elk_1 | [2016-11-14T06:28:19,067][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [transport-netty3]
elk_1 | [2016-11-14T06:28:19,067][INFO ][o.e.p.PluginsService ] [UERHECj] loaded module [transport-netty4]
elk_1 | [2016-11-14T06:28:19,067][INFO ][o.e.p.PluginsService ] [UERHECj] no plugins loaded
elk_1 | [2016-11-14T06:28:19,149][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
elk_1 | [2016-11-14T06:28:20,424][INFO ][o.e.n.Node ] [UERHECj] initialized
elk_1 | [2016-11-14T06:28:20,424][INFO ][o.e.n.Node ] [UERHECj] starting ...
elk_1 | [2016-11-14T06:28:20,571][INFO ][o.e.t.TransportService ] [UERHECj] publish_address {172.17.0.2:9300}, bound_addresses {[::]:9300}
elk_1 | [2016-11-14T06:28:20,576][INFO ][o.e.b.BootstrapCheck ] [UERHECj] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
elk_1 | ERROR: bootstrap checks failed
elk_1 | max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
elk_1 | [2016-11-14T06:28:20,587][INFO ][o.e.n.Node ] [UERHECj] stopping ...
elk_1 | [2016-11-14T06:28:20,608][INFO ][o.e.n.Node ] [UERHECj] stopped
elk_1 | [2016-11-14T06:28:20,608][INFO ][o.e.n.Node ] [UERHECj] closing ...
elk_1 | [2016-11-14T06:28:20,620][INFO ][o.e.n.Node ] [UERHECj] closed
elkdockerdir_elk_1 exited with code 78
Gracefully stopping... (press Ctrl+C again to force)

3: $ 检查容器:

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a8799b8fe969 elasticsearch:latest "/docker-entrypoint.s" About a minute ago Exited (78) About a minute ago elkdockerdir_elk_1

部分解决方案:

service elasticsearch 没有继续运行,所以在添加 bash -c "service elasticsearch start && tail -f/dev/null 后它工作正常,请在 $ docker ps -a

之后检查
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                       PORTS                              NAMES
bfbc12a69a8a elasticsearch:latest "/docker-entrypoint.s" 13 seconds ago Up 12 seconds 0.0.0.0:9200->9200/tcp, 9300/tcp elkdockerdir_elk_1

正在运行,但是在使用 curl 测试 elasticsearch 时:$ curl 'http://localhost:9200/?pretty'它给出的错误如下:curl: (56) Recv failure: 连接被对端重置
另外 http://localhost:9200 不工作...

没有得到确切的问题...

问题:

1:如何使用命令运行 docker-compose.yml,即 command: bash -c "service elasticsearch start" 对于给定的 docker-compose 和 docker 版本?

最佳答案

看起来这是 command 语句中的 docker-compose.yml 中的一个小错误。

更改自:

command: bash -c "service elasticsearch start"

收件人:

command: service elasticsearch start

command: [service, elasticsearch, start]

更新:基于评论。

看起来在这种情况下不需要 command 语句。
docker-compose.yml 中完全删除了 command 语句并重新运行 docker-compose up 命令。

docker-compose.yml:

elk: 
image: elasticsearch:latest
ports:
- "9200:9200"
- "9300:9300"
tty : true

docker-compose up
Creating cmp1_elk_1
Attaching to cmp1_elk_1
elk_1 | -14T09:28:12,095][INFO ][o.e.n.Node ] [] initializing ...
elk_1 | -14T09:28:14,167][INFO ][o.e.e.NodeEnvironment ] [9KYASyV] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda2)]], net usable_space [44.1gb], net total_space [55.1gb], spins? [possibly], types [ext4]
elk_1 | [2016-11-14T09:28:14,168][INFO ][o.e.e.NodeEnvironment ] [9KYASyV] heap size [1.9gb], compressed ordinary object pointers [true]
elk_1 | [2016-11-14T09:28:14,174][INFO ][o.e.n.Node ] [9KYASyV] node name [9KYASyV] derived from node ID; set [node.name] to override
elk_1 | [2016-11-14T09:28:14,286][INFO ][o.e.n.Node ] [9KYASyV] version[5.0.0], pid[1], build[253032b/2016-10-26T05:11:34.737Z], OS[Linux/4.4.27-moby/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111/25.111-b14]
elk_1 | -14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [aggs-matrix-stats]
elk_1 | [2016-11-14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [ingest-common]
elk_1 | [2016-11-14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [lang-expression]
elk_1 | [2016-11-14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [lang-groovy]
elk_1 | [2016-11-14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [lang-mustache]
elk_1 | [2016-11-14T09:28:22,109][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [lang-painless]
elk_1 | -14T09:28:22,110][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [percolator]
elk_1 | [2016-11-14T09:28:22,110][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [reindex]
elk_1 | [2016-11-14T09:28:22,110][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [transport-netty3]
elk_1 | [2016-11-14T09:28:22,110][INFO ][o.e.p.PluginsService ] [9KYASyV] loaded module [transport-netty4]
elk_1 | [2016-11-14T09:28:22,110][INFO ][o.e.p.PluginsService ] [9KYASyV] no plugins loaded
elk_1 | -14T09:28:22,966][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
elk_1 | -14T09:28:28,813][INFO ][o.e.n.Node ] [9KYASyV] initialized
elk_1 | [2016-11-14T09:28:28,813][INFO ][o.e.n.Node ] [9KYASyV] starting ...
elk_1 | -14T09:28:29,432][INFO ][o.e.t.TransportService ] [9KYASyV] publish_address {172.17.0.2:9300}, bound_addresses {[::]:9300}
elk_1 | -14T09:28:29,438][INFO ][o.e.b.BootstrapCheck ] [9KYASyV] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
elk_1 | -14T09:28:34,694][WARN ][o.e.m.j.JvmGcMonitorService] [9KYASyV] [gc][young][3][4] duration [3.1s], collections [1]/[3.8s], total [3.1s]/[4.4s], memory [163.3mb]->[81.6mb]/[1.9gb], all_pools {[young] [132.2mb]->[3.1mb]/[133.1mb]}{[survivor] [16.6mb]->[10.9mb]/[16.6mb]}{[old] [14.5mb]->[67.5mb]/[1.8gb]}
elk_1 | [2016-11-14T09:28:34,696][WARN ][o.e.m.j.JvmGcMonitorService] [9KYASyV] [gc][3] overhead, spent [3.1s] collecting in the last [3.8s]
elk_1 | -14T09:28:34,780][INFO ][o.e.c.s.ClusterService ] [9KYASyV] new_master {9KYASyV}{9KYASyViTaOsIAx7vjSZZQ}{NvfMmitMSNCXVkpHo7GzmQ}{172.17.0.2}{172.17.0.2:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
elk_1 | -14T09:28:34,895][INFO ][o.e.h.HttpServer ] [9KYASyV] publish_address {172.17.0.2:9200}, bound_addresses {[::]:9200}
elk_1 | [2016-11-14T09:28:34,895][INFO ][o.e.n.Node ] [9KYASyV] started
elk_1 | -14T09:28:35,085][INFO ][o.e.g.GatewayService ] [9KYASyV] recovered [0] indices into cluster_state

现在已经可以查询了。

此外,curl 'http://localhost:9200/?pretty' 结果如下,因此它正在运行:

$ curl 'http://localhost:9200/?pretty'
{
"name" : "9KYASyV",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "UTZ18I0QRWmg0LFKUDE3ew",
"version" : {
"number" : "5.0.0",
"build_hash" : "253032b",
"build_date" : "2016-10-26T05:11:34.737Z",
"build_snapshot" : false,
"lucene_version" : "6.2.0"
},
"tagline" : "You Know, for Search"
}

另外,从您的日志中,我们注意到 vm.max_map_count 很低。您可以查看here了解更多详情。

关于elasticsearch - Docker-compose.yml 不适用于 elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40583116/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com