Can't use MongoDB CLI to connect to Document Layer Docker image

TL;DR: I can’t connect to the Document Layer with the mongo shell.

I tried using the foundationdb/fdb-document-layer Docker image to try out the Document Layer. I ran:

docker run -it foundationdb/fdb-document-layer bash

I then updated the fdb.cluster file to a running FoundationDB instance, then ran:

scripts/fdbdoc.bash

And I got:

Starting FDB Document Layer on 172.17.0.3:27016

I then installed the MongoDB CLI mongo and tried to connect with (within the same container):

mongo 127.0.0.1:27016

But got an error from mongo:

Error: couldn't connect to server 127.0.0.1:27016, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27016 :: caused by :: Connection refused :

I’ve tried using different IPs, localhost, etc. and have had no success. Furthermore, starting the layer manually with:

fdbdoc -l 127.0.0.1:27016

gives the same error.

I also tried using the debian Docker image and installing the Document Layer manually, but still had no success. Is this a bug or am I doing something wrong? Thanks for the help!

Document Layer is a layer on top of FoundationDB. You need to also run FoundationDB for this to work. The Docker image is not a standalone docker image, it doesn’t contain FoundationDB as well. Best way to run Docker would be to use docker-compose and make Document Layer docker instance depend on FoundationDB. If you are not comfortable playing with docker-compose, I suggest using packages, follow the steps mentioned in the documentation. Essense is you need to run FoundationDB and point Document Layer to it. Also, trace logs are more useful than stdout for debugging.

I was running a FoundationDB instance in a separate container. I also updated the cluster file on the Document Layer container. The problem was that the Document Layer was not reachable. In fact, using

lsof -i -P -n

there was nothing listening on port ‘27016’.

That proves Document Layer is waiting on something. Usual reason is it failed to connect to FDB, due to the nature of FDB client, it would just wait on FDB forever in some cases. If your process didn’t fail but just waiting that most likely is the case. Trace logs would provide some information.

Document Layer works just like any other FDB application. You have to configure Document Layer with correct version client. You can find some info here - https://apple.github.io/foundationdb/api-general.html.

What is your FDB server version and Doc Layer version?

The Document Layer version is v1.7.2 and the server is v6.1.8 from the .deb package. I was able to get it to work by running the server in the same container as the Doc Layer (ie. the server was on 127.0.0.1). Will the Doc Layer only work when the FDB server is run on the same server?