You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function is currently opening a direct connection to a shard with an URI not including username and password. While this works for testing clusters with no authentication enabled, this causes error in production clusters.
For example, this error is thrown when trying to call splitVector through a direct connection:
Traceback (most recent call last):
--
File "defragment_sharded_collection.py", line 1078, in <module>
loop.run_until_complete(main(args))
File "/usr/lib64/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "defragment_sharded_collection.py", line 959, in main
await asyncio.gather(*tasks)
File "defragment_sharded_collection.py", line 938, in split_oversized_chunks
await coll.split_chunk(c, target_chunk_size_kb, conn)
File "defragment_sharded_collection.py", line 112, in split_chunk
}, codec_options=self.cluster.client.codec_options)
File "/usr/lib64/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib64/python3.7/site-packages/pymongo/database.py", line 734, in command
**kwargs,
File "/usr/local/lib64/python3.7/site-packages/pymongo/database.py", line 615, in _command
client=self.__client,
File "/usr/local/lib64/python3.7/site-packages/pymongo/pool.py", line 764, in command
exhaust_allowed=exhaust_allowed,
File "/usr/local/lib64/python3.7/site-packages/pymongo/network.py", line 164, in command
parse_write_concern_error=parse_write_concern_error,
File "/usr/local/lib64/python3.7/site-packages/pymongo/helpers.py", line 180, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: command splitVector requires authentication, full error: {'operationTime': Timestamp(1658204283, 1), 'ok': 0.0, 'errmsg': 'command splitVector requires authentication', 'code': 13, 'codeName': 'Unauthorized', 'lastCommittedOpTime': Timestamp(1658204283, 1), '$clusterTime': {'clusterTime': Timestamp(1658204271, 1), 'signature': xx'_MANUALLY_OMITTED_xx'
}}
A user hardcoded username and password and everything worked:
diff common.py common.py.bak
--
131c131
< uri = 'mongodb://mongoadmin:password@' + conn_parts[1]
—
> uri = 'mongodb://' + conn_parts[1]
The text was updated successfully, but these errors were encountered:
The function is currently opening a direct connection to a shard with an URI not including username and password. While this works for testing clusters with no authentication enabled, this causes error in production clusters.
For example, this error is thrown when trying to call
splitVector
through a direct connection:A user hardcoded username and password and everything worked:
The text was updated successfully, but these errors were encountered: