Skip to content

OpenSearch Security Initialization Error and Resolution

OpenSearch Security Initialization Error and Resolution in OpenSearch Issues.

3 min read Updated SS RS

OpenSearch Security Initialization Error and Resolution#

The security not initialized error in OpenSearch 7 was caused by a corrupted .opendistro_security index, which prevented the cluster from initializing correctly.

The logs indicated that OpenSearch was attempting to delay job executions but encountered an error during the authentication phase because the security configuration was not fully initialized.

2024-06-06 11:08:31.028 ERROR [opensearch[opensearch-kpi-node1]
[transport_worker][T#5]]
[org.opensearch.security.auth.BackendRegistry.authenticate(BackendRe
gistry.java:381)] - Not yet initialized (you may need to run
securityadmin)

The cluster repeatedly attempted to check the health of the .opendistro_security index but failed due to timeouts and index corruption.

RCA: The .opendistro_security index was corrupted, leading to failures in security initialization, and the OpenSearch cluster could not authenticate or initialize properly.

Solution :

  1. The security was disabled by updating the OpenSearch YAML configuration.
  2. Restart the OpenSearch.
  3. Once the OpenSearch is up and running, delete the above-mentioned index, and post that the cluster was formed.

"Master Not Discovered" Error on Elasticsearch Warm Data Node#

Issue : The Elasticsearch warm data node in LogScan encountered a "master not discovered " error during service restarts following an OS patch activity.

Solution :

  1. Observations from journalctl -u docker indicated that the local-kv.db, which is essential for Docker networking, was corrupted due to improper deletion of previous entries.
  2. Stop the Docker service on the affected host.
  3. Remove the corrupted database file:

    rm /var/lib/docker/network/local-kv.db
    
  4. Restart the Docker service.

OpenSearch Permission Changed#

OpenSearch permissions Changed inside the container. The issue is observed with OpenSearch permissions on the DB2 and DB3 nodes.

Below is the error in nomad logs.

2024-08-21T11:55:26.124834596+05:30 stderr F +     read -r envvar_key
envvar_value
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[
NOMAD_PARENT_CGROUP =~ ^[a-z0-9_]+\.[a-z0-9_]+     ]]
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[
NOMAD_PARENT_CGROUP == \p\r\o\c\e\s\s\o\r\s ]]
2024-08-21T11:55:26.124834596+05:30 stderr F +     IFS==
2024-08-21T11:55:26.124834596+05:30 stderr F +     read -r envvar_key
envvar_value
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[ container =~ ^[a-
z0-9_]+\.[a-z0-9_]+ ]]
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[ container ==
\p\r\o\c\e\s\s\o\r\s ]]
2024-08-21T11:55:26.124834596+05:30 stderr F +     IFS==
2024-08-21T11:55:26.124834596+05:30 stderr F +     read -r envvar_key
envvar_value
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[ _ =~ ^[a-z0-9_]+\.
[a-z0-9_]+ ]]
2024-08-21T11:55:26.124834596+05:30 stderr F +     [[ _ ==
\p\r\o\c\e\s\s\o\r\s ]]
2024-08-21T11:55:26.124834596+05:30 stderr F + IFS==
2024-08-21T11:55:26.124834596+05:30 stderr F + read -r envvar_key
envvar_value
2024-08-21T11:55:26.124834596+05:30 stderr F + export
'OPENSEARCH_JAVA_OPTS=-Dopensearch.cgroups.hierarchy.override=/ '
2024-08-21T11:55:26.124858056+05:30 stderr F +
OPENSEARCH_JAVA_OPTS='-Dopensearch.cgroups.hierarchy.override=/ '
2024-08-21T11:55:26.124939061+05:30 stderr F + set -m
2024-08-21T11:55:26.124952971+05:30 stderr F + export
OPENSEARCH_HOME=/usr/share/opensearch
2024-08-21T11:55:26.124960006+05:30 stderr   F +
OPENSEARCH_HOME=/usr/share/opensearch
2024-08-21T11:55:26.125001324+05:30 stderr   F + '[' 0 -gt 0 ']'
2024-08-21T11:55:26.125012848+05:30 stderr   F + su opensearch -c
/usr/share/opensearch/bin/opensearch
2024-08-21T11:55:26.140323577+05:30 stderr F bash:
/usr/share/opensearch/bin/opensearch: Permission denied

Solution: Since the OpenSearch image was corrupted, the file permissions inside the container were altered, preventing us from running any OpenSearch-related commands.

Hence, remove the corrupted OpenSearch image and restarted the service.

OpenSearch Shards Limit Issue#

  1. Data collection was interrupted because the maximum shard limit of 4000 was reached.
  2. The Data Receiver logs showed a bulk-indexing failure. Trimmed to the load-bearing error:

    [1/0 dispatcher] ERROR c.h.d.r.service.OpensearchPublisher - Failures during bulk indexing operations:
    {"index":"heal_collated_kpi_app_uat_2024.w46","type":"_doc",
     "cause":{"type":"validation_exception",
     "reason":"Validation Failed: 1: this action would add [6] total shards,
               but this cluster currently has [3999]/[4000] maximum shards open;"},
     "status":400}
    

RCA:

  1. The OpenSearch cluster comprises 4 nodes with a default shard limit of 1000 per node (total of 4000 shards).
  2. 3999 shards were already in use, preventing the creation of new indices.
  3. After removing old indices, data collection resumed without requiring a service restart.

Solution:

  1. Delete old, unnecessary indices using the OpenSearch curl command:

    curl -s -X DELETE -k -H 'Content-Type: application/json' -u
    'admin:admin' "https://<opensearch_ip>:9200/<index_name>"
    

    For Example :

    curl -s -X DELETE -k -H 'Content-Type: application/json' -u
    'admin:admin' "https://192.0.2.16:9200/heal_error_kpi_69c12345-
    2eaf-43sq-85de-169a3b2f099e_2023.w25"
    

Next — Return to the Troubleshooting Overview, or continue with the Percona Issues and Grafana Issues runbooks.