How can I set the Java heap size for elasticsearch on Nixos?Command Line Tool for monitoring Java HeapJava...

Efficient way of generating a random number of N (less than 64) bits with exactly M bits equal to one

Taking out number of subarrays from an array which contains all the distinct elements of that array

Is "stainless" a bulk or a surface property of stainless steel?

(Why) May a Beit Din refuse to bury a body in order to coerce a man into giving a divorce?

What can I do to keep a threaded bolt from falling out of its slot?

Was 'help' pronounced starting with a vowel sound?

What is the difference between a premise and an assumption in logic?

Was Tuvok bluffing when he said that Voyager's transporters rendered the Kazon weapons useless?

The sound of thunder's like a whip

Does C++20 mandate source code being stored in files?

Are there any plans for handling people floating away during an EVA?

What does it mean to have a subnet mask /32?

How can I use unicode in this condition?

Is a butterfly one or two animals?

Do I have to learn /o/ or /ɔ/ separately?

Should my "average" PC be able to discern the potential of encountering a gelatinous cube from subtle clues?

Why doesn't mathematics collapse even though humans quite often make mistakes in their proofs?

How can I support the recycling, but not the new production of aluminum?

Can pay be witheld for hours cleaning up after closing time?

A second course in the representation theory

Overwrite file only if data

Are thrust levers synchronized by default when pushed/pulled?

How to create a summation symbol with a vertical bar?

How to persuade recruiters to send me the Job Description?



How can I set the Java heap size for elasticsearch on Nixos?


Command Line Tool for monitoring Java HeapJava SDK on NixOS for IntelliJHow to raise max threads for elasticsearch?how to set custom xkb_keymap in nixosHow to install java in NixOS?How does vmstat consider about java heap?How can I install jack2 on nixos?How can I enable PHP within the Apache service configuration in Nixos?How can I set a custom DNS server within Nixos?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















It seems these should go in the ${configDir}/jvm.options"} (/var/lib/elasticsearch/config/jvm.options ?) looking at the package at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/search/elasticsearch.nix



Possibly I could use the ES_JAVA_OPTS environment variable?



Using services.elasticsearch.extraJavaOptions does not work as it seems something is passing -Xms1g -Xmx1g by default:



Output from ps aux




elastic+ 21271 30.8 47.5 4456956 950968 ? Ssl 01:03 3:41
/nix/store/9c5a9fq2vd6qah77nmg87sjq5wbss1kj-openjdk-8u212-ga-jre/bin/java
-Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.uQNUAfPs -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms512m -Xmx512m -Des.path.home=/var/lib/elasticsearch -Des.path.conf=/var/lib/elasticsearch/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /var/lib/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch











share|improve this question



























  • Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

    – MariusMatutiae
    Feb 18 at 8:49











  • I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

    – Chris Stryczynski
    Feb 18 at 8:52






  • 1





    The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

    – Emmanuel Rosa
    Feb 18 at 13:50


















0















It seems these should go in the ${configDir}/jvm.options"} (/var/lib/elasticsearch/config/jvm.options ?) looking at the package at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/search/elasticsearch.nix



Possibly I could use the ES_JAVA_OPTS environment variable?



Using services.elasticsearch.extraJavaOptions does not work as it seems something is passing -Xms1g -Xmx1g by default:



Output from ps aux




elastic+ 21271 30.8 47.5 4456956 950968 ? Ssl 01:03 3:41
/nix/store/9c5a9fq2vd6qah77nmg87sjq5wbss1kj-openjdk-8u212-ga-jre/bin/java
-Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.uQNUAfPs -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms512m -Xmx512m -Des.path.home=/var/lib/elasticsearch -Des.path.conf=/var/lib/elasticsearch/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /var/lib/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch











share|improve this question



























  • Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

    – MariusMatutiae
    Feb 18 at 8:49











  • I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

    – Chris Stryczynski
    Feb 18 at 8:52






  • 1





    The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

    – Emmanuel Rosa
    Feb 18 at 13:50














0












0








0








It seems these should go in the ${configDir}/jvm.options"} (/var/lib/elasticsearch/config/jvm.options ?) looking at the package at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/search/elasticsearch.nix



Possibly I could use the ES_JAVA_OPTS environment variable?



Using services.elasticsearch.extraJavaOptions does not work as it seems something is passing -Xms1g -Xmx1g by default:



Output from ps aux




elastic+ 21271 30.8 47.5 4456956 950968 ? Ssl 01:03 3:41
/nix/store/9c5a9fq2vd6qah77nmg87sjq5wbss1kj-openjdk-8u212-ga-jre/bin/java
-Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.uQNUAfPs -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms512m -Xmx512m -Des.path.home=/var/lib/elasticsearch -Des.path.conf=/var/lib/elasticsearch/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /var/lib/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch











share|improve this question
















It seems these should go in the ${configDir}/jvm.options"} (/var/lib/elasticsearch/config/jvm.options ?) looking at the package at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/search/elasticsearch.nix



Possibly I could use the ES_JAVA_OPTS environment variable?



Using services.elasticsearch.extraJavaOptions does not work as it seems something is passing -Xms1g -Xmx1g by default:



Output from ps aux




elastic+ 21271 30.8 47.5 4456956 950968 ? Ssl 01:03 3:41
/nix/store/9c5a9fq2vd6qah77nmg87sjq5wbss1kj-openjdk-8u212-ga-jre/bin/java
-Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.uQNUAfPs -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms512m -Xmx512m -Des.path.home=/var/lib/elasticsearch -Des.path.conf=/var/lib/elasticsearch/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /var/lib/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch








java nixos nix elasticsearch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago







Chris Stryczynski

















asked Feb 18 at 8:44









Chris StryczynskiChris Stryczynski

9547 silver badges21 bronze badges




9547 silver badges21 bronze badges
















  • Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

    – MariusMatutiae
    Feb 18 at 8:49











  • I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

    – Chris Stryczynski
    Feb 18 at 8:52






  • 1





    The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

    – Emmanuel Rosa
    Feb 18 at 13:50



















  • Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

    – MariusMatutiae
    Feb 18 at 8:49











  • I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

    – Chris Stryczynski
    Feb 18 at 8:52






  • 1





    The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

    – Emmanuel Rosa
    Feb 18 at 13:50

















Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

– MariusMatutiae
Feb 18 at 8:49





Have you seen this, elastic.co/guide/en/elasticsearch/reference/current/… ? It is the first reference found by Googling elastisearch heap size. It contains the full answer to your question, including using an environment variable.

– MariusMatutiae
Feb 18 at 8:49













I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

– Chris Stryczynski
Feb 18 at 8:52





I have - the difficulty is knowing how to integrate this ENVS / config with Nixos.

– Chris Stryczynski
Feb 18 at 8:52




1




1





The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

– Emmanuel Rosa
Feb 18 at 13:50





The jvm.options file is copied from the Nix store to /var/lib/elasticsearch/config/ every time ElasticSearch is started. Hence changes to the file would get overwritten. Assuming ES_JAVA_OPTS takes precedence over jvm.options, you can do something like services.elasticsearch.extraJavaOptions = [ "-Xms2g" "-Xmx2g" ]

– Emmanuel Rosa
Feb 18 at 13:50










1 Answer
1






active

oldest

votes


















1














Perhaps a bit overkill but I'm not too sure how to override a Nixos service's parameters.



Essentially the default options are in .../jvm.options so I copied the elasticsearch.nix from Github and modified the following:



        ${optionalString es6 "sed -i '/-Xms1g/d' ${configDir}/jvm.options"}
${optionalString es6 "sed -i '/-Xmx1g/d' ${configDir}/jvm.options"}


Along with changing the name of the service (otherwise I'd assume it would conflict). I then just included this nix expression into my config and it seems to be working with the appropriate values set in ES_JAVA_OPTS.






share|improve this answer




























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501302%2fhow-can-i-set-the-java-heap-size-for-elasticsearch-on-nixos%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Perhaps a bit overkill but I'm not too sure how to override a Nixos service's parameters.



    Essentially the default options are in .../jvm.options so I copied the elasticsearch.nix from Github and modified the following:



            ${optionalString es6 "sed -i '/-Xms1g/d' ${configDir}/jvm.options"}
    ${optionalString es6 "sed -i '/-Xmx1g/d' ${configDir}/jvm.options"}


    Along with changing the name of the service (otherwise I'd assume it would conflict). I then just included this nix expression into my config and it seems to be working with the appropriate values set in ES_JAVA_OPTS.






    share|improve this answer






























      1














      Perhaps a bit overkill but I'm not too sure how to override a Nixos service's parameters.



      Essentially the default options are in .../jvm.options so I copied the elasticsearch.nix from Github and modified the following:



              ${optionalString es6 "sed -i '/-Xms1g/d' ${configDir}/jvm.options"}
      ${optionalString es6 "sed -i '/-Xmx1g/d' ${configDir}/jvm.options"}


      Along with changing the name of the service (otherwise I'd assume it would conflict). I then just included this nix expression into my config and it seems to be working with the appropriate values set in ES_JAVA_OPTS.






      share|improve this answer




























        1












        1








        1







        Perhaps a bit overkill but I'm not too sure how to override a Nixos service's parameters.



        Essentially the default options are in .../jvm.options so I copied the elasticsearch.nix from Github and modified the following:



                ${optionalString es6 "sed -i '/-Xms1g/d' ${configDir}/jvm.options"}
        ${optionalString es6 "sed -i '/-Xmx1g/d' ${configDir}/jvm.options"}


        Along with changing the name of the service (otherwise I'd assume it would conflict). I then just included this nix expression into my config and it seems to be working with the appropriate values set in ES_JAVA_OPTS.






        share|improve this answer













        Perhaps a bit overkill but I'm not too sure how to override a Nixos service's parameters.



        Essentially the default options are in .../jvm.options so I copied the elasticsearch.nix from Github and modified the following:



                ${optionalString es6 "sed -i '/-Xms1g/d' ${configDir}/jvm.options"}
        ${optionalString es6 "sed -i '/-Xmx1g/d' ${configDir}/jvm.options"}


        Along with changing the name of the service (otherwise I'd assume it would conflict). I then just included this nix expression into my config and it seems to be working with the appropriate values set in ES_JAVA_OPTS.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Chris StryczynskiChris Stryczynski

        9547 silver badges21 bronze badges




        9547 silver badges21 bronze badges

































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501302%2fhow-can-i-set-the-java-heap-size-for-elasticsearch-on-nixos%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...