docker compose 快速搭建 Elasticsearch 单节点测试环境

时间:2024-12-04 07:09:40
1.创建挂载文件夹目录并授权 mkdir -p /opt/docker/elasticsearch/{conf,data,logs,plugins} sudo chmod -R 777 /opt/docker/elasticsearch/{conf,data,logs,plugins} 2.在 /opt/docker/elasticsearch/conf 目录下根据版本编写 elasticsearch.yml 配置文件 cluster.name: es-cluster node.name: node-1 node.master: true node.data: true network.host: 0.0.0.0 path.logs: /usr/share/elasticsearch/logs path.data: /usr/share/elasticsearch/data bootstrap.memory_lock: true http.port: 9200 transport.tcp.port: 9300 # discovery.seed_hosts: ["127.0.0.1"] -- docker 容器安装时IP不固定,使用 environment 指定为 服务名 cluster.initial_master_nodes: ["node-1"] action.destructive_requires_name: true http.cors.enabled: true http.cors.allow-origin: "*" xpack.security.enabled: false xpack.security.authc.api_key.enabled: false xpack.security.http.ssl.enabled: false xpack.security.transport.ssl.enabled: false