当前位置:网站首页>中间件的一些坑记录
中间件的一些坑记录
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参数
边栏推荐
- CARLA 笔记(05)— Actors and blueprints(创建和修改 Blueprint、生成 Spawning、使用 Handling、销毁 Destruction)
- 高薪程序员&面试题精讲系列134之微服务网关有哪些限流算法?如何实现限流?
- 模拟登录——添加cookies,使用postmanget请求网页数据
- Basic introduction to NLP
- 测试岗电话面试——必问题型
- JS 怎么使用十六进制保存100位状态的问题
- VSCode打开 C(嵌入式) 工程的一些记录
- 产品经理必备的19类工具网站
- leetcode 70. Stair Climbing Dynamic Programming
- 【保研面试】英文问题
猜你喜欢

NetCore使用Dapper查询数据

VSCode opens some records of C (embedded) projects

NetCore uses Dapper to query data

Data labeling platform doccano----Introduction, installation, use, pit record

Research on Blind Recognition of Digital Modulated Signal Based on MindSpore Framework

失业在家的6个月,我通过外包全款买了房:你看不起的行业,往往很赚钱

leetcode 112.路经总和 递归

Awk syntax-03-awk expressions (if statements, while loops, for loops), execute shell commands in awk

Mini Program Optimization Practice

保姆级教程!Golang微服务简洁架构实战
随机推荐
[opencv] Introduction to opencv development kit
【论文分享】异质图上的小样本学习:HG-Meta: Graph Meta-learning over Heterogeneous Graphs
CARLA 笔记(05)— Actors and blueprints(创建和修改 Blueprint、生成 Spawning、使用 Handling、销毁 Destruction)
一文带你彻底了解synchronized 和 Lock
使用z-file和七牛云对象存储构建个人网盘
Video Signal Loss Detection Based on Image 2D Entropy (Signal Loss Detection)
leetcode: 455. 分发饼干
内修昇思MindSpore AI框架,外重行业汇聚,华为大模型的不平凡之路
蓝牙 att gatt 协议
NetCore使用Dapper查询数据
【Template Engine】velocity
初出茅庐的小李第115篇博客项目笔记之国产GD32F103RCT6基础工程创建
Usage of topk()/eq( ) / gt( ) / lt( ) / t( )
高薪程序员&面试题精讲系列134之微服务网关有哪些限流算法?如何实现限流?
MindFusion.WPF Pack 2022.R1
This article will give you a thorough understanding of synchronized and Lock
egg-session stores data to redis
如何在推荐系统中玩转知识图谱
Codeforces Round #684 (Div. 1)
torch.view()函数用法