While install opensearch2.12.0 its shows fail to connect the port 9200

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): 2.12.0

Configuration:

# ======================== OpenSearch Configuration =========================
#
# NOTE: OpenSearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.opensearch.org
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# OpenSearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of cluster-manager-eligible nodes:
#
#cluster.initial_cluster_manager_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Remote Store -----------------------------------
# Controls whether cluster imposes index creation only with remote store enabled
# cluster.remote_store.enabled: true
#
# Repository to use for segment upload while enforcing remote store for an index
# node.attr.remote_store.segment.repository: my-repo-1
#
# Repository to use for translog upload while enforcing remote store for an index
# node.attr.remote_store.translog.repository: my-repo-1
#
# ---------------------------------- Experimental Features -----------------------------------
# Gates the visibility of the experimental segment replication features until they are production ready.
#
#opensearch.experimental.feature.segment_replication_experimental.enabled: false
#
# Gates the functionality of a new parameter to the snapshot restore API
# that allows for creation of a new index type that searches a snapshot
# directly in a remote repository without restoring all index data to disk
# ahead of time.
#
#opensearch.experimental.feature.searchable_snapshot.enabled: false
#
#
# Gates the functionality of enabling extensions to work with OpenSearch.
# This feature enables applications to extend features of OpenSearch outside of
# the core.
#
#opensearch.experimental.feature.extensions.enabled: false
#
#
# Gates the optimization of datetime formatters caching along with change in default datetime formatter
# Once there is no observed impact on performance, this feature flag can be removed.
#
#opensearch.experimental.optimization.datetime_formatter_caching.enabled: false

Relevant Logs or Screenshots:

-bash-4.2# sudo systemctl status opensearch-2.12.0.service
● opensearch-2.12.0.service - OpenSearch 2.12.0
   Loaded: loaded (/etc/systemd/system/opensearch-2.12.0.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2024-03-11 16:10:12 UTC; 22ms ago
 Main PID: 10679 (bash)
   CGroup: /system.slice/opensearch-2.12.0.service
           ├─10679 bash /etc/systemd/system/opensearch-2.12.0/bin/opensearch
           ├─10691 bash /etc/systemd/system/opensearch-2.12.0/bin/opensearch
           └─10692 /etc/systemd/system/opensearch-2.12.0/jdk/bin/java -version

Mar 11 16:10:12 ip-172-31-4-236.us-west-2.compute.internal systemd[1]: opensearch-2.12.0.service holdoff time over, scheduling restart.
Mar 11 16:10:12 ip-172-31-4-236.us-west-2.compute.internal systemd[1]: Stopped OpenSearch 2.12.0.
Mar 11 16:10:12 ip-172-31-4-236.us-west-2.compute.internal systemd[1]: Started OpenSearch 2.12.0.
-bash-4.2# curl -X GET http://localhost:9200
curl: (7) Failed to connect to localhost port 9200 after 0 ms: Couldn't connect to server

Hi @rathiga ,

Please send your configuration again. It’s quite hard to read which line is uncommented.

@rathiga Could you please check if you have any error messages in the OpenSearch logs?

# ======================== OpenSearch Configuration =========================
#
# NOTE: OpenSearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.opensearch.org
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# OpenSearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of cluster-manager-eligible nodes:
#
#cluster.initial_cluster_manager_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Remote Store -----------------------------------
# Controls whether cluster imposes index creation only with remote store enabled
# cluster.remote_store.enabled: true
#
# Repository to use for segment upload while enforcing remote store for an index
# node.attr.remote_store.segment.repository: my-repo-1
#
# Repository to use for translog upload while enforcing remote store for an index
# node.attr.remote_store.translog.repository: my-repo-1
#
# ---------------------------------- Experimental Features -----------------------------------
# Gates the visibility of the experimental segment replication features until they are production ready.
#
#opensearch.experimental.feature.segment_replication_experimental.enabled: false
#
# Gates the functionality of a new parameter to the snapshot restore API
# that allows for creation of a new index type that searches a snapshot
# directly in a remote repository without restoring all index data to disk
# ahead of time.
#
#opensearch.experimental.feature.searchable_snapshot.enabled: false
#
#
# Gates the functionality of enabling extensions to work with OpenSearch.
# This feature enables applications to extend features of OpenSearch outside of
# the core.
#
#opensearch.experimental.feature.extensions.enabled: false
#
#
# Gates the optimization of datetime formatters caching along with change in default datetime formatter
# Once there is no observed impact on performance, this feature flag can be removed.
#
#opensearch.experimental.optimization.datetime_formatter_caching.enabled: false

Please try to add formatting as follows:

```
your configuration
```

Caused by: org.opensearch.OpenSearchException: plugins.security.ssl.transport.keystore_filepath or plugins.security.ssl.transport.server.pemcert_filepath and plugins.security.ssl.transport.client.pemcert_filepath must be set if transport ssl is requested.
        at org.opensearch.security.ssl.DefaultSecurityKeyStore.initTransportSSLConfig(DefaultSecurityKeyStore.java:487) ~[?:?]
        at org.opensearch.security.ssl.DefaultSecurityKeyStore.initSSLConfig(DefaultSecurityKeyStore.java:298) ~[?:?]
        at org.opensearch.security.ssl.DefaultSecurityKeyStore.<init>(DefaultSecurityKeyStore.java:204) ~[?:?]
        at org.opensearch.security.ssl.OpenSearchSecuritySSLPlugin.<init>(OpenSearchSecuritySSLPlugin.java:235) ~[?:?]
        at org.opensearch.security.OpenSearchSecurityPlugin.<init>(OpenSearchSecurityPlugin.java:295) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:  486) ~[?:?]
        at org.opensearch.plugins.PluginsService.loadPlugin(PluginsService.java: 783) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.plugins.PluginsService.loadBundle(PluginsService.java: 732) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.plugins.PluginsService.loadBundles(PluginsService.java: 533) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.plugins.PluginsService.<init>(PluginsService.java:195)  ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.node.Node.<init>(Node.java:486) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.node.Node.<init>(Node.java:413) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:242) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.Bootstrap.setup(Bootstrap.java:242) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.Bootstrap.init(Bootstrap.java:404) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:181) ~[opensearch-2.12.0.jar:2.12.0]
        ... 6 more

You need to configure security plugin or disable security.

To configure plugin with demo configuration, please execute ./opensearch-tar-install.sh script.

-bash-4.2# ./opensearch-tar-install.sh
OpenSearch 2.12.0 onwards, the OpenSearch Security Plugin introduces a change that requires an initial password for 'admin' user.
Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string.
If a password is not provided, the setup will quit.
For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/insta                                                                                               ll-opensearch/tar/
### OpenSearch Security Demo Installer
### ** Warning: Do not use on production or public reachable systems **
OpenSearch install type: .tar.gz on Linux 5.10.75-79.358.amzn2.x86_64 amd64
OpenSearch config dir: /etc/systemd/system/opensearch-2.12.0/config/
OpenSearch config file: /etc/systemd/system/opensearch-2.12.0/config/opensearch.yml
OpenSearch bin dir: /etc/systemd/system/opensearch-2.12.0/bin/
OpenSearch plugins dir: /etc/systemd/system/opensearch-2.12.0/plugins/
OpenSearch lib dir: /etc/systemd/system/opensearch-2.12.0/lib/
Detected OpenSearch Version: 2.12.0
Detected OpenSearch Security Version: 2.12.0.0
No custom admin password found. Please provide a password via the environment variable OPENSEA                                                                                               RCH_INITIAL_ADMIN_PASSWORD.
-bash-4.2# $ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin
-bash: $: command not found
-bash-4.2# $ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>
-bash: syntax error near unexpected token `newline'
-bash-4.2# curl -X GET https://localhost:9200 -u 'admin:<custom-admin-password>' --insecure
curl: (7) Failed to connect to localhost port 9200 after 0 ms: Couldn't connect to server

Hi @rathiga

You need to execute the following command:

export OPENSEARCH_INITIAL_ADMIN_PASSWORD="add_here_your_strong_password"

After that, please try to execute ./opensearch-tar-install.sh script.

Which operating system do you use for installing OpenSearch?

Hi
I already followed the above mentioned steps & I am using linux

Please try to use a stronger password again. What exactly is the version of your operating system? Thanks

Amazon Linux 2.

As per the message that you receive after executing ./opensearch-tar-install.sh script, you need to set an environment variable in the operating system. What message did you receive after executing this command?

-bash-4.2# ./opensearch-tar-install.sh
OpenSearch 2.12.0 onwards, the OpenSearch Security Plugin introduces a change that requires an initial password for 'admin' user.
Please define an environment variable 'OPENSEARCH_INITIAL_ADMIN_PASSWORD' with a strong password string.
If a password is not provided, the setup will quit.
For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/tar/
### OpenSearch Security Demo Installer
### ** Warning: Do not use on production or public reachable systems **
OpenSearch install type: .tar.gz on Linux 5.10.75-79.358.amzn2.x86_64 amd64
OpenSearch config dir: /opt/opensearch-2.12.0/config/
OpenSearch config file: /opt/opensearch-2.12.0/config/opensearch.yml
OpenSearch bin dir: /opt/opensearch-2.12.0/bin/
OpenSearch plugins dir: /opt/opensearch-2.12.0/plugins/
OpenSearch lib dir: /opt/opensearch-2.12.0/lib/
Detected OpenSearch Version: 2.12.0
Detected OpenSearch Security Version: 2.12.0.0
/opt/opensearch-2.12.0/config/opensearch.yml seems to be already configured for Security. Quit.
done security
done plugins
k-NN libraries not found in LD_LIBRARY_PATH. Updating path to: :/opt/opensearch-2.12.0/plugins/opensearch-knn/lib.
Starting OpenSearch
WARNING: Using incubator modules: jdk.incubator.vector
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.opensearch.bootstrap.OpenSearch (file:/opt/opensearch-2.12.0/lib/opensearch-2.12.0.jar)
WARNING: Please consider reporting this to the maintainers of org.opensearch.bootstrap.OpenSearch
WARNING: System::setSecurityManager will be removed in a future release
Mar 28, 2024 12:41:31 PM sun.util.locale.provider.LocaleProviderAdapter <clinit>
WARNING: COMPAT locale provider will be removed in a future release
[2024-03-28T12:41:32,162][ERROR][o.o.b.OpenSearchUncaughtExceptionHandler] [ip-172-31-4-236.us-west-2.compute.internal] uncaught exception in thread [main]
org.opensearch.bootstrap.StartupException: java.lang.RuntimeException: can not run opensearch as root
        at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:185) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.OpenSearch.execute(OpenSearch.java:172) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:104) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.cli.Command.mainWithoutErrorHandling(Command.java:138) ~[opensearch-cli-2.12.0.jar:2.12.0]
        at org.opensearch.cli.Command.main(Command.java:101) ~[opensearch-cli-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:138) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:104) ~[opensearch-2.12.0.jar:2.12.0]
Caused by: java.lang.RuntimeException: can not run opensearch as root
        at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.Bootstrap.setup(Bootstrap.java:191) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.Bootstrap.init(Bootstrap.java:404) ~[opensearch-2.12.0.jar:2.12.0]
        at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:181) ~[opensearch-2.12.0.jar:2.12.0]
        ... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run opensearch as root
        at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
        at org.opensearch.bootstrap.Bootstrap.setup(Bootstrap.java:191)
        at org.opensearch.bootstrap.Bootstrap.init(Bootstrap.java:404)
        at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:181)
        at org.opensearch.bootstrap.OpenSearch.execute(OpenSearch.java:172)
        at org.opensearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:104)
        at org.opensearch.cli.Command.mainWithoutErrorHandling(Command.java:138)
        at org.opensearch.cli.Command.main(Command.java:101)
        at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:138)
        at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:104)
For complete error details, refer to the log at /opt/opensearch-2.12.0/logs/opensearch.log
-