最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

docker啟動ES內存溢出的解決方案

 更新時間:2021年03月29日 11:42:42   作者:Airship  
這篇文章主要介紹了docker啟動ES內存溢出的解決方案,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

在elasticsearch的config中加jvm.options文件,修改堆棧大小,默認是2GB,直接啟動es即可,保證之前已經映射了配置文件。

-Xms5g
-Xmx5g

完整jvm.options文件如下:

## JVM configuration
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms5g
-Xmx5g
################################################################
## Expert settings
################################################################
##
## All settings below this section are considered
## expert settings. Don't tamper with them unless
## you understand what you are doing
##
################################################################
## GC configuration
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
## optimizations
# pre-touch memory pages used by the JVM during initialization
-XX:+AlwaysPreTouch
## basic
# force the server VM (remove on 32-bit client JVMs)
-server
# explicitly set the stack size (reduce to 320k on 32-bit client JVMs)
-Xss1m
# set to headless, just in case
-Djava.awt.headless=true
# ensure UTF-8 encoding by default (e.g. filenames)
-Dfile.encoding=UTF-8
# use our provided JNA always versus the system one
-Djna.nosys=true
# use old-style file permissions on JDK9
-Djdk.io.permissionsUseCanonicalPath=true
# flags to configure Netty
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
# log4j 2
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-Dlog4j.skipJansi=true
## heap dumps
# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError
# specify an alternative path for heap dumps
# ensure the directory exists and has sufficient space
#-XX:HeapDumpPath=${heap.dump.path}
## GC logging
#-XX:+PrintGCDetails
#-XX:+PrintGCTimeStamps
#-XX:+PrintGCDateStamps
#-XX:+PrintClassHistogram
#-XX:+PrintTenuringDistribution
#-XX:+PrintGCApplicationStoppedTime
# log GC status to a file with time stamps
# ensure the directory exists
#-Xloggc:${loggc}
# By default, the GC log file will not rotate.
# By uncommenting the lines below, the GC log file
# will be rotated every 128MB at most 32 times.
#-XX:+UseGCLogFileRotation
#-XX:NumberOfGCLogFiles=32
#-XX:GCLogFileSize=128M
# Elasticsearch 5.0.0 will throw an exception on unquoted field names in JSON.
# If documents were already indexed with unquoted fields in a previous version
# of Elasticsearch, some operations may throw errors.
#
# WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided
# only for migration purposes.
#-Delasticsearch.json.allow_unquoted_field_names=true

補充:Docker 容器內存限制

Docker 內存限制

docker run -d -i -t -m 256M --memory-swap 512M --name centos2.12 centos /bin/bash

查看容器實例 內存限制:

限制容器內存大??;

docker run -d -i -t -m 256M --memory-swap 512M --name centos centos /bin/bash

-m, --memory 
# 內存限制大小,單位可以為 b,k,M,g;最小為4M
--memory-swap
# 內存+交換分區(qū)大小總限制
--memory-reservation # 預留內存大??;容器在宿主機最小占用內存;
--oom-kill-disable
# out-of-memory 內存溢出;限制kill容器進程,默認沒設置
--oom-score-adj
# 容器被 OOM killer 殺死的優(yōu)先級,范圍是[-1000, 1000],默認為 0
--memory-swappiness
# 用于設置容器的虛擬內存控制行為。值為 0~100 之間的整數(shù)
--kernel-memory
核心內存限制,最小為 4M。

1、memory 設置容器內存大??;

--memory-swap 不是交換分區(qū),而是 memory + swap 的大小;
容器的交換分區(qū) swap = memory-swap - memory

2、Docker 默認容器交換分區(qū)的大小和內存相同

memory-swap 不設置 或者設置為 0 ;
容器的交換分區(qū) swap 大小就是 memory 的小大;
容器的進程使用最大內存 = memory + swap

3、memory-swap 設置

當 memory-swap 設置為 -1 時;
容器內存大小為 memory 設置的大?。?
交換分區(qū)大小為宿主機 swap 大?。?
容器進程能使用的最大內存 = memory + 宿主機 swap 大??;

4、內存溢出

--oom-kill-disable
限制 kill 容器進程; (必須設置在 memory 之后才有限;)
docker run -d -i -t -m 256M --oom-kill-disable --name Centos-1 centos /bin/bash

5、核心內存 & 用戶內存

核心內存和用戶內存不同的地方在于核心內存不能被交換出。

不能交換出去的特性使得容器可以通過消耗太多內存來堵塞一些系統(tǒng)服務。

核心內存包括:
stack pages(棧頁面)
slab pages
socket memory pressure
tcp memory pressure

可以通過設置核心內存限制來約束這些內存。

每個進程都要消耗一些棧頁面,通過限制核心內存,可以在核心內存使用過多時阻止新進程被創(chuàng)建。

docker run -d -i -t -m 500M --kernel-memory 128M --name Centos-2 centos /bin/bash
限制容器內存 256M;限制核心內存 128M 。
docker run -d -i -t --kernel-memory 128M --name Centos-3 centos /bin/bash
內存為宿主機memory大小, 限制核心內存 128M

6、Swappiness 內存回收頁

容器的內核可以交換出一定比例的匿名頁。

--memory-swappiness就是用來設置這個比例的。
--memory-swappiness可以設置為從 0 到 100。
# 0 表示關閉匿名頁面交換。
# 100 表示所有的匿名頁都可以交換。默認情況下,如果不適用--memory-swappiness,則該值從父進程繼承而來。
docker run -d -i -t --memory-swappiness=0 --name Centos-4 centos /bin/bash
將--memory-swappiness設置為 0 可以保持容器的工作集,避免交換代理的性能損失。

Swappiness 的值越大,表示越積極使用swap分區(qū),越小表示越積極使用物理內存。默認值swappiness=60

sysctl vm.swappiness = 100 
# cat /proc/sys/vm/swappiness

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

相關文章

  • Windows安裝docker-desktop的詳細步驟

    Windows安裝docker-desktop的詳細步驟

    這篇文章主要介紹了Windows安裝docker-desktop的詳細步驟,本文通過圖文并茂的形式給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
    2024-03-03
  • Docker + Nodejs + Kafka + Redis + MySQL搭建簡單秒殺環(huán)境

    Docker + Nodejs + Kafka + Redis + MySQL搭建簡單秒殺環(huán)境

    本文給大家分享的是使用Docker + Nodejs + Kafka + Redis + MySQL模擬搭建起來的商品秒殺環(huán)境,非常的實用和熱門,有需要的小伙伴可以參考下
    2017-01-01
  • docker如何創(chuàng)建nginx圖片服務器

    docker如何創(chuàng)建nginx圖片服務器

    這篇文章主要介紹了docker如何創(chuàng)建nginx圖片服務器問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • idea?+?Docker?+?阿里鏡像服務打包部署的過程

    idea?+?Docker?+?阿里鏡像服務打包部署的過程

    本文介紹了如何在IDEA中使用Docker打包鏡像,并將鏡像推送到阿里云鏡像服務,同時,還詳細說明了如何在ECS服務器上安裝和配置Docker,并提供了常用的Docker命令和操作技巧,感興趣的朋友一起看看吧
    2025-02-02
  • docker安裝使用xdebug的過程

    docker安裝使用xdebug的過程

    這篇文章主要介紹了docker安裝使用xdebug的過程,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-09-09
  • Ubuntu 16.04中Docker的安裝和代理配置教程

    Ubuntu 16.04中Docker的安裝和代理配置教程

    這篇文章主要給大家介紹了在Ubuntu 16.04中Docker的安裝和代理配置的相關資料,文中介紹的非常詳細,對大家具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧。
    2017-05-05
  • 詳解Docker Swarm概念與用法

    詳解Docker Swarm概念與用法

    這篇文章主要介紹了Docker Swarm概念與用法,幫助大家更好的理解和使用docker容器,感興趣的朋友可以了解下
    2020-09-09
  • docker nginx 配置文件要點及注意事項

    docker nginx 配置文件要點及注意事項

    本文介紹了Nginx的配置要點及注意事項,包括訪問靜態(tài)資源、負載均衡等,在訪問靜態(tài)資源時,可以使用root或alias指令指定路徑,本文給大家介紹的非常詳細,感興趣的朋友一起看看吧
    2025-02-02
  • 淺談Docker 客戶端和守護進程

    淺談Docker 客戶端和守護進程

    這篇文章主要介紹了淺談Docker 客戶端和守護進程,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-05-05
  • docker 限制容器對CPU的使用

    docker 限制容器對CPU的使用

    本篇文章主要介紹了docker 限制容器對CPU的使用,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08

最新評論

苏尼特右旗| 林周县| 屯昌县| 北碚区| 淮北市| 莎车县| 太原市| 威信县| 璧山县| 武汉市| 和龙市| 乐平市| 拜城县| 育儿| 工布江达县| 托里县| 勐海县| 泉州市| 周至县| 红原县| 清苑县| 双鸭山市| 来凤县| 泽库县| 乌兰浩特市| 岐山县| 噶尔县| 汉中市| 临沧市| 龙游县| 曲麻莱县| 屯留县| 应用必备| 富川| 康乐县| 尚志市| 苍溪县| 黎城县| 堆龙德庆县| 乳山市| 晋州市|