Hi
I create mongoDB replica with docker file
FROM mongo:latest
RUN echo "rs.initiate({'_id':'rs', members: [{'_id':1, 'host':'127.0.0.1:27017'}]});" > "/docker-entrypoint-initdb.d/init_replicaset.js"
RUN echo "12345678" > "/tmp/key.file"
RUN chmod 600 /tmp/key.file
RUN chown 999:999 /tmp/key.file
CMD ["mongod", "--replSet", "rs", "--bind_ip_all", "--keyFile", "/tmp/key.file", "--enableMajorityReadConcern"]
after run, i can’t connect to mongodb server via mongo compass and in log received this message
``json
{“t”:{"$date":“2022-06-20T09:46:27.333+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:22943, “ctx”:“listener”,“msg”:“Connection accepted”,“attr”:{“remote”:“152.228.145.0:46734”,“uuid”:“a7570807-78a9-4351-a963-6f785f9ea15b”,“connectionId”:7534,“connectionCount”:16}}
{“t”:{"$date":“2022-06-20T09:46:29.902+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:22943, “ctx”:“listener”,“msg”:“Connection accepted”,“attr”:{“remote”:“127.0.0.1:34196”,“uuid”:“fafcf29a-25ac-4a89-aa66-5f62b963bda7”,“connectionId”:7535,“connectionCount”:17}}
{“t”:{"$date":“2022-06-20T09:46:29.903+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:51800, “ctx”:“conn7535”,“msg”:“client metadata”,“attr”:{“remote”:“127.0.0.1:34196”,“client”:“conn7535”,“doc”:{“application”:{“name”:“MongoDB Shell”},“driver”:{“name”:“MongoDB Internal Client”,“version”:“5.0.9”},“os”:{“type”:“Linux”,“name”:“Ubuntu”,“architecture”:“x86_64”,“version”:“20.04”}}}}
{“t”:{"$date":“2022-06-20T09:46:29.932+00:00”},“s”:“I”, “c”:“ACCESS”, “id”:20250, “ctx”:“conn7535”,“msg”:“Authentication succeeded”,“attr”:{“mechanism”:“SCRAM-SHA-256”,“speculative”:true,“principalName”:“ramooz”,“authenticationDatabase”:“admin”,“remote”:“127.0.0.1:34196”,“extraInfo”:{}}}
{“t”:{"$date":“2022-06-20T09:46:29.943+00:00”},“s”:“I”, “c”:“COMMAND”, “id”:21577, “ctx”:“conn7535”,“msg”:“Initiate: no configuration specified. Using a default configuration for the set”}
{“t”:{"$date":“2022-06-20T09:46:29.944+00:00”},“s”:“I”, “c”:“COMMAND”, “id”:21578, “ctx”:“conn7535”,“msg”:“Created configuration for initiation”,“attr”:{“config”:"{ _id: “rs”, version: 1, members: [ { _id: 0, host: “f0f4572d950a:27017” } ] }"}}
{“t”:{"$date":“2022-06-20T09:46:29.944+00:00”},“s”:“I”, “c”:“REPL”, “id”:21356, “ctx”:“conn7535”,“msg”:“replSetInitiate admin command received from client”}
{“t”:{"$date":“2022-06-20T09:46:29.950+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:22944, “ctx”:“conn7535”,“msg”:“Connection ended”,“attr”:{“remote”:“127.0.0.1:34196”,“uuid”:“fafcf29a-25ac-4a89-aa66-5f62b963bda7”,“connectionId”:7535,“connectionCount”:16}}
Server selection timed out after 30000 ms