And*_*ero 4 elasticsearch docker docker-compose ddev
我试图将版本从我的弹性映像从 5.6 升级到 6.8.0,但是当我运行时ddev startES 容器没有启动。
来自 elasticsearch 服务的 DDEV 日志
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1
[2020-02-28T21:32:29,269][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/share/elasticsearch/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.0.jar:6.8.0]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/share/elasticsearch/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
Run Code Online (Sandbox Code Playgroud)
此外,我无法使用该mem_limit参数,因为我使用的是最新版本 3.0。
docker-compose.elasticsearch.yaml:
version: '3.6'
services:
elasticsearch:
container_name: ddev-${DDEV_SITENAME}-elasticsearch
hostname: ${DDEV_SITENAME}-elasticsearch
image: elasticsearch:6.8.0
ports:
- "9200"
- "9300"
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTP_EXPOSE=9200
ulimits:
memlock:
soft: -1
hard: -1
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- elasticsearch:/usr/share/elasticsearch/data
- ".:/mnt/ddev_config"
web:
links:
- elasticsearch:elasticsearch
volumes:
elasticsearch:
name: "${DDEV_SITENAME}-elasticsearch"
Run Code Online (Sandbox Code Playgroud)
我做错了什么或还缺少什么?
更新
我已经根据此处发布的解决方案尝试了以下解决方案
version: '3.6'
services:
elasticsearch:
container_name: ddev-${DDEV_SITENAME}-elasticsearch
hostname: ${DDEV_SITENAME}-elasticsearch
image: elasticsearch:6.8.0
ports:
- "9200"
- "9300"
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xmx1024m -Xms1024m"
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTP_EXPOSE=9200
- node.max_local_storage_nodes=3
ulimits:
memlock:
soft: -1
hard: -1
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- elasticsearch:/usr/share/elasticsearch/data
- ".:/mnt/ddev_config"
web:
links:
- elasticsearch:elasticsearch
volumes:
elasticsearch:
name: "${DDEV_SITENAME}-elasticsearch"
Run Code Online (Sandbox Code Playgroud)
但现在,抛出以下错误:
我在 ubuntu AWS 实例上安装 ES 7.6 时遇到了同样的问题,该实例已经安装了另一个 ES 版本。如果您仔细查看错误消息的末尾,它会提到:
引起:java.lang.IllegalStateException: 无法获得节点锁,尝试 [[/usr/share/elasticsearch/data]] 与锁 ID [0];也许这些位置是不可写的,或者在没有增加 [node.max_local_storage_nodes] 的情况下启动了多个节点(是 [1])?
请参阅官方 ES 文档中有关此设置的更多详细信息。
要解决此问题,您需要node.max_local_storage_nodes在 elasticsearch.yml 文件中设置为 1 以上。
org.elasticsearch.env.NodeEnvironment#NodeEnvironment方法中的 Elasticsearch 源代码中提供了有关错误的更多信息。
if (nodeLock == null) {
final String message = String.format(
Locale.ROOT,
"failed to obtain node locks, tried [%s] with lock id%s;" +
" maybe these locations are not writable or multiple nodes were started without increasing [%s] (was [%d])?",
Arrays.toString(environment.dataFiles()),
maxLocalStorageNodes == 1 ? " [0]" : "s [0--" + (maxLocalStorageNodes - 1) + "]",
MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
maxLocalStorageNodes);
throw new IllegalStateException(message, lastException);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1546 次 |
| 最近记录: |