docker安装Elasticsearch

公网即可拉取镜像,这个镜像是可以拉得到的,版本号根据自己需要的来

bash 复制代码
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.15

运行命令,xxxxxxxxxxxxxxxxxxxxxxxx_password 为自己的密码

bash 复制代码
docker run -d --name elasticsearch \
  -e "discovery.type=single-node" \
  -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
  -e "xpack.security.enabled=true" \
  -e "ELASTIC_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxx_password" \
  -p 9200:9200 -p 9300:9300 \
  docker.elastic.co/elasticsearch/elasticsearch:7.17.15

测试访问

bash 复制代码
curl -u elastic:xxxxxxxxxxxx_password http://localhost:9200

保存镜像

bash 复制代码
docker save -o elasticsearch_7.17.15.tar docker.elastic.co/elasticsearch/elasticsearch:7.17.15

加载镜像

bash 复制代码
docker load -i  elasticsearch_7.17.15.tar

nginx代理

bash 复制代码
server {
    listen 9200;
    server_name xxx;# 配置代理到 Elasticsearch
    
	location / {
	    proxy_pass http://172.16.17.333:9200;  # 代理到 Elasticsearch
	    proxy_set_header Host $host;
	    proxy_set_header X-Real-IP $remote_addr;
	    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	    proxy_set_header X-Forwarded-Proto $scheme;
	    proxy_set_header Authorization "Basic $(echo -n 'elastic:xxxxxxxx_password' | base64)";  # 添加 Elasticsearch 基本认证头
	    proxy_read_timeout 90;
	}
}

如果nginx没有 base64

自己base64 去加密elastic:xxxxxxxx_password

相关推荐
分布式存储与RustFS2 天前
MinIO 官方 Docker 镜像被移除:依赖它的项目该怎么办
docker·云原生·devops·对象存储·minio·分布式存储
玉&心2 天前
通过Arthas在线诊断K8S中的内存及JVM等使用情况
docker·k8s·arthas
xing-xing2 天前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
guo_wen_qiang2 天前
上传本地镜像到harbor中
docker·容器·持续部署
Elasticsearch2 天前
Elastic Observability 的跨项目搜索:通过一个查询搜索所有关联项目
elasticsearch
羑悻的小杀马特2 天前
Dockerfile 全景指南:从入门编写dockerfile到生产环境镜像优化实战,一步步带你从啃透制作指令到镜像制作落地!
docker·dockerfile·镜像制作
BianHuanShiZhe2 天前
docker常见命令
docker
Elasticsearch2 天前
Elasticsearch 中的 agentic 工作流:暂停 AI agent 等待人工审批,72 小时后恢复
elasticsearch
正经教主2 天前
【FDE系列】阶段2:Day 43:Docker Compose — 多容器一键编排
人工智能·docker·fde
忆~遂愿2 天前
本地片库怎么在外面打开?Plex + cpolar 搭一套可远程访问的私人影音库
docker·容器