opcagent 无法连接到汽车服务器

如何解决opcagent 无法连接到汽车服务器

我在 iotagent-opcua 上运行我的 kubernetes env,在部署 yml 文件后 opcua agent 无法连接到 server,而是提供以下错误日志:

Please check that client certificate is trusted by server. 
Err = (getaddrinfo ENOTFOUND test_machine_ip test_machine_ip:5001) 

完整日志:

*********************************************** 
WARNING: It is recommended to enable authentication for secure connection 
*********************************************** 
INFO: IoT Agent running standalone 
time=2021-03-02T10:40:29.690Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=---------------------------------------------------- 
time=2021-03-02T10:40:29.691Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=endpointUrl         =  opc.tcp://TEST_MACHINE_IP:5001/UA/CarServer 
time=2021-03-02T10:40:29.691Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=securityMode        =  None 
time=2021-03-02T10:40:29.691Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=securityPolicy      =  http://opcfoundation.org/UA/SecurityPolicy#None 
time=2021-03-02T10:40:29.691Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=timeout             =  -1 
{"op":"IoTAgentNGSI.CommonConfig","time":"2021-03-02T10:40:29.693Z","lvl":"INFO","msg":"Setting IOTA_CB_HOST to environment value: orion"} 
{"op":"IoTAgentNGSI.CommonConfig","time":"2021-03-02T10:40:29.694Z","msg":"Setting IOTA_CB_PORT to environment value: 1026"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_NORTH_PORT to environment value: 4001"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_PROVIDER_URL to environment value: http://iotage:4001"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_REGISTRY_TYPE to environment value: mongodb"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_DEFAULT_RESOURCE to environment value: /iot/devices"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_MONGO_HOST to environment value: mongo-common-0.mongo-common,mongo-common-1.mongo-common,mongo-common-2.mongo-common"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_MONGO_PORT to environment value: 27017"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_MONGO_DB to environment value: iotage"} 
{"op":"IoTAgentNGSI.CommonConfig","msg":"Setting IOTA_MONGO_REPLICASET to environment value: rs0"} 
{"op":"IoTAgentNGSI.Global","msg":"Activating IOT Agent NGSI Library."} 
{"op":"IoTAgentNGSI.Global","msg":"MongoDB Device registry selected for NGSI Library"} 
{"op":"IoTAgentNGSI.DbConn","time":"2021-03-02T10:40:29.705Z","msg":"First connection attempt"} 
{"op":"IoTAgentNGSI.DbConn","msg":"Attempting to connect to MongoDB instance. Attempt 1"} 
(node:6) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated,and will be removed in a future version. To use the new Server Discover and Monitoring engine,pass option { useUnifiedTopology: true } to the MongoClient constructor. 
time=2021-03-02T10:40:29.765Z | lvl=INFO | corr=n/a | trans=n/a | op=n/a | msg=Express server listening on :::8080 
(node:6) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. 
{"op":"IoTAgentNGSI.DbConn","time":"2021-03-02T10:40:29.882Z","msg":"Successfully connected to MongoDB."} 
{"op":"IoTAgentNGSI.NorthboundServer","time":"2021-03-02T10:40:29.901Z","msg":"Starting IoT Agent listening on port [4001]"} 
{"op":"IoTAgentNGSI.ContextServer","time":"2021-03-02T10:40:29.902Z","msg":"Loading NGSI Contect server routes"} 
time=2021-03-02T10:40:29.908Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=Options =  None http://opcfoundation.org/UA/SecurityPolicy#None 
time=2021-03-02T10:40:29.909Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= connecting to  opc.tcp://TEST_MACHINE_IP:5001/UA/CarServer 
time=2021-03-02T10:40:29.924Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 0  time ... We will retry in  2000  ms 
time=2021-03-02T10:40:31.931Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 1  time ... We will retry in  4000  ms 
time=2021-03-02T10:40:35.939Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 2  time ... We will retry in  8000  ms 
time=2021-03-02T10:40:43.943Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 3  time ... We will retry in  10000  ms 
time=2021-03-02T10:40:53.949Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 4  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:03.955Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 5  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:13.963Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 6  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:23.967Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 7  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:33.974Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 8  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:43.978Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=  connection failed for the 9  time ... We will retry in  10000  ms 
time=2021-03-02T10:41:53.984Z | lvl=ERROR | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= disconnected 
time=2021-03-02T10:41:53.984Z | lvl=ERROR | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= client : process terminated with an error 
time=2021-03-02T10:41:53.984Z | lvl=ERROR | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= error Error: The connection has been rejected by server,Please check that client certificate is trusted by server. 
Err = (getaddrinfo ENOTFOUND test_machine_ip test_machine_ip:5001) 
    at _internal_create_secure_channel (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:463:27) 
    at async.series (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:413:17) 
    at err (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:2959:19) 
    at wrapper (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:272:20) 
    at iterateeCallback (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:417:21) 
    at /opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:325:20 
    at result (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:2957:17) 
    at secureChannel.create (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:385:21) 
    at _establish_connection (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:275:24) 
    at ClientSecureChannelLayer._backoff_completion (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:678:17) 
    at completionFunc (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:735:25) 
    at FunctionCall.doCallback_ (/opt/iotagent-opcua/node_modules/backoff/lib/function_call.js:162:20) 
    at Backoff.emit (events.js:198:13) 
    at Backoff.EventEmitter.emit (domain.js:466:23) 
    at Backoff.backoff (/opt/iotagent-opcua/node_modules/backoff/lib/backoff.js:41:14) 
    at FunctionCall.handleFunctionCallback_ (/opt/iotagent-opcua/node_modules/backoff/lib/function_call.js:178:23) 
time=2021-03-02T10:41:53.986Z | lvl=ERROR | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= stack trace Error: The connection has been rejected by server,Please check that client certificate is trusted by server. 
Err = (getaddrinfo ENOTFOUND test_machine_ip test_machine_ip:5001) 
    at _internal_create_secure_channel (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:463:27) 
    at async.series (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:413:17) 
    at err (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:2959:19) 
    at wrapper (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:272:20) 
    at iterateeCallback (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:417:21) 
    at /opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:325:20 
    at result (/opt/iotagent-opcua/node_modules/node-opcua-client/node_modules/async/dist/async.js:2957:17) 
    at secureChannel.create (/opt/iotagent-opcua/node_modules/node-opcua-client/dist/private/client_base_impl.js:385:21) 
    at _establish_connection (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:275:24) 
    at ClientSecureChannelLayer._backoff_completion (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:678:17) 
    at completionFunc (/opt/iotagent-opcua/node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.js:735:25) 
    at FunctionCall.doCallback_ (/opt/iotagent-opcua/node_modules/backoff/lib/function_call.js:162:20) 
    at Backoff.emit (events.js:198:13) 
    at Backoff.EventEmitter.emit (domain.js:466:23) 
    at Backoff.backoff (/opt/iotagent-opcua/node_modules/backoff/lib/backoff.js:41:14) 
    at FunctionCall.handleFunctionCallback_ (/opt/iotagent-opcua/node_modules/backoff/lib/function_call.js:178:23) 
time=2021-03-02T10:41:53.986Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg= Check Security Settings  null 
time=2021-03-02T10:41:53.987Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Initialize | comp=iotAgent-OPCUA | srv=n/a | subsrv=n/a | msg=Exiting 

这部分已经按照描述完成了:

According to the OPC UA Security Model the OPC UA IotAgent,acting as an OPC UA Client,can specify a "Security Policy" and a "Security Mode". Nevertheless,these requests must find a match with the OPC UA Server policies.

You can specify the Security Policy/Mode pair through the config.properties file,and in particular by modifying this section:

## SERVER CERT E AUTH
securityMode=None
securityPolicy=None
userName=
password=

我部署的yaml文件如下,供参考:

---

apiVersion: v1
kind: Service
metadata:
  name: iotcarsrv
spec:
  type: NodePort
#  type: ClusterIP
  ports:
  - port: 5001
    name: tcp5001to5001
    protocol: TCP
    targetPort: 5001
  selector:
    app: iotcarsrv

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: iotcarsrv-deployment

spec:
  replicas: 1
  selector:
    matchLabels:
      app: iotcarsrv
  template:
    metadata:
      labels:
        app: iotcarsrv
    spec:
      containers:
      - name: iotcarsrv
        image: iotagent4fiware/opcuacarsrv:1.3.4
        imagePullPolicy: Always
#       args: ["-dbhost","mongo-common-0.mongo-common,mongo-common-2.mongo-common","-rplSet","rs0","-logLevel","DEBUG"]
        resources:
          limits:
            cpu: 500m
          requests:
            cpu: 200m
        ports:
        - containerPort: 5001
          protocol: TCP
        env:
        - name: IOTA_CB_HOST
          value: "orion"
        - name: IOTA_CB_PORT
          value: "1026"
        - name: IOTA_NORTH_PORT
          value: "5001"
        - name: IOTA_REGISTRY_TYPE
          value: "mongodb"
        - name: IOTA_MONGO_HOST
          value: "mongo-common-0.mongo-common,mongo-common-2.mongo-common"
        - name: IOTA_MONGO_PORT
          value: "27017"
        - name: IOTA_MONGO_DB
          value: "iotcarsrv"
        - name: IOTA_MONGO_REPLICASET
          value: "rs0"
        - name: IOTA_PROVIDER_URL
          value: "http://iotcarsrv:5001"
        - name: IOTA_DEFAULT_RESOURCE
          value: "/iot/devices"
#        volumeMounts:
#        - mountPath: /nas1/iotagent-json/iotajson
#          name: persistent-config
#        - mountPath: /etc/localtime
#          name: persistent-localtime
#          readOnly: true
       # livenessProbe:
       #   failureThreshold: 3
       #   initialDelaySeconds: 10
       #   periodSeconds: 10
       #   successThreshold: 1
       #   tcpSocket:
       #     port: 5001
       #   timeoutSeconds: 2

#      nodeSelector:
#        scfw.cluster.id: stdap

#      volumes:
#      - persistentVolumeClaim:
#          claimName: iota-persistent-config
#        name: persistent-config
#      - hostPath:
#          path: /etc/localtime
#          type: FileOrCreate
#        name: persistent-localtime

---

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: iotcarsrv
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment 
    name: iotcarsrv
  minReplicas: 1
  maxReplicas: 3
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 75
        
---

---

apiVersion: v1
kind: Service
metadata:
  name: iotage
spec:
  type: NodePort
#  type: ClusterIP
  ports:
  - port: 4001
    name: tcp4001to4001
    protocol: TCP
    targetPort: 4001
  selector:
    app: iotage

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: iotage-deployment

spec:
  replicas: 1
  selector:
    matchLabels:
      app: iotage
  template:
    metadata:
      labels:
        app: iotage
    spec:
      containers:
      - name: iotage
        image: iotagent4fiware/iotagent-opcua:1.3.4
#       args: ["-dbhost","DEBUG"]
        resources:
          limits:
            cpu: 500m
          requests:
            cpu: 200m
        ports:
        - containerPort: 4001
          protocol: TCP
        env:
        - name: IOTA_CB_HOST
          value: "orion"
        - name: IOTA_CB_PORT
          value: "1026"
        - name: IOTA_NORTH_PORT
          value: "4001"
        - name: IOTA_REGISTRY_TYPE
          value: "mongodb"
        - name: IOTA_MONGO_HOST
          value: "mongo-common-0.mongo-common,mongo-common-2.mongo-common"
        - name: IOTA_MONGO_PORT
          value: "27017"
        - name: IOTA_MONGO_DB
          value: "iotage"
        - name: IOTA_MONGO_REPLICASET
          value: "rs0"
        - name: IOTA_PROVIDER_URL
          value: "http://iotage:4001"
        - name: IOTA_DEFAULT_RESOURCE
          value: "/iot/devices"
#        volumeMounts:
#        - mountPath: /nas1/iotagent-json/iotajson
#          name: persistent-config
#        - mountPath: /etc/localtime
#          name: persistent-localtime
#          readOnly: true
        #livenessProbe:
        #  failureThreshold: 3
        #  initialDelaySeconds: 10
        #  periodSeconds: 10
        #  successThreshold: 1
        #  tcpSocket:
        #    port: 4001
        #  timeoutSeconds: 2

#      nodeSelector:
#        scfw.cluster.id: stdap

#      volumes:
#      - persistentVolumeClaim:
#          claimName: iota-persistent-config
#        name: persistent-config
#      - hostPath:
#          path: /etc/localtime
#          type: FileOrCreate
#        name: persistent-localtime

---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: iotage
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment 
    name: iotage
  minReplicas: 1
  maxReplicas: 3
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 75
        
---

需要与此错误 opcua 相关的任何帮助或任何文档。提前致谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res