简体   繁体   English

pymongo atlas 负载均衡器错误 ARM 设备

[英]pymongo atlas loadbalancer error ARM device

I get a LoadBalancerSupportMismatch error accessing my online mongo database/cluster from an ARM device (Jetson Xavier) running ubuntu 18.04 jetson version that came with it.我从运行 ubuntu 18.04 jetson 版本的 ARM 设备 (Jetson Xavier) 访问我的在线 mongo 数据库/集群时收到 LoadBalancerSupportMismatch 错误。 The code works on a normal x86 pc and is run using python 3.6 (I use 3.8 on the normal pc).该代码适用于普通的 x86 电脑,并使用 python 3.6 运行(我在普通电脑上使用 3.8)。 My code is straightforward.我的代码很简单。 I anonymized parts of it.我匿名了其中的一部分。

self.online_client = MongoClient(
                    f"mongodb+srv://<user>:<passowrd>}@<dbname>.pkphq.mongodb.net/Xcontainers?retryWrites=true&w=majority")
self.cloud_coll = self.online_client[<dbname>][<collection>]
self.cloud_coll.insert_one(some_dict)

The error I get on the jetson is:我在jetson上遇到的错误是:

File "/usr/local/lib/python3.6/dist-packages/pymongo/collection.py", line 1319, in find_one for result in cursor.limit(-1): File "/usr/local/lib/python3.6/dist-packages/pymongo/cursor.py", line 1207, in next if len(self.__data) or self._refresh(): File "/usr/local/lib/python3.6/dist-packages/pymongo/cursor.py", line 1100, in _refresh self.__session = self.__collection.database.client._ensure_session() File "/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py", line 1816, in _ensure_session return self.__start_session(True, causal_consistency=False) File "/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py", line 1766, in __start_session server_session = self._get_server_session() File "/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py", line 1802, in _get_server_session return self._topology.get_server_session() File "/usr/local/lib/python3.6/dist-packages/pymongo/topology.py", line 499, in get_server_session None) File "/u文件“/usr/local/lib/python3.6/dist-packages/pymongo/collection.py”,第 1319 行,在 find_one 中,结果为 cursor.limit(-1):文件“/usr/local/lib/python3 .6/dist-packages/pymongo/cursor.py”,第 1207 行,在下一个 if len(self.__data) 或 self._refresh():文件“/usr/local/lib/python3.6/dist-packages/ pymongo/cursor.py”,第 1100 行,在 _refresh self.__session = self.__collection.database.client._ensure_session() 文件“/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py”中,第 1816 行,在 _ensure_session 中返回 self.__start_session(True, causal_consistency=False) 文件“/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py”,第 1766 行,在 __start_session server_session = self. _get_server_session() 文件“/usr/local/lib/python3.6/dist-packages/pymongo/mongo_client.py”,第 1802 行,在 _get_server_session 返回 self._topology.get_server_session() 文件“/usr/local/lib/python3 .6/dist-packages/pymongo/topology.py”,第 499 行,在 get_server_session 无)文件“/u sr/local/lib/python3.6/dist-packages/pymongo/topology.py", line 217, in _select_servers_loop (self._error_message(selector), timeout, self.description)) pymongo.errors.ServerSelectionTimeoutError: The server is being accessed through a load balancer, but this driver does not have load balancing enabled, full error: {'ok': 0, 'errmsg': 'The server is being accessed through a load balancer, but this driver does not have load balancing enabled', 'code': 354, 'codeName': 'LoadBalancerSupportMismatch'}, Timeout: 30s, Topology Description: <TopologyDescription id: 61ee9d768a646fd4a74f0849, topology_type: Single, servers: [<ServerDescription ('containers-lb.pkphq.mongodb.net', 27017) server_type: Unknown, rtt: None, error=OperationFailure("The server is being accessed through a load balancer, but this driver does not have load balancing enabled, full error: {'ok': 0, 'errmsg': 'The server is being accessed through a load balancer, but this driver does not have load balancing enabled', 'code': sr/local/lib/python3.6/dist-packages/pymongo/topology.py",第 217 行,在 _select_servers_loop (self._error_message(selector), timeout, self.description)) pymongo.errors.ServerSelectionTimeoutError: 服务器是正在通过负载均衡器访问,但此驱动程序未启用负载均衡,完全错误:{'ok': 0, 'errmsg': '正在通过负载均衡器访问服务器,但此驱动程序没有负载均衡enabled','code':354,'codeName':'LoadBalancerSupportMismatch'},超时:30s,拓扑描述:<TopologyDescription id:61ee9d768a646fd4a74f0849,topology_type:Single,服务器:[<ServerDescription('containers-lb.pkphq.mongodb. net', 27017) server_type: Unknown, rtt: None, error=OperationFailure("正在通过负载均衡器访问服务器,但此驱动程序未启用负载均衡,完全错误:{'ok': 0, 'errmsg ': '正在通过负载均衡器访问服务器,但此驱动程序未启用负载均衡', 'code': 354, 'codeName': 'LoadBalancerSupportMismatch'}",)>]> [INFO] [1643027861.848502]: No id to push measurement 354, 'codeName': 'LoadBalancerSupportMismatch'}",)>]> [INFO] [1643027861.848502]: 没有 id 来推送测量

My little journey at resolving the issue brought me here, as pretty much the only thing that seemed relevant: https://www.mongodb.com/community/forums/t/scala-driver-2-9-0-connection-fails-with-loadbalancersupportmismatch/126525/2 .我解决问题的小旅程把我带到了这里,几乎唯一似乎相关的事情: https://www.mongodb.com/community/forums/t/scala-driver-2-9-0-connection-fails -with-loadbalancersupportmismatch/126525/2 So it appeared that the scala driver is not up to date.所以看起来 scala 驱动程序不是最新的。 It seems I need to update it using sbt or maven: http://mongodb.github.io/mongo-java-driver/4.3/driver-scala/getting-started/installation/ I set up the hardware quite recently, and it's up to date, so a bit puzzling why the driver isn't then up to date. It seems I need to update it using sbt or maven: http://mongodb.github.io/mongo-java-driver/4.3/driver-scala/getting-started/installation/ I set up the hardware quite recently, and it's最新的,所以有点令人费解,为什么驱动程序不是最新的。

Looking into the documentation of sbt and maven;查看 sbt 和 maven 的文档; it seems totally unrelated at worst and very complicated at best to get pymongo working properly again with mongo atlas.让 pymongo 与 mongo atlas 再次正常工作似乎在最坏的情况下完全不相关,而且在最好的情况下非常复杂。

Is there a better solution to make the load balancer issue go away, or get my driver up to date?是否有更好的解决方案可以使负载均衡器问题 go 消失,或者让我的驱动程序更新?

It seemed upgrading the cluster worked.似乎升级集群有效。 I first used M0 - M2 cluster.我首先使用了 M0 - M2 集群。 Paying more for M10 somehow fixed the issue.为 M10 支付更多费用以某种方式解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM