Comments (20)
I get the same error on my machine
from device-mqtt-go.
I tested on my Macbook Pro, but It shows same situation in Ubuntu 18.04.2 Desktop.
from device-mqtt-go.
@devFallingstar
It needs to modify 0.0.0.0 to your own MQTT broker IP in driver config file and then mount the config file to device-mqtt.
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/data
- /device-service-demo/mqtt:/custom-config
depends_on:
- data
- command
entrypoint:
- /device-mqtt
- --registry
- --confdir=/custom-config
from device-mqtt-go.
@weichou1229 Thanks for your help
After I change the host it shows another error:
edgex-device-mqtt | Init: useRegistry: true profile: confDir: /custom-config
edgex-device-mqtt | Check registry is up... http://localhost:8500
edgex-device-mqtt | Get http://localhost:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused
edgex-device-mqtt | Get http://localhost:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused
edgex-device-mqtt | Get http://localhost:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused
edgex-device-mqtt | error loading config file: can't get connection to Consul
edgex-device-mqtt exited with code 1
But I think I fixed it, I change the network setting in docker-compose.yml for device-mqtt.
Change
networks:
- edgex-network
to
network_mode: "host"
And It looks like working. I can check correct device information and message data within REST calls.
I don't know if this way is right or not, but I got what I want, so I'll close this issue.
Thanks.
from device-mqtt-go.
@devFallingstar set network_mode to host is a workaround, and should not be applied to production. The better way is to modify the correct host name or ip address in configuration-driver.toml
from device-mqtt-go.
@cloudxxx8 Hello, Thank you for the reply.
I set the hostname in configuration-driver.toml to my original host's IP like '192.168.xx.yy' but it doesn't change anything. Sine the configuration-driver.toml only control connections between broker and device service, I also change the registry host in configuration.toml, but it shows like below:
edgex-device-mqtt | Init: useRegistry: true profile: confDir: /custom-config
edgex-device-mqtt | Check registry is up... http://192.9.xx.yy:8500
edgex-device-mqtt | Register the Service ...
edgex-device-mqtt | Register the Health Check ...
edgex-device-mqtt | Register in registry...
edgex-device-mqtt | Calling service.Start.
edgex-device-mqtt | EnableRemote is false, using local log file
edgex-device-mqtt | INFO: 2019/02/24 21:44:15 Check Metadata service's status ...
edgex-device-mqtt | INFO: 2019/02/24 21:44:15 Check Data service's status ...
edgex-device-mqtt | ERROR: 2019/02/24 21:44:15 Error getting ping: Get http://localhost:48080/api/v1/ping: dial tcp 127.0.0.1:48080: connect: connection refused
edgex-device-mqtt | ERROR: 2019/02/24 21:44:15 Error getting ping: Get http://localhost:48081/api/v1/ping: dial tcp 127.0.0.1:48081: connect: connection refused
Is there anyway to fix it? Thank you.
from device-mqtt-go.
@devFallingstar first of all, we need to confirm your environment setting. that's the issue caused by incorrect host name. For example, the host of core-metadata and core-data here are localhost. It's incorrect in container network environment. The configuration.toml should refer to the sample in "docker" folder
https://github.com/edgexfoundry/device-mqtt-go/tree/master/cmd/res/docker
Could you please provide your docker-compose.yml, configuration.toml, and configuration-driver.toml for me? Thanks
from device-mqtt-go.
After saw the configuration.toml sample, I change each host of micro services from localhost
to proper alias like edgex-core-consul
. But I shows another error.
edgex-device-mqtt | panic: close of nil channel
edgex-device-mqtt |
edgex-device-mqtt | goroutine 89 [running]:
edgex-device-mqtt | github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho%2emqtt%2egolang.(*client).closeStop(0xc0003b0000)
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho.mqtt.golang/client.go:482 +0x12f
edgex-device-mqtt | github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho%2emqtt%2egolang.(*client).disconnect(0xc0003b0000)
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho.mqtt.golang/client.go:495 +0x2f
edgex-device-mqtt | github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho%2emqtt%2egolang.(*client).Disconnect(0xc0003b0000, 0x1388)
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/vendor/github.com/eclipse/paho.mqtt.golang/client.go:439 +0x1f9
edgex-device-mqtt | github.com/edgexfoundry/device-mqtt-go/internal/driver.startCommandResponseListening(0x89ec40, 0xc000381210)
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/internal/driver/responselistener.go:38 +0x54f
edgex-device-mqtt | github.com/edgexfoundry/device-mqtt-go/internal/driver.(*Driver).Initialize.func1()
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/internal/driver/driver.go:70 +0x26
edgex-device-mqtt | created by github.com/edgexfoundry/device-mqtt-go/internal/driver.(*Driver).Initialize
edgex-device-mqtt | /go/src/github.com/edgexfoundry/device-mqtt-go/internal/driver/driver.go:69 +0x8f
edgex-device-mqtt exited with code 2
These are my environment setting.
configuration.toml >>
[Service]
Host = "edgex-device-mqtt"
Port = 49982
ConnectRetries = 3
Labels = []
OpenMsg = "device mqtt started"
ReadMaxLimit = 256
Timeout = 5000
EnableAsyncReadings = true
AsyncBufferSize = 16
[Registry]
Host = "edgex-core-consul"
Port = 8500
CheckInterval = "10s"
FailLimit = 3
FailWaitTime = 10
[Clients]
[Clients.Data]
Name = "edgex-core-data"
Protocol = "http"
Host = "edgex-core-data"
Port = 48080
Timeout = 50000
[Clients.Metadata]
Name = "edgex-core-metadata"
Protocol = "http"
Host = "edgex-core-metadata"
Port = 48081
Timeout = 50000
[Clients.Logging]
Name = "edgex-support-logging"
Protocol = "http"
Host = "edgex-support-logging"
Port = 48061
[Device]
DataTransform = true
InitCmd = ""
InitCmdArgs = ""
MaxCmdOps = 128
MaxCmdValueLen = 256
RemoveCmd = ""
RemoveCmdArgs = ""
ProfilesDir = "./res/example"
[Logging]
EnableRemote = false
File = "./device-mqtt.log"
Level = "DEBUG"
# Pre-define Devices
[[DeviceList]]
Name = "MQTT test device"
Profile = "Test.Device.MQTT.Profile"
Description = "MQTT device is created for test purpose"
Labels = [ "MQTT", "test"]
[DeviceList.Addressable]
name = "Gateway address"
Protocol = "TCP"
Address = "0.0.0.0"
Port = 1883
Publisher = "CommandPublisher"
user = "admin"
password = "public"
topic = "CommandTopic"
# Pre-define Schedule Configuration
[[Schedules]]
Name = "mqtt-30sec-schedule"
Frequency = "PT30S"
[[ScheduleEvents]]
Name = "readRandnum"
Schedule = "mqtt-30sec-schedule"
[ScheduleEvents.Addressable]
HTTPMethod = "GET"
Path = "/api/v1/device/name/MQTT test device/testrandnum"
configuration-driver.toml >>
[Incoming]
Protocol = "tcp"
Host = "0.0.0.0"
Port = 1883
Username = "admin"
Password = "public"
Qos = 0
KeepAlive = 3600
MqttClientId = "IncomingDataSubscriber"
Topic = "DataTopic"
[Response]
Protocol = "tcp"
Host = "0.0.0.0"
Port = 1883
Username = "admin"
Password = "public"
Qos = 0
KeepAlive = 3600
MqttClientId = "CommandResponseSubscriber"
Topic = "ResponseTopic"
docker-compose.yml
# /*******************************************************************************
# * Copyright 2018 Dell Inc.
# *
# * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# * in compliance with the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software distributed under the License
# * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# * or implied. See the License for the specific language governing permissions and limitations under
# * the License.
# *
# * @author: Jim White, Dell
# * EdgeX Foundry, Delhi, version 0.7.1
# * added: Dec 10, 2018
# *******************************************************************************/
version: '3'
volumes:
db-data:
log-data:
consul-config:
consul-data:
portainer_data:
services:
volume:
image: edgexfoundry/docker-edgex-volume:0.6.0
container_name: edgex-files
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
consul:
image: consul:1.1.0
ports:
- "8400:8400"
- "8500:8500"
- "8600:8600"
container_name: edgex-core-consul
hostname: edgex-core-consul
networks:
edgex-network:
aliases:
- edgex-core-consul
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- volume
config-seed:
image: edgexfoundry/docker-core-config-seed-go:0.7.1
container_name: edgex-config-seed
hostname: edgex-core-config-seed
networks:
edgex-network:
aliases:
- edgex-core-config-seed
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- volume
- consul
mongo:
image: edgexfoundry/docker-edgex-mongo:0.6.0
ports:
- "27017:27017"
container_name: edgex-mongo
hostname: edgex-mongo
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- volume
logging:
image: edgexfoundry/docker-support-logging-go:0.7.1
ports:
- "48061:48061"
container_name: edgex-support-logging
hostname: edgex-support-logging
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- config-seed
- mongo
- volume
notifications:
image: edgexfoundry/docker-support-notifications-go:0.7.1
ports:
- "48060:48060"
container_name: edgex-support-notifications
hostname: edgex-support-notifications
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- logging
metadata:
image: edgexfoundry/docker-core-metadata-go:0.7.1
ports:
- "48081:48081"
container_name: edgex-core-metadata
hostname: edgex-core-metadata
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- logging
data:
image: edgexfoundry/docker-core-data-go:0.7.1
ports:
- "48080:48080"
- "5563:5563"
container_name: edgex-core-data
hostname: edgex-core-data
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- logging
command:
image: edgexfoundry/docker-core-command-go:0.7.1
ports:
- "48082:48082"
container_name: edgex-core-command
hostname: edgex-core-command
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- metadata
scheduler:
image: edgexfoundry/docker-support-scheduler-go:0.7.1
ports:
- "48085:48085"
container_name: edgex-support-scheduler
hostname: edgex-support-scheduler
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- metadata
export-client:
image: edgexfoundry/docker-export-client-go:0.7.1
ports:
- "48071:48071"
container_name: edgex-export-client
hostname: edgex-export-client
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- data
environment:
- EXPORT_CLIENT_MONGO_URL=edgex-mongo
- EXPORT_CLIENT_DISTRO_HOST=export-distro
- EXPORT_CLIENT_CONSUL_HOST=edgex-config-seed
export-distro:
image: edgexfoundry/docker-export-distro-go:0.7.1
ports:
- "48070:48070"
- "5566:5566"
container_name: edgex-export-distro
hostname: edgex-export-distro
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- export-client
environment:
- EXPORT_DISTRO_CLIENT_HOST=export-client
- EXPORT_DISTRO_DATA_HOST=edgex-core-data
- EXPORT_DISTRO_CONSUL_HOST=edgex-config-seed
- EXPORT_DISTRO_MQTTS_CERT_FILE=none
- EXPORT_DISTRO_MQTTS_KEY_FILE=none
rulesengine:
image: edgexfoundry/docker-support-rulesengine:0.7.0
ports:
- "48075:48075"
container_name: edgex-support-rulesengine
hostname: edgex-support-rulesengine
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
#################################################################
# Device Services
#################################################################
device-virtual:
image: edgexfoundry/docker-device-virtual:0.6.0
ports:
- "49990:49990"
container_name: edgex-device-virtual
hostname: edgex-device-virtual
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
depends_on:
- data
- command
device-mqtt:
image: edgexfoundry/docker-device-mqtt-go:0.7.1
ports:
- "49982:49982"
container_name: edgex-device-mqtt
hostname: edgex-device-mqtt
#network_mode: "host"
networks:
- edgex-network
volumes:
- db-data:/data/db
- log-data:/edgex/logs
- consul-config:/consul/config
- consul-data:/consul/data
- /home/imes/mqtt:/custom-config
depends_on:
- data
- command
entrypoint:
- /device-mqtt
- --registry
- --confdir=/custom-config
#################################################################
# Tooling
#################################################################
portainer:
image: portainer/portainer
ports:
- "9000:9000"
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
depends_on:
- volume
networks:
edgex-network:
driver: "bridge"
...
from device-mqtt-go.
@devFallingstar
In configuration-driver.toml , the Host is not 0.0.0.0, it shoud be your MQTT broker IP and Port also depend on MQTT broker port
from device-mqtt-go.
@devFallingstar if you run the mqtt broker on the same host, the ip address should be the virtual docker network ip, such as 172..x.x.1
Please use ifconfig or ipconfig on your host to see the ip address
from device-mqtt-go.
@devFallingstar please close this issue if you can make it work now. thanks
from device-mqtt-go.
@cloudxxx8 Ah sorry,
after change the ip to 172.x.x.1 which refer to virtual docker network ip, it works.
Thank you.
from device-mqtt-go.
hello,
i folowing this issue for my config, but one error still here when i start device-mqtt-go :
Get http://edgex-core-consul:8500/v1/agent/self: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
edgex-device-mqtt | error loading config file: can't get connection to Consul
any idea ?
from device-mqtt-go.
@kaponz
What is your Edgex version? Do you follow the doc https://docs.edgexfoundry.org/Ch-ExamplesAddingMQTTDevice.html?
from device-mqtt-go.
@weichou1229
yes i folow this documentation, and i use the delhi version.
from device-mqtt-go.
@kaponz Please use the Edinburgh release. The doc is base on the Edinburgh release.
from device-mqtt-go.
@weichou1229 ok i try with the Edinburgh release but now i have this error :
edgex-device-mqtt | Init: useRegistry: profile: docker confDir: /res
edgex-device-mqtt | Loading configuration from: /res/docker/configuration.toml
edgex-device-mqtt |
edgex-device-mqtt | Bypassing registration in registry...
edgex-device-mqtt | Calling service.Start.
edgex-device-mqtt | EnableRemote is true, using remote logging service
edgex-device-mqtt | level=INFO ts=2019-09-18T08:51:40.147935625Z app=edgex-device-mqtt source=init.go:137 msg="Check Metadata service's status ..."
edgex-device-mqtt | level=INFO ts=2019-09-18T08:51:40.162996557Z app=edgex-device-mqtt source=init.go:137 msg="Check Data service's status ..."
^[[Cedgex-device-mqtt | Post http://edgex-support-logging:48061/api/v1/logs: dial tcp 172.19.0.7:48061: i/o timeout
edgex-device-mqtt | level=ERROR ts=2019-09-18T08:52:10.149426915Z app=edgex-device-mqtt source=init.go:148 msg="Error getting ping: Get http://edgex-core-metadata:48081/api/v1/ping: dial tcp 172.19.0.6:48081: i/o timeout "
edgex-device-mqtt | Post http://edgex-support-logging:48061/api/v1/logs: dial tcp 172.19.0.7:48061: i/o timeout
edgex-device-mqtt | level=ERROR ts=2019-09-18T08:52:10.163406316Z app=edgex-device-mqtt source=init.go:148 msg="Error getting ping: Get http://edgex-core-data:48080/api/v1/ping: dial tcp 172.19.0.8:48080: i/o timeout "
from device-mqtt-go.
Could you provide your docker-compose file and configuration file ?
from device-mqtt-go.
configuration.txt
docker-compose.txt
from device-mqtt-go.
@kaponz I modify the configuration and attach the zip file.
- You can run an MQTT broker by
docker run -d --rm --name broker -p 1883:1883 eclipse-mosquitto
- Startup the EdgeX by
docker-compose up -d
- Watch the device mqtt logs by
docker logs edgex-device-mqtt
Init: useRegistry: consul://edgex-core-consul:8500 profile: confDir: /custom-config
Check registry is up... http://edgex-core-consul:8500
Register in registry...
Calling service.Start.
EnableRemote is true, using remote logging service
level=INFO ts=2019-09-20T01:58:19.8299732Z app=edgex-device-mqtt source=init.go:137 msg="Check Metadata service's status ..."
level=INFO ts=2019-09-20T01:58:19.8299879Z app=edgex-device-mqtt source=init.go:137 msg="Check Data service's status ..."
level=INFO ts=2019-09-20T01:58:19.835089Z app=edgex-device-mqtt source=init.go:47 msg="Service clients initialize successful."
level=INFO ts=2019-09-20T01:58:19.8361316Z app=edgex-device-mqtt source=loader.go:237 msg="listen for config changes from Registry"
level=INFO ts=2019-09-20T01:58:19.8469325Z app=edgex-device-mqtt source=loader.go:261 msg="Writeable configuration has been updated. Setting log level to INFO"
level=INFO ts=2019-09-20T01:58:19.8601776Z app=edgex-device-mqtt source=service.go:149 msg="Device Service edgex-device-mqtt exists"
level=INFO ts=2019-09-20T01:58:19.8875808Z app=edgex-device-mqtt source=driver.go:279 msg="Create MQTT client and connection: uri=tcp://:@192.168.0.2:1883 clientID=CommandResponseSubscriber "
level=INFO ts=2019-09-20T01:58:19.8876898Z app=edgex-device-mqtt source=service.go:120 msg="*Service Start() called, name=edgex-device-mqtt, version=1.0.0"
level=INFO ts=2019-09-20T01:58:19.8877393Z app=edgex-device-mqtt source=service.go:126 msg="Listening on port: 49982"
level=INFO ts=2019-09-20T01:58:19.8878076Z app=edgex-device-mqtt source=service.go:127 msg="Service started in: 103.4183ms"
level=INFO ts=2019-09-20T01:58:19.8885312Z app=edgex-device-mqtt source=driver.go:279 msg="Create MQTT client and connection: uri=tcp://:@192.168.0.2:1883 clientID=IncomingDataSubscriber "
level=INFO ts=2019-09-20T01:58:19.8970139Z app=edgex-device-mqtt source=responselistener.go:52 msg="[Response listener] Start command response listening. "
level=INFO ts=2019-09-20T01:58:19.8978212Z app=edgex-device-mqtt source=incominglistener.go:54 msg="[Incoming listener] Start incoming data listening. "
For the detail setting, you can refer to this documentation https://docs.edgexfoundry.org/Ch-ExamplesAddingMQTTDevice.html
from device-mqtt-go.
Related Issues (20)
- Add "make lint" target and add to "make test" target
- Bump device-sdk-go version and update configuration.toml
- What will be the path to mqtt-scripts HOT 2
- How to receive another data frame. HOT 2
- Upgrade github.com/eclipse/paho.mqtt.golang from 1.3.5 to 1.4.1 HOT 1
- How to recognize the command from which devices. HOT 2
- Testping command returns EOF HOT 3
- ERROR: libcurl-7.80.0-r1: package mentioned in index not found. HOT 2
- fail to unmarshal event, AddEventRequest.Event.Readings[0].ValueType field validation failed on the edgex-dto-value-type tag HOT 6
- why started http2write command with mutil threads , but for many devices ,all of concur size of http is only 4? HOT 7
- How to run built image via docker run, and via docker-compose file HOT 6
- 编译2.3.0发行版本时,报错,无法完成编译 HOT 2
- Make multi-level topics the only implementation HOT 3
- Change configuration and device toml files to yaml
- device-mqtt leaks message bus credentials HOT 3
- {WIP BUG] New Async multi-reading support breaks handling of basic single reading
- No support for certificate based secure communication HOT 2
- bad device value need detail and response error message HOT 5
- Edgex mqtt error HOT 11
- jpeg images send to edgex HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from device-mqtt-go.