emqx / emqx-bridge-mqtt

Bridge of MQTT (deprecated since EMQX v5)
https://www.emqx.com
Apache License 2.0
37 stars 13 forks source link

emqx-bridge-mqtt start failed #139

Open happtim opened 2 years ago

happtim commented 2 years ago

emqx version 4.3.11 try load emqx-bridge-mqtt ,but failed. this is error in log directory

2022-03-17T15:51:55.477000+08:00 [error] Supervisor: {local,emqx_bridge_mqtt_sup}. Context: start_error. Reason: {badmatch,{ok,[]}}. Offender: id=aws,pid=undefined. 2022-03-17T15:51:55.477000+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.456.0>, registered_name: [], exit: {{{shutdown,{failed_to_start_child,aws,{badmatch,{ok,[]}}}},{emqx_bridge_mqtt_app,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,138}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}, ancestors: [<0.455.0>], message_queue_len: 1, messages: [{'EXIT',<0.457.0>,normal}], links: [<0.455.0>,<0.44.0>], dictionary: [], trap_exit: true, status: running, heap_size: 610, stack_size: 28, reductions: 237; neighbours: 2022-03-17T15:51:55.478000+08:00 [error] [Plugins] Load plugin emqx_bridge_mqtt failed, cannot start plugin emqx_bridge_mqtt for {{shutdown,{failed_to_start_child,aws,{badmatch,{ok,[]}}}},{emqx_bridge_mqtt_app,start,[normal,[]]}} 2022-03-17T15:51:55.480000+08:00 [error] State machine emqx_bridge_worker_aws terminating. Reason: {badmatch,{ok,[]}}. Stack: [{replayq,get_commit_hist,1,[{file,"replayq.erl"},{line,506}]},{replayq,find_segnos_to_delete,2,[{file,"replayq.erl"},{line,416}]},{replayq,delete_consumed_and_list_rest,1,[{file,"replayq.erl"},{line,403}]},{replayq,open,1,[{file,"replayq.erl"},{line,90}]},{emqx_bridge_worker,init,1,[{file,"emqx_bridge_worker.erl"},{line,236}]},{gen_statem,init_it,6,[{file,"gen_statem.erl"},{line,766}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]. State: {undefined,undefined}. 2022-03-17T15:51:55.480000+08:00 [error] crasher: initial call: emqx_bridge_worker:init/1, pid: <0.459.0>, registered_name: [], error: {{badmatch,{ok,[]}},[{replayq,get_commit_hist,1,[{file,"replayq.erl"},{line,506}]},{replayq,find_segnos_to_delete,2,[{file,"replayq.erl"},{line,416}]},{replayq,delete_consumed_and_list_rest,1,[{file,"replayq.erl"},{line,403}]},{replayq,open,1,[{file,"replayq.erl"},{line,90}]},{emqx_bridge_worker,init,1,[{file,"emqx_bridge_worker.erl"},{line,236}]},{gen_statem,init_it,6,[{file,"gen_statem.erl"},{line,766}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}, ancestors: [emqx_bridge_mqtt_sup,<0.457.0>], message_queue_len: 1, messages: [{'EXIT',<0.458.0>,{shutdown,{failed_to_start_child,aws,{badmatch,{ok,[]}}}}}], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 28, reductions: 10770; neighbours:

emqx-bridge-mqtt config below:

====================================================================

Configuration for EMQ X MQTT Broker Bridge

====================================================================

--------------------------------------------------------------------

Bridges to aws

--------------------------------------------------------------------

Bridge address: node name for local bridge, host:port for remote.

Value: String

Example: emqx@127.0.0.1, 127.0.0.1:1883

bridge.mqtt.aws.address = my server ip:1883

Protocol version of the bridge.

Value: Enum

- mqttv5

- mqttv4

- mqttv3

bridge.mqtt.aws.proto_ver = mqttv4

Start type of the bridge.

Value: enum

manual

auto

bridge.mqtt.aws.start_type = auto

Whether to enable bridge mode for mqtt bridge

This option is prepared for the mqtt broker which does not

support bridge_mode such as the mqtt-plugin of the rabbitmq

Value: boolean

bridge.mqtt.aws.bridge_mode = true

The ClientId of a remote bridge.

Placeholders:

${node}: Node name

Value: String

bridge.mqtt.aws.clientid = bridge_aws

The Clean start flag of a remote bridge.

Value: boolean

Default: true

NOTE: Some IoT platforms require clean_start

must be set to 'true'

bridge.mqtt.aws.clean_start = true

The username for a remote bridge.

Value: String

bridge.mqtt.aws.username = user

The password for a remote bridge.

Value: String

bridge.mqtt.aws.password = passwd

Topics that need to be forward to AWS IoTHUB

Value: String

Example: topic1/#,topic2/

bridge.mqtt.aws.forwards = #

Forward messages to the mountpoint of an AWS IoTHUB

Value: String

bridge.mqtt.aws.forward_mountpoint = /

Need to subscribe to AWS topics

Value: String

bridge.mqtt.aws.subscription.1.topic = cmd/topic1

Need to subscribe to AWS topics QoS.

Value: Number

bridge.mqtt.aws.subscription.1.qos = 1

A mountpoint that receives messages from AWS IoTHUB

Value: String

bridge.mqtt.aws.receive_mountpoint = receive/aws/

Bribge to remote server via SSL.

Value: on | off

bridge.mqtt.aws.ssl = off

PEM-encoded CA certificates of the bridge.

Value: File

bridge.mqtt.aws.cacertfile = etc/certs/cacert.pem

Client SSL Certfile of the bridge.

Value: File

bridge.mqtt.aws.certfile = etc/certs/client-cert.pem

Client SSL Keyfile of the bridge.

Value: File

bridge.mqtt.aws.keyfile = etc/certs/client-key.pem

SSL Ciphers used by the bridge.

Value: String

bridge.mqtt.aws.ciphers = TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256,TLS_AES_128_CCM_SHA256,TLS_AES_128_CCM_8_SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA

SSL peer validation with verify_peer or verify_none

More information at: http://erlang.org/doc/man/ssl.html

Value: true | false

bridge.mqtt.aws.verify = false

SSL hostname to be used in TLS Server Name Indication extension

Value: String | disable

bridge.mqtt.aws.server_name_indication = disable

Ciphers for TLS PSK.

Note that 'bridge.${BridgeName}.ciphers' and 'bridge.${BridgeName}.psk_ciphers' cannot

be configured at the same time.

See 'https://tools.ietf.org/html/rfc4279#section-2'.

bridge.mqtt.aws.psk_ciphers = PSK-AES128-CBC-SHA,PSK-AES256-CBC-SHA,PSK-3DES-EDE-CBC-SHA,PSK-RC4-SHA

Ping interval of a down bridge.

Value: Duration

Default: 10 seconds

bridge.mqtt.aws.keepalive = 60s

TLS versions used by the bridge.

NOTE: Do not use tlsv1.3 if emqx is running on OTP-22 or earlier

Value: String

bridge.mqtt.aws.tls_versions = tlsv1.3,tlsv1.2,tlsv1.1,tlsv1

Bridge reconnect time.

Value: Duration

Default: 30 seconds

bridge.mqtt.aws.reconnect_interval = 30s

Retry interval for bridge QoS1 message delivering.

Value: Duration

bridge.mqtt.aws.retry_interval = 20s

Publish messages in batches, only RPC Bridge supports

Value: Integer

default: 32

bridge.mqtt.aws.batch_size = 32

Inflight size.

0 means infinity (no limit on the inflight window)

Value: Integer

bridge.mqtt.aws.max_inflight_size = 32

Base directory for replayq to store messages on disk

If this config entry is missing or set to undefined,

replayq works in a mem-only manner.

Value: String

bridge.mqtt.aws.queue.replayq_dir = data/replayq/emqx_aws_bridge/

Replayq segment size

Value: Bytesize

bridge.mqtt.aws.queue.replayq_seg_bytes = 10MB

Replayq max total size

Value: Bytesize

bridge.mqtt.aws.queue.max_total_size = 5GB