title: "Docker部署elasticsearch"
tags: docker
作业3:部署es+kibana
# es暴漏的端口很多
# es 十分耗内存
# es 的数据一般需要放置到安全目录
# 官方这么写的
# 启动elasticsearch
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
# --net somenetwork
# 启动了 linux就卡住了
docker stats # 查看cpu状态
# es是十分耗内存的 1核2G 现在他是启动不起来了
# 停止我们的docker
# 测试一下es是否
# 增加内存的操作
# 赶紧关闭
docker run -d --name elasticsearch -p 9200:9200 -p -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch:7.6.2
这回再试试
[root@iz8g9301trfnpxz home]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9277b55c181 nginx "/docker-entrypoint.…" 36 minutes ago Up 36 minutes 0.0.0.0:3344->80/tcp nginx01
[root@iz8g9301trfnpxz home]# docker stop f9277b55c181
f9277b55c181
[root@iz8g9301trfnpxz home]# docker run -d --name elasticsearch02 -p 9200:9200 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch:7.6.2
f693ce46235c8b7a4106cda033e9e6211ffc0f978457be3ccf72abe23acac24a
[root@iz8g9301trfnpxz home]# docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 0.05% 204.9MiB / 1.796GiB 11.14% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 0.05% 204.9MiB / 1.796GiB 11.14% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.78% 226.2MiB / 1.796GiB 12.30% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.78% 226.2MiB / 1.796GiB 12.30% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.14% 233.3MiB / 1.796GiB 12.68% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.14% 233.3MiB / 1.796GiB 12.68% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 99.96% 244.5MiB / 1.796GiB 13.29% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 99.96% 244.5MiB / 1.796GiB 13.29% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 97.79% 253.4MiB / 1.796GiB 13.78% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 97.79% 253.4MiB / 1.796GiB 13.78% 0B / 0B 0B / 0B 19
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.67% 266.3MiB / 1.796GiB 14.47% 0B / 0B 0B / 0B 20
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 98.67% 266.3MiB / 1.796GiB 14.47% 0B / 0B 0B / 0B 20
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 99.21% 270.3MiB / 1.796GiB 14.70% 0B / 0B 0B / 0B 20
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 99.21% 270.3MiB / 1.796GiB 14.70% 0B / 0B 0B / 0B 20
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 95.08% 276.7MiB / 1.796GiB 15.04% 0B / 0B 0B / 0B 26
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f693ce46235c elasticsearch02 95.08% 276.7MiB / 1.796GiB 15.04% 0B / 0B 0B / 0B 26
^C
[root@iz8g9301trfnpxz home]# clear
[root@iz8g9301trfnpxz home]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f693ce46235c elasticsearch:7.6.2 "/usr/local/bin/dock…" 27 seconds ago Up 26 seconds 0.0.0.0:9200->9200/tcp, 9300/tcp elasticsearch02
[root@iz8g9301trfnpxz home]# curl localhost:9200
{
"name" : "f693ce46235c",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "woaoctzxSoWCx_ksjXFTbg",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@iz8g9301trfnpxz home]#