连接被对等方重置(rabbitmq)

xbp102n0  于 2022-12-29  发布在  RabbitMQ
关注(0)|答案(1)|浏览(207)
client side py

import pika, sys, os,ssl

def main():

    context =ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
    context.verify_mode = ssl.CERT_REQUIRED
    context.load_verify_locations("/home/dev/Desktop/files_from_ssh/ca_certificate.pem")

    credentials = pika.PlainCredentials(username='xxx', password='xxxx')
    conn_params = pika.ConnectionParameters(host="***",port=5672,heartbeat=60,ssl_options=pika.SSLOptions(context),
                                            virtual_host="test_environment",credentials=credentials)
    connection = pika.BlockingConnection(conn_params)
    channel = connection.channel()
    channel.queue_declare(queue='ssl_test')

    def callback(ch, method, properties, body):
        print(" [x] Received %r" % body)

    channel.basic_consume(queue='ssl_test', on_message_callback=callback, auto_ack=True)
    print(' [*] Waiting for messages. To exit press CTRL+C')

    channel.start_consuming()

if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print("Interrupted")
        try:
            sys.exit(0)
        except SystemExit:
            pass

在服务器端启用TLS
x一个一个一个一个x一个一个二个x
从该站点引用:https://pika.readthedocs.io/en/stable/examples/tls_server_authentication.html无法连接到服务器,有人能帮我一把吗有点新的rabbitmq这是错误我得到ConnectionResetError:[Errno 104]连接被对等方重置

qzwqbdag

qzwqbdag1#

我在这里回答了这个问题:
https://github.com/rabbitmq/rabbitmq-server/discussions/6776

    • 注意:**RabbitMQ团队监控rabbitmq-users邮件列表,仅在StackOverflow上偶尔回答问题。

相关问题