Unable to access Elasticsearch

Hi

I have installed Elasticsearch on my local Ubuntu machine today, but when I navigate to localhost:9200 I get the error:

# This page isn’t working
**127.0.0.1** didn’t send any data.
ERR_EMPTY_RESPONSE

When I run:

service elasticsearch status

I get:

● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-10-21 17:24:15 BST; 35s ago
       Docs: https://www.elastic.co
   Main PID: 26865 (java)
      Tasks: 84 (limit: 9337)
     Memory: 1.0G
        CPU: 1min 37.799s
     CGroup: /system.slice/elasticsearch.service
             ├─26865 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.type=deb -cp "/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/lib/cli-launcher/*" org.elasticsearch.launcher.CliToolLauncher -p /var/run/elasticsearch/elasticsearch.pid --quiet
             ├─26931 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -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 -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=SPI,COMPAT --add-opens=java.base/java.io=org.elasticsearch.preallocate --enable-native-access=org.elasticsearch.nativeaccess,org.apache.lucene.core -XX:ReplayDataFile=/var/log/elasticsearch/replay_pid%p.log -Djava.library.path=/usr/share/elasticsearch/lib/platform/linux-x64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib -Djna.library.path=/usr/share/elasticsearch/lib/platform/linux-x64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib -Des.distribution.type=deb -XX:+UnlockDiagnosticVMOptions -XX:G1NumCollectionsKeepPinned=10000000 -XX:+UseG1GC -Djava.io.tmpdir=/tmp/elasticsearch-8144689821219776054 --add-modules=jdk.incubator.vector -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log "-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,level,pid,tags:filecount=32,filesize=64m" -Xms512m -Xmx512m -XX:MaxDirectMemorySize=268435456 -XX:G1HeapRegionSize=4m -XX:InitiatingHeapOccupancyPercent=30 -XX:G1ReservePercent=15 --module-path /usr/share/elasticsearch/lib --add-modules=jdk.net --add-modules=ALL-MODULE-PATH -m org.elasticsearch.server/org.elasticsearch.bootstrap.Elasticsearch
             └─26954 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Oct 21 17:23:16 gary-Lenovo-ideapad-330S-15IKB systemd[1]: Starting Elasticsearch...
Oct 21 17:23:25 gary-Lenovo-ideapad-330S-15IKB systemd-entrypoint[26865]: Oct 21, 2024 5:23:25 PM sun.util.locale.provider.LocaleProviderAdapter <clinit>
Oct 21 17:23:25 gary-Lenovo-ideapad-330S-15IKB systemd-entrypoint[26865]: WARNING: COMPAT locale provider will be removed in a future release
Oct 21 17:23:36 gary-Lenovo-ideapad-330S-15IKB systemd-entrypoint[26865]: OpenJDK 64-Bit Server VM warning: You have loaded library /usr/lib/i386-linux-gnu/libsystemd.so.0.32.0 which might have disabled stack guard. The VM will try to fix the stack guard now
Oct 21 17:23:36 gary-Lenovo-ideapad-330S-15IKB systemd-entrypoint[26865]: It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Oct 21 17:24:15 gary-Lenovo-ideapad-330S-15IKB systemd[1]: Started Elasticsearch.

any idea what I'm doing wrong?

Hi @Gary_Foster
You're going to have to include a lot more information.

What version are you on?

Exactly. How did you install?

Are you following our documentation?

Most likely if it's a 8. X recent release elasticsearch is installed automatically with https and authentication

The configuration authentication would have come up on the console during the install process.

So tell us what you did?
And perhaps we can help.

The first step is to try to curl Elasticsearch.

From the Ubuntu box

curl -v -k -u elastic https://localhost:9200

Run the command and show the output.

Hi Stephen,

I followed the ElasticSearch instructions with the .deb file.

But, having taken a look at why I am trying to install it, I need 6.8. I am trying to install Open-CSP which requires the older version.

I will give the 6.8 a go and see if that works.

Hi @Gary_Foster

Right so you should have followed this to the connection
Check Running

curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200

With respect to 6.8 that is truly truly ancient..
Be sure you follow those docs as so much has changed...