Cannot start elasticsearch on Centos8

Hi fellows,
I installed elasticsearch 7 on my centos 8 machine via yum following this howto: https://www.howtoforge.com/how-to-install-elastic-stack-on-centos-8/
Anything worked fine so far, but wehen I try to start elasticsearch I get the following error: Error: Could not create the Java Virtual Machine.
In elasticsearch.log I get this Error:
uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[Failure running machine learning native code.
So I tried this: echo "xpack.ml.enabled: false" >> /etc/elasticsearch/elasticsearch.yml
without any success.

My machine has 3GB RAM so I set

*-Xms1g*
*-Xmx2g*

My elasticsearch.yml you can see here: https://pastebin.com/m4P5f5qy

How can I fix that problem.
Any help is aapreciated.

Many thanks in advance

Uli

Welcome!

No more than half of the available RAM should be allocated to the HEAP.
See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html

With 3gb of RAM, I'd keep the default configuration.

Hi dadoonet,
thanks for your advice , but that isn't the reason for that error I chanded it to 1g and 512m both doesn't solved it.

Regards,
Uli

You should use the same value for both.

Hi dadoonet,
Thanks for you advice I tried 2g 1g 512m und 4g as values , nothing worked.
Invalid initial heap size: -Xms1g

Which size would you recommend?
f ree -m
* total used free shared buff/cache available*
Mem: 3400 262 2727 9 409 2917
Swap: 1527 0 1527

Best Regards,

Uli

I'm recommending using the default value. Which means reverting all the changes you did.

that would be 4g that does not work

That's not the default values.

so would you be so nice to tell me what what the default value is? I cannot find a value on google & co for it .

I reinstalled the latest java openjdk-devel-14.0.1.7-2
but the Virtual Machine can still not be created

Error: Could not create the Java Virtual Machine

Thanks in advance,

Uli

Download the default distribution. Unzip. Launch. Don't touch any file or settings.

This should work out of the box.

I have to use centos8 so I reinstalled elasticsearch so jvm.options now show Xms and Xmx value 1g but when I try to start elasticsearch I get these errors:

*journalctl -xe*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.jav>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: Caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAML>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:  in 'reader', line 61, column 8:*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:      - name: xpack.ml.enabled*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:            ^*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:  at [Source: (sun.nio.ch.ChannelInputStream); line: 61, column: 8]*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAML>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLP>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextTo>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.common.settings.Settings.fromXContent(Settings>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.common.settings.Settings.fromXContent(Settings>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.common.settings.Settings.access$400(Settings.j>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.elasticsearch.common.settings.Settings$Builder.loadFromStrea>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         ... 9 more*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: Caused by: mapping values are not allowed here*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:  in 'reader', line 61, column 8:*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:      - name: xpack.ml.enabled*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:            ^*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.ja>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerIm>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.ja>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produc>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:1>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:16>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLP>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]:         ... 14 more*
*Jun 06 19:08:23 keyhole systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE*
*Jun 06 19:08:23 keyhole systemd[1]: elasticsearch.service: Failed with result 'exit-code'.*

Regards,

Uli

@uek those errors appear to be related to your YAML. The YAML you posted at https://pastebin.com/m4P5f5qy has invalid values on lines 61 & 62. You took care of that setting on line 99. Try removing those lines and let us know the result.

Hi, thanks a lot I will do and tell you about the result.

Regards,

Uli

Problem solved!

Many thanks to CoinologyJoshua Jones

the /etc/systemd/system/elasticsearch.service.d/override.conf

file containing these lines:

*[Service]*
*LimitMEMLOCK=infinity*

*& putting this option  *

**`xpack.ml.enabled: false`*  o*n top of the elasticsearch.yml file made it