- 0.注意事项
- 1.官方启动es(不推荐,没设置es内存大小)
- 2.docker stats查看容器占用状态
- 3.docker -e增加内存限制
es暴露的端口很多
es很占内存,默认1g
es的数据需要放到安全目录,要做数据挂载
es集群,需要docker网络
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
curl查看是否启动成功
[root@localhost haokai]# curl locallhost:9200 curl: (6) Could not resolve host: locallhost; Unknown error [root@localhost haokai]# curl localhost:9200 { "name" : "64353fa05644", "cluster_name" : "docker-cluster", "cluster_uuid" : "Lg4AuNSISjC_E3ztBBZbTg", "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@localhost haokai]#2.docker stats查看容器占用状态
这个命令也比较耗费内存,因为是实施刷新的,所以不看了要关掉
docker stats
ConTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 64353fa05644 elasticsearch 1.10% 777.7MiB / 1.777GiB 42.75% 656B / 0B 2.91GB / 108MB 46 533124d2559a tomcat01 0.21% 110.9MiB / 1.777GiB 6.10% 16.5kB / 172kB 897MB / 30.3MB 36 aca793e8d0cc nginx01 0.00% 2.387MiB / 1.777GiB 0.13% 7.3kB / 6.78kB 22.4MB / 0B 53.docker -e增加内存限制
-e ES_JAVA_OPS=“Xms64m Xmx=128”
内存指定:最小64M,最大128M,看自己需要,一般不超过物理内存的50%。
docker run -d --name elasticsearch01 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx=128m" elasticsearch:7.6.2
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)