Openflow docker replicate set

Hi @Allan_Zimmermann ,
I’m trying to setup openflow in a new linux server using openflow on docker and the docker-compose.yaml file with replica_set but when I access my openflow url is displaying Bad Gateway.

In attempt to debug what is happening I saw this logs on mongo inside docker:

{"t":{"$date":"2023-02-18T11:02:53.118+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":29000}}
{"t":{"$date":"2023-02-18T11:03:03.547+00:00"},"s":"I",  "c":"CONTROL",  "id":20714,   "ctx":"LogicalSessionCacheRefresh","msg":"Failed to refresh session cache, will try again at the next refresh interval","attr":{"error":"NotYetInitialized: Replication has not yet been configured"}}
{"t":{"$date":"2023-02-18T11:03:03.550+00:00"},"s":"I",  "c":"CONTROL",  "id":20712,   "ctx":"LogicalSessionCacheReap","msg":"Sessions collection is not set up; waiting until next sessions reap interval","attr":{"error":"NamespaceNotFound: config.system.sessions does not exist"}}

I access mongo using: sudo docker container exec -it cf0a47e51e24 /bin/bash.

After that I run the command +rs.initiate() seems nothing happen:

I try to use with configs but no luck:

rs.initiate({
  _id : "rs0",
  members : [
    {_id : 0, host : "mongodb:27017"}
  ]
})

I appreciate your help. Thanks.

you need to start a mongo shell inside the container,
first type
mongosh ( or mongo if it’s an older image ) to get a mongo prompt.

I found the issue. When i made the replicaset example the shell was called mongo, but now it needs to be mongosh
So update the mongosetup script to use mongosh instead

  mongosetup:
    image: "mongo"
    depends_on:
      - mongodb
    restart: "no"
    command: >
      mongosh --host mongodb:27017 --eval 
      '
      db = (new Mongo("mongodb:27017")).getDB("openflow");
      config = {
      "_id" : "rs0",
      "members" : [
        {
          "_id" : 0,
          "host" : "mongodb:27017"
        }
      ]
      };
      rs.initiate(config);
      '

@Allan_Zimmermann
Thank you for letting me know, I will update the mongosetup script.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.