Getting [opensearch-node2] Not yet initialized (you may need to run securityadmin) while running opensearch with docker compose

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

Describe the issue:
I am running open search with docker compose (followed this link Opensearch 2.15.0 · OpenSearch )
But got the following error,

opensearch-node2 | [2024-07-19T16:20:06,250][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:06,256][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-node2 | [2024-07-19T16:20:06,260][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:06,263][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-dashboards | {“type”:“log”,“@timestamp”:“2024-07-19T16:20:06Z”,“tags”:[“error”,“opensearch”,“data”],“pid”:1,“message”:“[ResponseError]: Response Error”}
opensearch-node2 | [2024-07-19T16:20:08,750][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:08,754][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-node2 | [2024-07-19T16:20:08,757][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:08,760][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-dashboards | {“type”:“log”,“@timestamp”:“2024-07-19T16:20:08Z”,“tags”:[“error”,“opensearch”,“data”],“pid”:1,“message”:“[ResponseError]: Response Error”}
opensearch-node2 | [2024-07-19T16:20:11,256][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:11,263][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-node2 | [2024-07-19T16:20:11,269][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node2] Not yet initialized (you may need to run securityadmin)
opensearch-node1 | [2024-07-19T16:20:11,273][ERROR][o.o.s.a.BackendRegistry ] [opensearch-node1] Not yet initialized (you may need to run securityadmin)
opensearch-dashboards | {“type”:“log”,“@timestamp”:“2024-07-19T16:20:11Z”,“tags”:[“error”,“opensearch”,“data”],“pid”:1,“message”:“[ResponseError]: Response Error”}
opensearch-node1 | [2024-07-19T16:20:12,781][ERROR][o.o.m.e.i.MLIndicesHandler] [opensearch-node1] Failed to create index .plugins-ml-config
opensearch-node1 | org.opensearch.cluster.block.IndexCreateBlockException: blocked by: [FORBIDDEN/10/cluster create-index blocked (api)];

Configuration:

Relevant Logs or Screenshots:

Hi @sandhyarathee,

Could you share your docker-compose.yml file?

thanks,
mj

Hi @Mantas ,
sure, I haven’t changed anything in my docker file, it same as it was given on the website

---
version: '3'
services:
  opensearch-node1:
    image: opensearchproject/opensearch:latest
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
      - bootstrap.memory_lock=true  # along with the memlock settings below, disables swapping
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m  # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
      - OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_INITIAL_ADMIN_PASSWORD}    # Sets the demo admin user password when using demo configuration, required for OpenSearch 2.12 and higher
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536  # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
        hard: 65536
    volumes:
      - opensearch-data1:/usr/share/opensearch/data
    ports:
      - 9200:9200
      - 9600:9600  # required for Performance Analyzer
    networks:
      - opensearch-net
  opensearch-node2:
    image: opensearchproject/opensearch:latest
    container_name: opensearch-node2
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node2
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
      - bootstrap.memory_lock=true
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
      - OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - opensearch-data2:/usr/share/opensearch/data
    networks:
      - opensearch-net
  opensearch-dashboards:
    image: opensearchproject/opensearch-dashboards:latest
    container_name: opensearch-dashboards
    ports:
      - 5601:5601
    expose:
      - '5601'
    environment:
      OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]'
    networks:
      - opensearch-net

volumes:
  opensearch-data1:
  opensearch-data2:

networks:
  opensearch-net:

@sandhyarathee, how do you set the ${OPENSEARCH_INITIAL_ADMIN_PASSWORD} do you use .env file?

best,
mj

Yes, I have .env file.

@Mantas Yes I have .env file.

@sandhyarathee, I`ve deployed OS using the same (default) docker-compose.yml with no issues in my lab.

Have you tried running securityadmin?

best,
mj