WSL:ERROR / MainProcess]使用者:无法连接到amqp:// guest:**@127.0.0.1:5672 //:套接字已关闭

阿尔瓦罗

我无法使用芹菜和WSL打开插座。

请参阅以下信息:

  • []输出celery -A proj report
software -> celery:3.1.26.post2 (Cipater) kombu:3.0.37 py:3.6.7
            billiard:3.3.0.23 py-amqp:1.4.9
platform -> system:Linux arch:64bit, ELF imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:pyamqp results:disabled
BROKER_URL: 'amqp://guest:********@localhost:5672//'
  • []pip freeze期中的内容

我正在使用pipenv。点文件:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
django = "*"
django-allauth = "*"
django-crispy-forms = "*"
django-debug-toolbar = "==1.10."
numpy = "==1.15.3"
colorama = "==0.4.0"
dateparser = "==0.7.0"
django-extensions = "*"
python-binance = "*"
misaka = "*"
django-celery = "*"
celery = "*"

[requires]
python_version = "3.6"

重现步骤

我在WSL:

  1. 须藤apt-get install Rabbitmq-server

  2. sudo服务rabbitmq服务器重启

  3. chmod -R 777 ./ ##否则我没有权限

其他资讯

task.py:

from celery import Celery

# app = Celery('tasks', broker='amqp://jm-user1:sample@localhost/jm-vhost')
# app = Celery('tasks', broker='amqp://guest@localhost//')
app = Celery('tasks', broker='pyamqp://guest@localhost//')

@app.task
def add(x, y):
    return x + y

rabbitmqctl状态:

[{pid,1716},
 {running_applications,
     [{rabbit,"RabbitMQ","3.6.10"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.3.0"},
      {ssl,"Erlang/OTP SSL application","8.2.3"},
      {public_key,"Public key infrastructure","1.5.2"},
      {asn1,"The Erlang ASN1 compiler version 5.0.4","5.0.4"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.6.10"},
      {xmerl,"XML parser","1.3.16"},
      {crypto,"CRYPTO","4.2"},
      {os_mon,"CPO  CXC 138 46","2.4.4"},
      {compiler,"ERTS  CXC 138 10","7.1.4"},
      {mnesia,"MNESIA  CXC 138 12","4.15.3"},
      {syntax_tools,"Syntax tools","2.1.4"},
      {sasl,"SASL  CXC 138 11","3.1.1"},
      {stdlib,"ERTS  CXC 138 10","3.4.3"},
      {kernel,"ERTS  CXC 138 10","5.4.1"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:192] [kernel-poll:true]\n"},
 {memory,
     [{total,55943096},
      {connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,0},
      {queue_procs,2744},
      {queue_slave_procs,0},
      {plugins,0},
      {other_proc,19080304},
      {mnesia,65712},
      {metrics,184888},
      {mgmt_db,0},
      {msg_index,42728},
      {other_ets,1769840},
      {binary,62120},
      {code,21390833},
      {atom,891849},
      {other_system,12634158}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,6791299072},
 {disk_free_limit,50000000},
 {disk_free,100481589248},
 {file_descriptors,
     [{total_limit,924},{total_used,2},{sockets_limit,829},{sockets_used,0}]},
 {processes,[{limit,1048576},{used,165}]},
 {run_queue,0},
 {uptime,4073},
 {kernel,{net_ticktime,60}}]

输出:

运行时:celery -A tasks worker --loglevel=info得到以下输出:

 -------------- celery@Alvaro-Laptop v3.1.26.post2 (Cipater)
---- **** -----
--- * ***  * -- Linux-4.4.0-17763-Microsoft-x86_64-with-Ubuntu-18.04-bionic
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app:         tasks:0x7fd7952bcf60
- ** ---------- .> transport:   amqp://guest:**@localhost:5672//
- ** ---------- .> results:     disabled://
- *** --- * --- .> concurrency: 12 (prefork)
-- ******* ----
--- ***** ----- [queues]
 -------------- .> celery           exchange=celery(direct) key=celery


[tasks]
  . tasks.add

[2019-01-23 08:38:30,538: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: Socket closed.
Trying again in 2.00 seconds...

[2019-01-23 08:38:32,543: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: Socket closed.
Trying again in 4.00 seconds...

如何打开插座以进行通讯?

塞尔吉·扎哈奇琴科(Serge Zaharchenko)

检查rabbitmq是否已启动并正在运行。启用管理控制台:

sudo rabbitmq-plugins enable rabbitmq_management

然后http://localhost:15672使用访客/访客作为凭证访问查找概述页面>端口和上下文。

如果AMQP绑定到IPv6(::),则可能是问题所在。打开rabbitmq服务器配置:

sudo vi /etc/rabbitmq/rabbitmq-env.conf 

并注释掉

# By default RabbitMQ will bind to all interfaces, on IPv4 and IPv6 if
# available. Set this if you only want to bind to one network interface or#
# address family.
NODE_IP_ADDRESS=127.0.0.1

然后重新启动服务:

sudo service rabbitmq-server restart

并再次检查与RabbitMQ的连接

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

zookeeper无法打开localhost / 0:0:0:0:0:0:0:0:1:2181的套接字

连接到Java套接字时,为什么getInetAddress()返回/ 0:0:0:0:0:0:0:0:1?

已断开连接,收到连接:无法连接到amqp:// guest @ {rabbitTestHost:5672}:5672

使用 setockopt;当套接字从另一侧关闭时,read 返回 0 而不是 -1

使用者:无法连接到amqp:// user:** @ localhost:5672 //:[Errno 111]连接被拒绝

无法在127.0.0.1:0处连接到Redis:连接被拒绝(使用init脚本关闭带有unix套接字的redis服务器时)

拒绝连接:使用gRPC的localhost / 0:0:0:0:0:0:0:1:9000

使用request.getRemoteAddr()返回0:0:0:0:0:0:0:0:1

RabbitMqBundle使用者退出,异常为“读取数据时出错。接收到0而不是预期的1个字节”和“管道断开或关闭的连接”

失败Err:无法连接到任何etcd端点-etcd:0/1已连接:kubeadm

java.net.ConnectException:无法通过Spring Bot中的Selenium Java使用ChromeDriver Chrome连接到localhost / 0:0:0:0:0:0:1:1731

WARN服务器无效,意外的错误会话为0x0,关闭套接字连接,并尝试重新连接

使用者和生产者失败,并显示错误:“在读取响应之前,已断开与0的连接”

Django Celery-无法连接到amqp://[email protected]:5672 //

org.apache.http.conn.HttpHostConnectException:连接到localhost:19538 [localhost / 0:0:0:0:0:0:0:0:1]失败:连接被拒绝(连接被拒绝)

如何使用a [0]-a [0] a [1]-a [0] a [1] a [2]输出数组

无法打开设备eth0:eth0:套接字:无效的参数

MongoNetworkError:与本地主机的连接0:27017已关闭

Python 套接字绑定报告端口已被使用但套接字 connect_ex 返回 0

INFO客户端/127.0.0.1:48452的关闭的套接字连接,其会话ID为0x15698f5ac360001(org.apache.zookeeper.server.NIOServerCnxn)

TCP连接:重新创建已关闭的套接字

重新连接Web套接字(如果已关闭)

收到握手响应之前,套接字连接已关闭

C++ 通过套接字发送包含 \0 的文件而不会意外关闭

Linux上的Java套接字错误(已发送0xFF,已接收-3)

C ++如何使用select查看套接字是否已关闭

Django通道套接字未连接到使用者

IPv6回送地址http:// 0:0:0:0:0:0:0:1-浏览器无法连接。方法getRemoteHost()

AMQP 0-9-1和1-0