1. 拉取镜像
命令1
| docker pull elasticsearch:8.2.2
|
2. 运行
命令1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| docker network create elastic
docker run --name es8 --net elastic -p 9200:9200 -p 9300:9300 \ -v /Users/lizihan/Desktop/docker-v/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ -it -d -e ES_JAVA_OPTS="-Xms256m -Xmx256m" elasticsearch:8.2.2
docker run --name es8 --net elastic -p 9200:9200 -p 9300:9300 \ -it -d -e ES_JAVA_OPTS="-Xms4g -Xmx4g" --restart=always elasticsearch:8.2.2
-e TAKE_FILE_OWNERSHIP=111 \ -v /Users/lizihan/Desktop/docker-v/elasticsearch/data:/usr/share/elasticsearch/data \ -v /Users/lizihan/Desktop/docker-v/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -e discovery.seed_hosts=node1 \ --privileged \ -e "discovery.type=single-node" \
# 初始化密码 bin/elasticsearch-setup-passwords interactive
# 拷贝证书 docker cp es8:/usr/share/elasticsearch/config/certs/http_ca.crt /Users/lizihan/Desktop/docker-v/elasticsearch
docker cp es8:/usr/share/elasticsearch/config/certs/http_ca.crt /home/sakiraven/docker-v docker cp es8:/usr/share/elasticsearch/config/certs/http_ca.crt /home/jmlib/docker-v
# 初始化拷贝文件 docker cp es8:/usr/share/elasticsearch/config /Users/lizihan/Desktop/docker-v/elasticsearch docker cp es8:/usr/share/elasticsearch/data /Users/lizihan/Desktop/docker-v/elasticsearch
# 注意 如果想使用内网访问 tomcat需要加入同一网络 查询网络方式 docker network inspect elastic
# 重置密码 ./bin/elasticsearch-users useradd TestSuper -r superuser
# 复制配置文件 docker cp elasticsearch.yml elasticsearch8:/usr/share/elasticsearch/config/elasticsearch.yml
# 安装ik分词器 # 下载 https://github.com/medcl/elasticsearch-analysis-ik/releases docker cp elasticsearch-analysis-ik-8.0.0.zip elasticsearch:/usr/share/elasticsearch/plugins # 进入elasticsearch命令行 cd plugins/ mkdir ik mv elasticsearch-analysis-ik-8.0.0.zip ik/ cd ik/ unzip elasticsearch-analysis-ik-8.0.0.zip rm elasticsearch-analysis-ik-8.0.0.zip
|
3. 拉取kibana景象
4. 运行
命令1 2 3 4 5 6 7 8 9
| docker run -it -d --name kibana --net elastic -p 5601:5601 kibana:8.2.2
-v /Users/lizihan/Desktop/docker-v/kibana/config:/usr/share/kibana/config \ -v /Users/lizihan/Desktop/docker-v/kibana/data:/usr/share/kibana/data \
只需要在配置文件 kibana.yml 中加入
i18n.locale: "zh-CN"
|
5. 拷贝kibana配置文件
docker cp kibana:/usr/share/kibana/config /Users/lizihan/Desktop/docker-v/kibana
docker cp kibana:/usr/share/kibana/data /Users/lizihan/Desktop/docker-v/kibana
6. es 证书位置
命令1
| docker cp es8:/usr/share/elasticsearch/config/certs/http_ca.crt /Users/lizihan/Desktop/docker-v/elasticsearch
|