我无法启动我的Iot代理。它曾经工作过。可能是什么问题?
这是我的启动脚本(上下文代理在192.168.1.126下运行):
export LD_LIBRARY_PATH=/usr/local/iot/lib
/usr/local/iot/bin/iotagent -i 192.168.1.126 -p 80 -v DEBUG -d /usr/local/iot/lib -c /etc/iot/config.json &
这是我的config.json文件:
{
"resources": [
{
"resource": "/iot/kuraResources",
"options": {
"FileName": "UL20Service"
}
}
],
"timezones": "/etc/iot/date_time_zonespec.csv",
"storage": {
"type": "mongodb",
"dbname": "iot"
},
"ngsi_url": {
"cbroker": "http://192.168.1.126:1026",
"updateContext": "/NGSI10/updateContext",
"registerContext": "/NGSI9/registerContext",
"queryContext": "/NGSI10/queryContext"
},
"timeout": 11,
"dir_log": "/var/log/"
}
当我尝试启动它时,这是我的日志:
[root@localhost iot]# sudo ./ini_iotagent.sh
log4cplus:ERROR No appenders could be found for logger (main).
log4cplus:ERROR Please initialize the log4cplus system properly.
FATAL - ======= IoTAgent StartingWebServer: 192.168.1.126 ========
DEBUG - RestHandle constructor
INFO - type_store:mongodb
DEBUG - Setting function get in cache to find in mongo
DEBUG - Check tables in mongo
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
[root@localhost iot]# DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.DEVICE|index={ ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 32, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.SERVICE|index={ ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 33, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - iota::AdminService::AdminService
DEBUG - RestHandle constructor
INFO - type_store:mongodb
DEBUG - Setting function get in cache to find in mongo
DEBUG - Check tables in mongo
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.DEVICE|index={ ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 34, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.SERVICE|index={ ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 35, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - iota::NgsiService::NgsiService
INFO - Added request handler for HTTP resource: /iot
INFO - Loaded static web service for resource (/iot)
INFO - Added request handler for HTTP resource: /iot/ngsi
INFO - Loaded static web service for resource (/iot/ngsi)
DEBUG - Registering /iot/ngsi
DEBUG - Config file /etc/iot/config.json
DEBUG - Starting___ /iot/kuraResources
DEBUG - RestHandle constructor
INFO - type_store:mongodb
DEBUG - Setting function get in cache to find in mongo
DEBUG - Check tables in mongo
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.DEVICE|index={ ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.DEVICE", name: "shardKey", v: 1, unique: true, key: { device_id: 1, service: 1, service_path: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 36, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
DEBUG - |event=END-ALARM|code=100|origin= 127.0.0.1:27017|info=MongoConnection OK
DEBUG - Collection:ensureIndex|bbdd=iot.SERVICE|index={ ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - insert in iot.system.indexes with { ns: "iot.SERVICE", name: "shardKey", v: 1, unique: true, key: { service: 1, service_path: 1, resource: 1 } }
DEBUG - |event=END-ALARM|code=100|origin=127.0.0.1:27017|info={ "connectionId" : 37, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 }
DEBUG - Mongo operation ok
DEBUG - iota::UL20Service::UL20Service
INFO - Added request handler for HTTP resource: /iot/kuraResources
INFO - Loaded web service plug-in for resource (/iot/kuraResources): UL20Service
DEBUG - set_service_option: FileName UL20Service
FATAL - bad argument: FileName
INFO - Starting server on port 80
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /agents to url base /iot
DEBUG - Added url /iot/agents
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /agents/<agent> to url base /iot
DEBUG - Added url /iot/agents/<agent>
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /devices to url base /iot
DEBUG - Added url /iot/devices
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /devices/<device> to url base /iot
DEBUG - Added url /iot/devices/<device>
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /services to url base /iot
DEBUG - Added url /iot/services
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /services/<service> to url base /iot
DEBUG - Added url /iot/services/<service>
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /about to url base /iot
DEBUG - Added url /iot/about
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /agents/<agent>/services to url base /iot
DEBUG - Added url /iot/agents/<agent>/services
DEBUG - Registering /iot
DEBUG - No internal stats information in configuration file /iot
INFO - No internal stats information in configuration file /iot
DEBUG - Add url /agents/<agent>/services/<service> to url base /iot
DEBUG - Added url /iot/agents/<agent>/services/<service>
DEBUG - Load timezone database /etc/iot/date_time_zonespec.csv
ERROR - OAuth for northbound is not configured
DEBUG - START PLUGIN UL2.0
DEBUG - Registering /iot/kuraResources
DEBUG - Add url to url base /iot
DEBUG - Added url /iot/kuraResources
DEBUG - Registering /iot/ngsi
DEBUG - No internal stats information in configuration file /iot/ngsi
INFO - No internal stats information in configuration file /iot/ngsi
DEBUG - Add url /iot/kuraResources/<operation> to url base /iot
DEBUG - Added url /iot/ngsi/kuraResources/<operation>
INFO - Init vector of services names by resource: /iot/kuraResources
DEBUG - admin service ip: 192.168.1.126
DEBUG - admin service port: 80
DEBUG - ProvidingApp: http://192.168.1.126:80/iot/ngsi/kuraResources
DEBUG - Start NgsiService
INFO - OAuth for northbound is not configured
INFO - Start thread registrations
DEBUG - Sending all register from devices collection
DEBUG - in storage no host defined, using localhost by default
DEBUG - in storage no port defined, using 27017 by default
DEBUG - in storage no timeout defined, using 0 by default
DEBUG - in storage no user defined, mongo without auth
DEBUG - in storage no pwd defined, mongo without auth
DEBUG - Conex Mongo DBClientConnection 127.0.0.1:27017/iot timeout in seconds:0
ERROR - Unable to bind to port 80: bind: Cannot assign requested address
HTTPFilter DESTRUCTOR 0
DEBUG - Destructor iota::UL20Service::UL20Service
HTTPFilter DESTRUCTOR 0
FATAL - bind: Cannot assign requested address
另一个进程不使用端口80。我测试了另一个端口,但错误仍然存在:
# netstat -lnp | grep 80
unix 2 [ ACC ] STREAM LISTENING 18076 1102/master public/pickup
unix 2 [ ACC ] STREAM LISTENING 18083 1102/master public/qmgr
unix 2 [ ACC ] STREAM LISTENING 18091 1102/master private/rewrite
unix 2 [ ACC ] STREAM LISTENING 18094 1102/master private/bounce
unix 2 [ ACC ] STREAM LISTENING 18097 1102/master private/defer
unix 2 [ ACC ] STREAM LISTENING 18080 1102/master public/cleanup
unix 2 [ ACC ] STREAM LISTENING 18087 1102/master private/tlsmgr
unix 2 [ ACC ] STREAM LISTENING 20780 2380/ibus-daemon @/tmp/dbus-R1Ju4XHn
unix 2 [ ACC ] STREAM LISTENING 13805 1/systemd /var/run/dbus/system_bus_socket
答案 0 :(得分:1)
似乎端口80正被另一个进程使用。
通过执行以下命令,您可以知道哪个进程正在侦听端口80:
netstat -lnp | grep 80
如果正在使用端口80,您可以在另一个端口上启动iotagent,例如端口8080:
/usr/local/iot/bin/iotagent -i 192.168.1.126 -p 8080 -v DEBUG -d /usr/local/iot/lib -c /etc/iot/config.json &
答案 1 :(得分:0)
我对启动脚本中指定的Iot代理IP地址错误。
感谢您的帮助。