当前位置:网站首页>中间件的一些坑记录
中间件的一些坑记录
2022-08-08 04:14:00 【qq_41617659】
mongodb
## 使用ssh隧道 , ssh隧道库: pip install sshtunnel
server = sshtunnel.open_tunnel((HOST, 36000),
ssh_username="leonahe",
ssh_password='TITwork123',
remote_bind_address=(MONGODB_HOST, 27017))
server.start() # server最好设定为全局变量
atexit.register(lambda : server.stop())
# 启动ssh隧道链接后,再链接mongodb
client = pymongo.MongoClient('127.0.0.1', server.local_bind_port, directConnection=True, username=MONGODB_USER, password=MONGODB_PASSWORD, authSource='admin' ) #同样对存在副本的情况也必须使用 directConnection=True
#使用代理 及分片,MONGODB_DATABASE_URI为 使用代理 host,port拼接的url
client = pymongo.MongoClient(MONGODB_DATABASE_URI, directConnection=True) #对于存在副本的情况必须添加directionConnnection参数
边栏推荐
猜你喜欢

This article will give you a thorough understanding of synchronized and Lock

08 获取器 withAttr、多连缀、whereRaw、事务、数据集《ThinkPHP6 入门到电商实战》

vulnhub-DC-5靶机渗透记录

基于MindSpore框架的数字调制信号盲识别研究

Amazon Cloud Technology Build On Learning Experience
![[opencv] Introduction to opencv development kit](/img/1a/7b60426d109c9f7231c67e4a4dad46.png)
[opencv] Introduction to opencv development kit

unity之粒子特效制作图片拼合文字效果

一行代码统计文本中指定字符串出现的次数

egg-validate-custom validation method error language (error Chinese prompt)

VSCode打开 C(嵌入式) 工程的一些记录
随机推荐
响应式pbootcms模板健身器械类网站
蓝牙 att gatt 协议
【opencv】opencv开发包简介
New User Plane Design and Key Technologies in the 6G Era
B. Reverse Binary Strings
[Code Analysis] Graph small sample anomaly detection method: GDN: Few-shot Network Anomaly Detection via Cross-network Meta-learning
awk语法-03-awk表达式(if语句、while循环、for循环)、awk中执行shell命令
Vulfocus Shooting Range Scenario Mode - Intranet Dead End
LeetCode_485_Maximum number of consecutive 1s
Basic introduction to NLP
topk()/eq( ) / gt( ) / lt( ) / t( )的用法
unity之粒子特效制作图片拼合文字效果
剑指Offer 18.删除链表的节点
vulnhub-DC-5 target drone penetration record
项目管理流程及各环节要点
Amazon Cloud Technology Build On Learning Experience
The live broadcast of agricultural products continues to heat up, Economic Daily: Don’t forget quality when rushing
[Graph Basics] How to Define Few-Shot Learning on Heterogeneous Graphs: Heterogeneous Graph Few-Shot Learning
Some excellent blog recommendations for Qt event learning reference
项目分析(嵌入式产品Web化)