diff --git a/openquake/baselib/parallel.py b/openquake/baselib/parallel.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/parallel.py
+++ b/openquake/baselib/parallel.py
@@ -412,6 +412,10 @@ class Result(object):
                     'The master is at version %s while the worker %s is at '
                     'version %s' % (mon.version, socket.gethostname(),
                                     version))
+            if mon.config.dbserver.host != config.dbserver.host:
+                raise RuntimeError(
+                    'The master has dbserver.host=%s while the worker has %s'
+                    % (mon.config.dbserver.host, config.dbserver.host))
             with mon:
                 val = func(*args)
         except StopIteration:
@@ -780,6 +784,7 @@ class Starmap(object):
             monitor.backurl = 'tcp://%s:%s' % (
                 config.dbserver.host, self.socket.port)
             monitor.version = version
+            monitor.config = config
         OQ_TASK_NO = os.environ.get('OQ_TASK_NO')
         if OQ_TASK_NO is not None and self.task_no != int(OQ_TASK_NO):
             self.task_no += 1
Added a check on dbserver.host