推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Gerry123
V2EX  ›  Python

请问大家 Python 应用如何通过代理服务器访问多个外网服务器啊?

  •  
  •   Gerry123 · Nov 1, 2023 · 2157 views
    This topic created in 928 days ago, the information mentioned may be changed or developed.

    因为业务需要,公司内部服务 python 应用需要访问到远程的数据库,数据库有多个,都分布在外网,python 应用不能直接访问这些外网数据库,中间需要有个代理,这个代理服务器到这些外网服务器网络是通的,python 应用到这个代理服务器的网络也是通的(已开墙),请问大家 python 应用如何通过这个代理服务器访问多个外网服务器啊?

    4 replies    2023-11-02 18:22:38 +08:00
    chiron688
        1
    chiron688  
       Nov 1, 2023
    ssh 隧道啊 sshtunnel 这个包你可以了解一下.....或者外网服务器开 socks5 代理,不过感觉最好的,还是在代理服务器上做个 ipt 转发,转发数据库的端口之类的,一个数据库对应一个端口,要用哪个就改成哪个端口
    initObject
        2
    initObject  
       Nov 2, 2023 via Android
    代理服务器用 Haproxy 或者 nginx 做四层反代即可
    Gerry123
        3
    Gerry123  
    OP
       Nov 2, 2023
    @chiron688 谢谢,我用了 socks5 代理,在代理服务器上安装了 dante
    Gerry123
        4
    Gerry123  
    OP
       Nov 2, 2023
    @initObject 谢谢,我用了 socks5 代理,在代理服务器上安装了 dante
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2812 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:26 · PVG 22:26 · LAX 07:26 · JFK 10:26
    ♥ Do have faith in what you're doing.