zoukankan      html  css  js  c++  java
  • 错误记录 "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)

    就可以了。
  • 相关阅读:
    FTP-实例(Md5验证)
    Socket-实例
    函数对象、函数嵌套、名称空间与作用域、装饰器
    Docker——手动创建镜像
    Docker——桥接网络配置
    Docker——网络和存储(数据卷)
    Docker-PS命令解析
    面试题44:扑克牌的顺子
    面试题42:翻转单词顺序VS左旋转字符串
    面试题41:和为s的两个数字VS和为s的连续正数序列
  • 原文地址:https://www.cnblogs.com/KK150713/p/7561782.html
Copyright © 2011-2022 走看看