在2核2G的ECS上使用docker部署,限制内存在1G,经常发生CPU暴满和内存突增
版本:2.10
halohub/halo:2.10
version: '3'
services:
halo:
container_name: halo
image: halohub/halo:2.10
restart: always
volumes:
- ./halo2:/root/.halo2
ports:
- "1083:8090"
#environment:
#- JVM_OPTS="-Xmx128m -Xms128m"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
command:
# 外部访问地址,请根据实际需要修改
- --halo.external-url=https://www.jnliok.com/
deploy:
resources:
limits:
cpus: '0.5'
memory: 900M
reservations:
cpus: '0.2'
memory: 600M
日志有一个错误信息:
2023-11-21T14:02:16.094+08:00 ERROR 7 --- [reactor-tcp-epoll-2] reactor.core.publisher.Operators : Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine: /root/.halo2/indices/posts/write.lock
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine: /root/.halo2/indices/posts/write.lock
at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:126) ~[lucene-core-9.7.0.jar:9.7.0 ccf4b198ec328095d45d2746189dc8ca633e8bcf - 2023-06-21 11:48:16]
at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:43) ~[lucene-core-9.7.0.jar:9.7.0 ccf4b198ec328095d45d2746189dc8ca633e8bcf - 2023-06-21 11:48:16]
at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:44) ~[lucene-core-9.7.0.jar:9.7.0 ccf4b198ec328095d45d2746189dc8ca633e8bcf - 2023-06-21 11:48:16]
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:947) ~[lucene-core-9.7.0.jar:9.7.0 ccf4b198ec328095d45d2746189dc8ca633e8bcf - 2023-06-21 11:48:16]
at run.halo.app.search.post.LucenePostSearchService.addDocuments(LucenePostSearchService.java:122) ~[classes/:2.10.1]
at run.halo.app.search.IndicesServiceImpl.lambda$rebuildPostIndices$5(IndicesServiceImpl.java:58) ~[classes/:2.10.1]
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:185) ~[reactor-core-3.5.11.jar:3.5.11]