Mac安装docker,启动elasticsearch

一、安装Docker Desktop

Docker Desktop: The #1 Containerization Tool for Developers | Docker

二、下载镜像

复制代码
docker pull elasticsearch:8.11.1  # 这里以 8.11.1 版本为例

三、启动镜像

复制代码
docker run -d --name es -p 9200:9200 \
  -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
  -e "xpack.security.http.ssl.enabled=false" \
  -e "discovery.type=single-node" \
  elasticsearch:8.11.1

四、检查

复制代码
# docker ps                                                                                                                                                                                    
CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS                                         NAMES
f2a1d6518feb   elasticsearch:8.11.1   "/bin/tini -- /usr/l..."   16 minutes ago   Up 16 minutes   0.0.0.0:9200->9200/tcp, [::]:9200->9200/tcp   es

五、浏览器访问

http://localhost:9200/

发现需要用户名和密码

复制代码
# 进入容器执行
docker exec -it es \
/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i

按提示输入新密码两次即可
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset.

使用用户名和密码访问

复制代码
curl -u elastic:123123 http://localhost:9200                                                                                                                                                 ─╯
{
  "name" : "f2a1d6518feb",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "JfaaonPMTlybVZCtxsL34g",
  "version" : {
    "number" : "8.11.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "6f9ff581fbcde658e6f69d6ce03050f060d1fd0c",
    "build_date" : "2023-11-11T10:05:59.421038163Z",
    "build_snapshot" : false,
    "lucene_version" : "9.8.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}
相关推荐
Elastic 中国社区官方博客13 分钟前
Elastic 开源社区行为准则
大数据·elasticsearch·搜索引擎·信息可视化·全文检索
皓月盈江19 分钟前
Linux Ubuntu系统如何编辑Docker容器内的文件
linux·ubuntu·docker·容器·靶场·vulhub·编辑docker内文件
魔极客28 分钟前
1panel面板安装ollama的详细过程
docker·1panel·ollama
椰汁菠萝1 小时前
[特殊字符] Nginx UI:Docker 部署与完全使用指南
nginx·ui·docker
珂玥c1 小时前
添加node节点到k8s集群+配置网络插件flannel
云原生·容器·kubernetes
努力搬砖的咸鱼1 小时前
PersistentVolume与PersistentVolumeClaim:K8s 存储绑定机制完全解析
云原生·容器·kubernetes
xingfujie2 小时前
第3章 安装 kubeadm/kubelet/kubectl
linux·云原生·容器·kubernetes·kubelet
csdn小瓯2 小时前
CI/CD流水线搭建:GitHub Actions + Docker + Railway自动化部署实战
ci/cd·docker·github
代码讲故事2 小时前
mac电脑上docker突然无法运行,不停的出现弹框,“com.docker.vmnetd”将对你的电脑造成伤害。附国内不同芯片高速下载地址,下载直接运行。
macos·docker·容器·arm·mac·intel·下载
逸Y 仙X3 小时前
文章二十九:ElasticSearch分桶聚合
android·大数据·elasticsearch·搜索引擎·全文检索