Write to DB hangs

I am just starting with foundationdb and trying the hello world example.
I build the source from the docker and able to create a new db and check its status via the fdbcli. Screenshot below.

Now when I try to run the hello_world example below:
1 import fdb
2 fdb.api_version(620)
3 db = fdb.open()
4 db[b’hello’] = b’world’
5 print ‘hello’, db[b’hello’]

The code hangs at line 4 and never returns.

Any pointers on how to proceed?

Your client hanging at the point where it first tries to use the database implies that it is not successfully able to connect. The most common reasons for this would be:

  1. You are using a different fdb.cluster file that doesn’t match the cluster
  2. You are using a client library (e.g. libfdb_c.so on linux) that is not compatible with the cluster (they need to have the same major minor version, such as 6.2).

There are other possibilities as well, such your client being unable to reach the server over the network (less likely if you are running fdbcli from the same place) or an issue with TLS configuration.

It looks like your fdbcli run is getting its cluster file from the current working directory. Are you running your Python program from the same directory? If not, then it’s worth checking that the cluster file it’s loading has the same contents (see Administration — FoundationDB 6.2).

One other way you can get a sense for what’s happening is to turn on trace logging for your client:

import fdb

After you’ve terminated your program, you can check the log file (trace*.xml) for events that suggest what is happening. If it can’t connect at all, I believe you’ll see a ConnectionTimedOut event. If it gets rejected for being incompatible, you’ll instead see something like IncompatibleProtocolVersion.