• 错误记录 "MongoClient opened before fork. Create MongoClient "


    mongodb+pool多进程,在启动时会有如下提示:

    /home/kk/python3.6_kk/lib/python3.6/site-packages/pymongo/topology.py:145: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe>
    "MongoClient opened before fork. Create MongoClient "
    /home/kk/python3.6_kk/lib/python3.6/site-packages/pymongo/topology.py:145: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe>
    "MongoClient opened before fork. Create MongoClient "
    /home/kk/python3.6_kk/lib/python3.6/site-packages/pymongo/topology.py:145: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe>
    "MongoClient opened before fork. Create MongoClient "
    /home/kk/python3.6_kk/lib/python3.6/site-packages/pymongo/topology.py:145: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe>
    "MongoClient opened before fork. Create MongoClient "

    "MongoClient opened before fork. Create MongoClient "

    只需要在数据库连接时  加上,connect=False

    client=pymongo.MongoClient('localhost',27017,connect=False)

    就可以了。
  • 相关阅读:
    Word操作技巧
    x264命令行参数解释
    [翻译]TCP穿透NAT技术
    VC6随身笔记
    如何开启 Windows 2000 Server 上的远程桌面功能
    MFC基础知识整理
    用Windows Media编码器建网络电视直播站
    在线播放器代码大全
    关于嵌入式系统方向
    老外搜集的Windows快捷键大全(2007110更新)
  • 原文地址:https://www.cnblogs.com/KK150713/p/7561782.html
Copyright © 2020-2023  润新知