Standalone MongoDB setup fails

Issue #18 resolved
Toni Sissala created an issue

./kuha_document_store/scripts/setup_mongodb.sh --replica xxx.xxx.xxx.xxx:27017 --replicaset ''
Give database administrator username
Admin username: admin
Give database administrator password
Admin password: 
Running operation setup_database ...
setup_database result:
MotorDatabase(Database(MongoClient(host=['xxx.xxx.xxx.xxx:27017'], document_class=dict, tz_aware=False, connect=False, replicaset='', driver=DriverInfo(name='Motor', version='2.5.1', platform='Tornado 6.1')), 'kuha_document_store'))
Running operation setup_collections ...
Traceback (most recent call last):
  File "kuha2/kuha_document_store-env/bin/kuha_db_setup", line 11, in <module>
    load_entry_point('kuha-document-store==1.0.0', 'console_scripts', 'kuha_db_setup')()
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/kuha_document_store/dbadmin/operations.py", line 235, in main
    IOLoop.current().run_sync(lambda fun=op_fun: fun())
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/tornado/ioloop.py", line 530, in run_sync
    return future_cell[0].result()
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/kuha_document_store/dbadmin/operations.py", line 58, in wrapper
    result = await func(_ops.settings)
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/kuha_document_store/dbadmin/operations.py", line 132, in setup_collections
    new_coll = await ops_setup.app_db.create_collection(collection.name,
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/motor/frameworks/tornado/__init__.py", line 119, in _wrapper
    result = await f(self, *args, **kwargs)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/database.py", line 416, in create_collection
    with self.__client._tmp_session(session) as s:
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1948, in _tmp_session
    s = self._ensure_session(session)
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1935, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1883, in __start_session
    server_session = self._get_server_session()
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1921, in _get_server_session
    return self._topology.get_server_session()
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/topology.py", line 520, in get_server_session
    session_timeout = self._check_session_support()
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/topology.py", line 499, in _check_session_support
    self._select_servers_loop(
  File "kuha2/kuha_document_store-env/lib/python3.8/site-packages/pymongo/topology.py", line 218, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: client is configured to connect to a replica set named '' but this node belongs to a set named 'None', Timeout: 30s, Topology Description: <TopologyDescription id: 62382f6bac99cbf731e71553, topology_type: Single, servers: [<ServerDescription ('xxx.xxx.xxx.xxx', 27017) server_type: Unknown, rtt: None, error=ConfigurationError("client is configured to connect to a replica set named '' but this node belongs to a set named 'None'")>]>

Comments (1)

  1. Toni Sissala reporter

    Merged in bugfix/18-standalone-mongo-setup-fails (pull request #11)

    Interpret a replicaset with an empty string as a standalone Mongo instance

    DBAdmin package is unable to setup a standalone MongoDB instance, since it incorrectly interprets a replicaset value ''. Fix the interpretation to dbadmin/operations.py.

    Explicitly include replicaset in URI for client connections. Add replicaset connection URI parameter for DocumentStoreDatabase connections. It is not required but may speedup the initial connection.

    Add tests against made changes. Fix failing test at test_forking.py.

    Write changelog for 1.0.1 with todays date.

    Bump version.

    Fixes #18 at Bitbucket

    → <<cset 07e637df9815>>

  2. Log in to comment