我的机器上安装了 Docker 版本 - Docker Desktop 4.3.0 (71786)。我正在尝试使用以下命令在 Docker 上安装 VerneMQ -
docker run -d -p 1883:1883 -e "DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on" -e "DOCKER_VERNEMQ_ACCEPT_EULA=yes" --name vernemq1 -d erlio/docker-vernemq
contianer 的 Docker 日志如下 -
config is OK
-config /vernemq/data/generated.configs/app.2021.12.14.09.57.29.config -args_file /vernemq/bin/../etc/vm.args -vm_args /vernemq/bin/../etc/vm.args
Exec: /vernemq/bin/../erts-10.2.3/bin/erlexec -boot /vernemq/bin/../releases/1.10.0/vernemq -config /vernemq/data/generated.configs/app.2021.12.14.09.57.29.config -args_file /vernemq/bin/../etc/vm.args -vm_args /vernemq/bin/../etc/vm.args -pa /vernemq/bin/../lib/erlio-patches -- console -noshell -noinput
Root: /vernemq/bin/..
09:57:30.806 [info] writing state {[{[{actor,<<21,128,87,20,226,202,145,175,203,97,17,207,239,134,39,35,203,238,93,163>>}],1}],{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[['VerneMQ@172.17.0.2',{[{actor,<<21,128,87,20,226,202,145,175,203,97,17,207,239,134,39,35,203,238,93,163>>}],1}]],[],[],[],[],[],[],[],[],[],[],[],[],[]}}},{dict,0,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}} to disk <<75,2,131,80,0,0,0,248,120,1,203,96,206,97,96,96,96,204,96,130,82,41,12,172,137,201,37,249,69,185,64,81,17,209,134,112,145,71,167,38,174,63,157,40,120,254,125,155,186,242,233,119,177,139,179,18,25,179,50,56,83,24,88,82,50,147,75,18,25,19,5,128,144,35,49,32,209,32,67,32,11,13,100,48,130,196,192,6,131,8,166,20,6,161,176,212,162,188,84,223,64,7,67,115,35,61,67,115,61,3,61,35,210,108,70,181,1,225,14,6,194,238,64,213,10,0,36,44,78,211>>
09:57:30.827 [info] Datadir ./data/meta/meta/0 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,43756361}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:31.273 [info] Datadir ./data/meta/meta/1 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,54479016}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:31.585 [info] Datadir ./data/meta/meta/2 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,45466763}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:31.914 [info] Datadir ./data/meta/meta/3 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,33567655}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:32.245 [info] Datadir ./data/meta/meta/4 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,47595779}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:32.699 [info] Datadir ./data/meta/meta/5 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,39556020}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:33.062 [info] Datadir ./data/meta/meta/6 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,61685232}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:33.379 [info] Datadir ./data/meta/meta/7 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,55978245}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:33.688 [info] Datadir ./data/meta/meta/8 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,34857794}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:34.016 [info] Datadir ./data/meta/meta/9 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,59026771}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:34.474 [info] Datadir ./data/meta/meta/10 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,51575312}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:34.888 [info] Datadir ./data/meta/meta/11 options for LevelDB: [{open,[{block_cache_threshold,33554432},{block_restart_interval,16},{block_size_steps,16},{compression,true},{create_if_missing,true},{delete_threshold,1000},{eleveldb_threads,71},{fadvise_willneed,false},{limited_developer_mem,false},{sst_block_size,4096},{tiered_slow_level,0},{total_leveldb_mem_percent,6},{use_bloomfilter,true},{write_buffer_size,49221877}]},{read,[{verify_checksums,true}]},{write,[{sync,false}]},{fold,[{verify_checksums,true},{fill_cache,false}]}]
09:57:35.579 [info] Try to start vmq_plumtree: ok
09:57:40.035 [info] Try to start vmq_generic_msg_store: ok
09:57:40.151 [info] loaded 0 subscriptions into vmq_reg_trie
09:57:40.153 [info] cluster event handler 'vmq_cluster' registered
09:57:44.398 [warning] session stopped abnormally due to '{cant_parse_connect_fixed_header,<<"GET / HTTP/1.1\r\nHost: localhost:1883\r\nConnection: Upgrade\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36\r\nUpgrade: websocket\r\nOrigin: chrome-extension://hemojaaeigabkbcookmlgmdigohjobjm\r\nSec-WebSocket-Version: 13\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9,hi;q=0.8\r\nSec-WebSocket-Key: M4Jd7MuPOr8ENM1q4wsqpQ==\r\nSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\nSec-WebSocket-Protocol: mqttv3.1\r\n\r\n">>}'
码头工人检查结果 -
[
{
"Id": "28c7f34dfe5af201b7786a8b14d4a856914fac0d88d528a3f335c910",
"Created": "2021-12-14T09:57:24.5409484Z",
"Path": "start_vernemq",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 19341,
"ExitCode": 0,
"Error": "",
"StartedAt": "2021-12-14T10:04:56.1632278Z",
"FinishedAt": "2021-12-14T10:03:05.3115524Z",
"Health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2021-12-14T10:01:31.8393179Z",
"End": "2021-12-14T10:01:32.4156947Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2021-12-14T10:02:02.5563049Z",
"End": "2021-12-14T10:02:03.0990371Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2021-12-14T10:02:33.2237707Z",
"End": "2021-12-14T10:02:33.7814843Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2021-12-14T10:03:03.9905476Z",
"End": "2021-12-14T10:03:04.5533888Z",
"ExitCode": 0,
"Output": ""
},
{
"Start": "2021-12-14T10:05:26.1645268Z",
"End": "2021-12-14T10:05:26.7281332Z",
"ExitCode": 0,
"Output": ""
}
]
}
},
"Image": "sha256:c313a97d55f84087e216fb18c06e0f410f5ded6ee089c5",
"ResolvConfPath": "/var/lib/docker/containers/28c7f34dfe5af201b6914fac0d88d528a3f335c910/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/28c7f34dfe5af8b14d4a856914fac0d88d528a3f335c910/hostname",
"HostsPath": "/var/lib/docker/containers/28c7f34dfe5af20d88d528a3f335c910/hosts",
"LogPath": "/var/lib/docker/containers/28c7f34dfe5af201ac0d88d528a3f335c910/28c7f34dfe5af201b77a941b00c86a8b14d4a856914fac0d88
d528a3f335c910-json.log",
"Name": "/vernemq1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"1883/tcp": [
{
"HostIp": "",
"HostPort": "1883"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
24,
162
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/6738d5b2c9b935c3e90e370c21d03a5-init/diff:/var/lib/docker/overlay2/b48a41a3
92eb834cafd6f1579f005/diff:/var/lib/docker/overlay2/2237dca228f720bd3a37e53ba6b74fdfb/diff:/var/
lib/docker/overlay2/8f7ee085d6a04e/diff:/var/lib/docker/overlay2/18116350a96478ab3bb8250c294e58643d02a48bd89808e/diff:/var/lib/docker/overlay2/94f83d29c8304416d9709b034f/diff:/var/lib/docker/overlay2/1780d5340ed788d9c9f/diff",
"MergedDir": "/var/lib/docker/overlay2/6730c21d03a5/merged",
"UpperDir": "/var/lib/docker/overlay2/67383a5/diff",
"WorkDir": "/var/lib/docker/overlay2/6738d5b2370c21d03a5/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "77d02c57bafdc9275cc6bc",
"Source": "/var/lib/docker/volumes/77d02c57bafdc92750b6cc6bc/_data",
"Destination": "/vernemq/data",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "bb3402031f3fd09c821d41db",
"Source": "/var/lib/docker/volumes/bb3402031f3f9c821d41db/_data",
"Destination": "/vernemq/etc",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "3f79aa44ce3328f73c1093",
"Source": "/var/lib/docker/volumes/3f79aa44cead0ec3c1093/_data",
"Destination": "/vernemq/log",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "28c4dfe5a",
"Domainname": "",
"User": "vernemq",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"1883/tcp": {},
"4369/tcp": {},
"44053/tcp": {},
"8080/tcp": {},
"8883/tcp": {},
"8888/tcp": {},
"9100/tcp": {},
"9101/tcp": {},
"9102/tcp": {},
"9103/tcp": {},
"9104/tcp": {},
"9105/tcp": {},
"9106/tcp": {},
"9107/tcp": {},
"9108/tcp": {},
"9109/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on",
"DOCKER_VERNEMQ_ACCEPT_EULA=yes",
"PATH=/vernemq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DOCKER_VERNEMQ_KUBERNETES_LABEL_SELECTOR=app=vernemq",
"DOCKER_VERNEMQ_LOG__CONSOLE=console",
"VERNEMQ_VERSION=1.10.0"
],
"Cmd": [
"start_vernemq"
],
"Healthcheck": {
"Test": [
"CMD-SHELL",
"vernemq ping | grep -q pong"
]
},
"Image": "erlio/docker-vernemq",
"Volumes": {
"/vernemq/data": {},
"/vernemq/etc": {},
"/vernemq/log": {}
},
"WorkingDir": "/vernemq",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "b3906e648f42f4ed49f98e521",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"1883/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "1883"
}
],
"4369/tcp": null,
"44053/tcp": null,
"8080/tcp": null,
"8883/tcp": null,
"8888/tcp": null,
"9100/tcp": null,
"9101/tcp": null,
"9102/tcp": null,
"9103/tcp": null,
"9104/tcp": null,
"9105/tcp": null,
"9106/tcp": null,
"9107/tcp": null,
"9108/tcp": null,
"9109/tcp": null
},
"SandboxKey": "/var/run/docker/netns/b3906e6f42",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "6e5e5d38da00cc6c6cc",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:48:ac:11:11:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "1a2a19e811b79bbb7e6dca53047fc1a",
"EndpointID": "6e5e5d38da00ca77724b7586c6cc",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
现在当我尝试连接到 VerneMQ 时,我不能。我正在尝试通过 1883 端口使用 TCP://172.17.0.2 进行连接。
有人可以帮助我在哪里犯错。
注意:我没有更改配置文件。
编辑: 使用 MQTTLens chrome 扩展与 MQTT 连接。
EDIT2 我试图使用各种可用的 MQTT 客户端进行连接,但它们似乎都不适合我。但是当使用 C# 代码(MQTTnet Nuget 包)访问代理时,它似乎正在工作。我现在面临的唯一问题是 MQTT 版本。
当我将版本设置为 MqttProtocolVersion.V500 时,连接会引发异常,我将得到的错误是
10:48:57.303 [warning] invalid protocol version for {[],undefined} 5
.
现在剩下的问题是,如何配置 VerneMQ 容器以接受最新的 Protocol V500?
var factory = new MqttFactory();
mqttClient = factory.CreateMqttClient();
var temp_options = new MqttClientOptions() { ClientId = clientId };
temp_options.ChannelOptions = new MqttClientTcpOptions()
{
Server = ipAddress,
Port = port
};
temp_options.CleanSession = true;
temp_options.KeepAlivePeriod = TimeSpan.FromHours(10);
temp_options.ProtocolVersion = MQTTnet.Formatter.MqttProtocolVersion.V311;
//temp_options.ProtocolVersion = MQTTnet.Formatter.MqttProtocolVersion.V500;
await mqttClient.ConnectAsync(temp_options, CancellationToken.None);