折腾了一下午,终于搞定了搜索的初步功能。至于要不要启用外部存储,我觉得可以等等,毕竟硬盘还有70个G够我挥霍,等到硬盘只有30个G的空间了,我再整外部存储。
解决过程:
1、用docker安装elastic search
# 新建文件夹,并进入
mkdir es && cd es
# 编辑docker compose文件
vim compose.yml
compose.yml文件的内容:
services:
es:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
container_name: mastodon-elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true"
- "xpack.license.self_generated.type=basic"
- "xpack.security.enabled=false"
- "xpack.watcher.enabled=false"
- "xpack.graph.enabled=false"
- "xpack.ml.enabled=false"
- "bootstrap.memory_lock=true"
- "cluster.name=es-mastodon"
- "discovery.type=single-node"
- "thread_pool.write.queue_size=1000"
volumes:
- ./elasticsearch_data:/usr/share/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
networks:
- cloudron
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
networks:
cloudron:
external: true
# 启动docker容器
docker compose up -d