0

我正在尝试使用 AWS 设置队列配置,并且我正在遵循 AWS 文档中的所有指示。一切似乎都很好,当我运行安装 Greengrass Core 的命令时,出现授权失败错误。我真的不明白为什么它会失败。我希望你能帮助我。

这是我来自 AWS CloudWatch 的日志:

{
    "timestamp": "2021-12-13 00:01:09.102",
    "logLevel": "ERROR",
    "traceId": "4484c5c5-eb31-6a44-9a23-6cf3458aa4ff",
    "accountId": "790513853565",
    "status": "Failure",
    "eventType": "Connect",
    "protocol": "MQTT",
    "clientId": "Core_MyGreengrassCore",
    "principalId": "ba2984c5eca202812a3ed6d74855bf494d472328603a7b080bf82679375af819",
    "sourceIp": "80.57.107.22",
    "sourcePort": 55974,
    "reason": "AUTHORIZATION_FAILURE",
    "details": "Authorization Failure"
}

以下是核心设备上 greengrass.log 的日志:

    2021-12-13T00:01:02.881Z [WARN] (Thread-1) com.aws.greengrass.lifecyclemanager.Kernel: Shutting down Nucleus due to external signal. {}
2021-12-13T00:01:02.883Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: system-shutdown. {main=services.main:FINISHED}
2021-12-13T00:01:02.895Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.Kernel: effective-config-dump-complete. {file=/greengrass/v2/config/effectiveConfig.yaml}
2021-12-13T00:01:02.897Z [INFO] (pool-2-thread-16) com.aws.greengrass.telemetry.TelemetryAgent: service-close. Service is now closing. {serviceName=TelemetryAgent, currentState=RUNNING}
2021-12-13T00:01:02.896Z [INFO] (pool-2-thread-15) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-close. Service is now closing. {serviceName=main, currentState=FINISHED}
2021-12-13T00:01:02.902Z [INFO] (pool-2-thread-20) com.aws.greengrass.deployment.DeploymentService: service-close. Service is now closing. {serviceName=DeploymentService, currentState=RUNNING}
2021-12-13T00:01:02.897Z [INFO] (pool-2-thread-17) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-close. Service is now closing. {serviceName=UpdateSystemPolicyService, currentState=RUNNING}
2021-12-13T00:01:02.903Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-set-state. {serviceName=UpdateSystemPolicyService, currentState=RUNNING, newState=STOPPING}
2021-12-13T00:01:02.897Z [INFO] (pool-2-thread-18) com.aws.greengrass.status.FleetStatusService: service-close. Service is now closing. {serviceName=FleetStatusService, currentState=RUNNING}
2021-12-13T00:01:02.897Z [INFO] (pool-2-thread-19) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-close. Service is now closing. {serviceName=aws.greengrass.Nucleus, currentState=FINISHED}
2021-12-13T00:01:02.897Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Waiting for services to shutdown. {}
2021-12-13T00:01:02.903Z [INFO] (FleetStatusService-lifecycle) com.aws.greengrass.status.FleetStatusService: service-set-state. {serviceName=FleetStatusService, currentState=RUNNING, newState=STOPPING}
2021-12-13T00:01:02.903Z [INFO] (TelemetryAgent-lifecycle) com.aws.greengrass.telemetry.TelemetryAgent: service-set-state. {serviceName=TelemetryAgent, currentState=RUNNING, newState=STOPPING}
2021-12-13T00:01:02.904Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: service-set-state. {serviceName=DeploymentService, currentState=RUNNING, newState=STOPPING}
2021-12-13T00:01:02.904Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: Stopping backingTask start. {serviceName=DeploymentService, currentState=STOPPING}
2021-12-13T00:01:02.904Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: service-set-state. {serviceName=DeploymentService, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:02.905Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: Stopping backingTask start. {serviceName=UpdateSystemPolicyService, currentState=STOPPING}
2021-12-13T00:01:02.905Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-set-state. {serviceName=UpdateSystemPolicyService, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:02.905Z [WARN] (pool-2-thread-12) com.aws.greengrass.deployment.DeploymentService: service-run-interrupted. Service interrupted while running startup. {serviceName=DeploymentService, currentState=FINISHED}
2021-12-13T00:01:02.906Z [INFO] (pool-2-thread-2) com.aws.greengrass.telemetry.TelemetryAgent: Cancelling all telemetry scheduled tasks.. {serviceName=TelemetryAgent, currentState=STOPPING}
2021-12-13T00:01:02.906Z [WARN] (pool-2-thread-8) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-run-interrupted. Service interrupted while running startup. {serviceName=UpdateSystemPolicyService, currentState=FINISHED}
2021-12-13T00:01:02.906Z [INFO] (TelemetryAgent-lifecycle) com.aws.greengrass.telemetry.TelemetryAgent: service-set-state. {serviceName=TelemetryAgent, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:02.907Z [INFO] (FleetStatusService-lifecycle) com.aws.greengrass.status.FleetStatusService: service-set-state. {serviceName=FleetStatusService, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:02.908Z [INFO] (Serialized listener processor) com.aws.greengrass.lifecyclemanager.KernelLifecycle: executor-service-shutdown-initiated. {}
2021-12-13T00:01:02.908Z [WARN] (pool-2-thread-5) com.aws.greengrass.deployment.IotJobsHelper: Interrupted while subscribing to Iot Jobs descriptions topic. {ThingName=Core_MyGreengrassCore}
2021-12-13T00:01:02.908Z [WARN] (pool-2-thread-6) com.aws.greengrass.deployment.ShadowDeploymentListener: Interrupted while subscribing to device shadow topics. {}
2021-12-13T00:01:02.910Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Waiting for executors to shutdown. {}
2021-12-13T00:01:02.910Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: executor-service-shutdown-complete. {executor-terminated=false, scheduled-executor-terminated=true}
2021-12-13T00:01:02.911Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: context-shutdown-initiated. {}
2021-12-13T00:01:02.914Z [WARN] (pool-2-thread-6) com.aws.greengrass.mqttclient.MqttClient: Failed to run MQTT spooler. {}
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@65576070 rejected from java.util.concurrent.ThreadPoolExecutor@6d19248b[Shutting down, pool size = 4, active threads = 2, queued tasks = 0, completed tasks = 40]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
    at com.aws.greengrass.mqttclient.MqttClient.triggerSpooler(MqttClient.java:424)
    at com.aws.greengrass.mqttclient.MqttClient.publish(MqttClient.java:521)
    at com.aws.greengrass.mqttclient.WrapperMqttClientConnection.publish(WrapperMqttClientConnection.java:96)
    at software.amazon.awssdk.iot.iotshadow.IotShadowClient.PublishGetNamedShadow(IotShadowClient.java:251)
    at com.aws.greengrass.deployment.ShadowDeploymentListener.publishToGetDeviceShadowTopic(ShadowDeploymentListener.java:326)
    at com.aws.greengrass.deployment.ShadowDeploymentListener.lambda$setupShadowCommunications$2(ShadowDeploymentListener.java:225)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

2021-12-13T00:01:02.915Z [INFO] (pool-2-thread-5) com.aws.greengrass.mqttclient.AwsIotMqttClient: Connecting to AWS IoT Core. {clientId=Core_MyGreengrassCore}
2021-12-13T00:01:02.915Z [WARN] (pool-2-thread-5) com.aws.greengrass.deployment.IotJobsHelper: Interrupted while subscribing to Iot jobs event notifications topic. {ThingName=Core_MyGreengrassCore}
2021-12-13T00:01:02.916Z [INFO] (Thread-1) com.aws.greengrass.mqttclient.AwsIotMqttClient: Connection interrupted. {clientId=Core_MyGreengrassCore}
2021-12-13T00:01:02.918Z [WARN] (pool-2-thread-5) com.aws.greengrass.mqttclient.MqttClient: Failed to run MQTT spooler. {}
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@7062564d rejected from java.util.concurrent.ThreadPoolExecutor@6d19248b[Shutting down, pool size = 2, active threads = 1, queued tasks = 0, completed tasks = 41]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
    at com.aws.greengrass.mqttclient.MqttClient.triggerSpooler(MqttClient.java:424)
    at com.aws.greengrass.mqttclient.MqttClient.publish(MqttClient.java:521)
    at com.aws.greengrass.mqttclient.WrapperMqttClientConnection.publish(WrapperMqttClientConnection.java:96)
    at com.aws.greengrass.deployment.IotJobsClientWrapper.PublishDescribeJobExecution(IotJobsClientWrapper.java:170)
    at com.aws.greengrass.deployment.IotJobsHelper.requestNextPendingJobDocument(IotJobsHelper.java:469)
    at com.aws.greengrass.deployment.IotJobsHelper.subscribeToJobsTopics(IotJobsHelper.java:487)
    at com.aws.greengrass.deployment.IotJobsHelper.lambda$setupCommWithIotJobs$5(IotJobsHelper.java:357)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

2021-12-13T00:01:02.940Z [WARN] (pool-2-thread-5) com.aws.greengrass.mqttclient.MqttClient: Failed to run MQTT spooler. {}
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@c1770ff rejected from java.util.concurrent.ThreadPoolExecutor@6d19248b[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 41]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
    at com.aws.greengrass.mqttclient.MqttClient.triggerSpooler(MqttClient.java:424)
    at com.aws.greengrass.mqttclient.MqttClient.publish(MqttClient.java:521)
    at com.aws.greengrass.util.MqttChunkedPayloadPublisher.publish(MqttChunkedPayloadPublisher.java:54)
    at com.aws.greengrass.status.FleetStatusService.uploadFleetStatusServiceData(FleetStatusService.java:457)
    at com.aws.greengrass.status.FleetStatusService.updateFleetStatusUpdateForAllComponents(FleetStatusService.java:293)
    at com.aws.greengrass.deployment.IotJobsHelper.lambda$setupCommWithIotJobs$5(IotJobsHelper.java:364)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

2021-12-13T00:01:02.941Z [INFO] (pool-2-thread-5) com.aws.greengrass.status.FleetStatusService: fss-status-update-published. Status update published to FSS. {serviceName=FleetStatusService, currentState=FINISHED}
2021-12-13T00:01:03.182Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.AwsIotMqttClient: Unable to connect to AWS IoT Core. {clientId=Core_MyGreengrassCore}
software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)

2021-12-13T00:01:03.182Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.MqttClient: Error subscribing. {topic=$aws/things/Core_MyGreengrassCore/jobs/notify-namespace-aws-gg-deployment}
java.util.concurrent.CompletionException: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:783)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
    at software.amazon.awssdk.crt.AsyncCallback$1.onFailure(AsyncCallback.java:27)
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)
Caused by: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    ... 1 more

2021-12-13T00:01:03.184Z [INFO] (Thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: context-shutdown-complete. {}
2021-12-13T00:01:05.394Z [INFO] (main) com.aws.greengrass.util.platforms.Platform: Getting platform instance com.aws.greengrass.util.platforms.unix.linux.LinuxPlatform.. {}
2021-12-13T00:01:07.425Z [INFO] (main) com.aws.greengrass.util.platforms.Platform: Getting platform instance com.aws.greengrass.util.platforms.unix.linux.LinuxPlatform.. {}
2021-12-13T00:01:07.445Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: No ongoing deployment detected. Proceed as default. {}
2021-12-13T00:01:07.519Z [INFO] (main) com.aws.greengrass.config.Configuration: config-loading. Read configuration from a file path. {path=/greengrass/v2/config/config.tlog}
2021-12-13T00:01:07.598Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: effective-config-dump-complete. {file=/greengrass/v2/config/effectiveConfig.yaml}
2021-12-13T00:01:07.766Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: system-start. Launch Nucleus. {configPath=/greengrass/v2/config, rootPath=/greengrass/v2, version=2.5.2}
2021-12-13T00:01:07.879Z [INFO] (main) software.amazon.awssdk.eventstreamrpc.RpcServer: IpcServer started.... {}
2021-12-13T00:01:07.926Z [INFO] (main) com.aws.greengrass.security.SecurityService: Register crypto key service provider. {keyType=file}
2021-12-13T00:01:07.927Z [INFO] (main) com.aws.greengrass.security.SecurityService: Register crypto key service provider. {keyType=file}
2021-12-13T00:01:07.930Z [INFO] (main) com.aws.greengrass.mqttclient.spool.Spool: Spooler has been configured. {maxSizeInBytes=2621440, storageType=Memory, keepQos0WhenOffline=false}
2021-12-13T00:01:08.049Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: DockerApplicationManagerService. {}
2021-12-13T00:01:08.050Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: DeploymentService. {}
2021-12-13T00:01:08.050Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: UpdateSystemPolicyService. {}
2021-12-13T00:01:08.051Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: FleetStatusService. {}
2021-12-13T00:01:08.051Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: TelemetryAgent. {}
2021-12-13T00:01:08.052Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: TokenExchangeService. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: DockerApplicationManagerService. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: DeploymentService. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: UpdateSystemPolicyService. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: FleetStatusService. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: TelemetryAgent. {}
2021-12-13T00:01:08.088Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Found Plugin: TokenExchangeService. {}
2021-12-13T00:01:08.089Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: serviceImplementors: {UpdateSystemPolicyService:class com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService...}. {}
2021-12-13T00:01:08.091Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=aws.greengrass.Nucleus}
2021-12-13T00:01:08.103Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=main}
2021-12-13T00:01:08.109Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=DeploymentService}
2021-12-13T00:01:08.786Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=UpdateSystemPolicyService}
2021-12-13T00:01:08.794Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=TelemetryAgent}
2021-12-13T00:01:08.815Z [INFO] (pool-2-thread-5) com.aws.greengrass.mqttclient.AwsIotMqttClient: Connecting to AWS IoT Core. {clientId=Core_MyGreengrassCore}
2021-12-13T00:01:08.848Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: effective-config-dump-complete. {file=/greengrass/v2/config/effectiveConfig.yaml}
2021-12-13T00:01:08.848Z [INFO] (main) com.aws.greengrass.lifecyclemanager.KernelLifecycle: system-start. {main=services.main:NEW}
2021-12-13T00:01:08.851Z [INFO] (FleetStatusService-lifecycle) com.aws.greengrass.status.FleetStatusService: service-set-state. {serviceName=FleetStatusService, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.851Z [INFO] (FleetStatusService-lifecycle) com.aws.greengrass.status.FleetStatusService: service-set-state. {serviceName=FleetStatusService, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.855Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: service-set-state. {serviceName=DeploymentService, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.857Z [INFO] (FleetStatusService-lifecycle) com.aws.greengrass.status.FleetStatusService: service-set-state. {serviceName=FleetStatusService, currentState=STARTING, newState=RUNNING}
2021-12-13T00:01:08.858Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: service-set-state. {serviceName=DeploymentService, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.858Z [INFO] (DeploymentService-lifecycle) com.aws.greengrass.deployment.DeploymentService: service-set-state. {serviceName=DeploymentService, currentState=STARTING, newState=RUNNING}
2021-12-13T00:01:08.860Z [INFO] (TelemetryAgent-lifecycle) com.aws.greengrass.telemetry.TelemetryAgent: service-set-state. {serviceName=TelemetryAgent, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.860Z [INFO] (TelemetryAgent-lifecycle) com.aws.greengrass.telemetry.TelemetryAgent: service-set-state. {serviceName=TelemetryAgent, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.861Z [INFO] (TelemetryAgent-lifecycle) com.aws.greengrass.telemetry.TelemetryAgent: service-set-state. {serviceName=TelemetryAgent, currentState=STARTING, newState=RUNNING}
2021-12-13T00:01:08.861Z [INFO] (aws.greengrass.Nucleus-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=aws.greengrass.Nucleus, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.861Z [INFO] (aws.greengrass.Nucleus-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=aws.greengrass.Nucleus, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.862Z [INFO] (main-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=main, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.862Z [INFO] (pool-2-thread-8) com.aws.greengrass.lifecyclemanager.GenericExternalService: generic-service-finished. Nothing done. {serviceName=aws.greengrass.Nucleus, currentState=STARTING}
2021-12-13T00:01:08.862Z [INFO] (aws.greengrass.Nucleus-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=aws.greengrass.Nucleus, currentState=STARTING, newState=FINISHED}
2021-12-13T00:01:08.862Z [INFO] (aws.greengrass.Nucleus-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=aws.greengrass.Nucleus, currentState=FINISHED, newState=STOPPING}
2021-12-13T00:01:08.864Z [INFO] (pool-2-thread-8) com.aws.greengrass.lifecyclemanager.GenericExternalService: Shutdown initiated. {serviceName=aws.greengrass.Nucleus, currentState=STOPPING}
2021-12-13T00:01:08.864Z [INFO] (pool-2-thread-8) com.aws.greengrass.lifecyclemanager.GenericExternalService: generic-service-shutdown. {serviceName=aws.greengrass.Nucleus, currentState=STOPPING}
2021-12-13T00:01:08.864Z [INFO] (aws.greengrass.Nucleus-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=aws.greengrass.Nucleus, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:08.867Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-set-state. {serviceName=UpdateSystemPolicyService, currentState=NEW, newState=INSTALLED}
2021-12-13T00:01:08.870Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-set-state. {serviceName=UpdateSystemPolicyService, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.871Z [INFO] (UpdateSystemPolicyService-lifecycle) com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService: service-set-state. {serviceName=UpdateSystemPolicyService, currentState=STARTING, newState=RUNNING}
2021-12-13T00:01:08.871Z [INFO] (main-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=main, currentState=INSTALLED, newState=STARTING}
2021-12-13T00:01:08.871Z [INFO] (pool-2-thread-13) com.aws.greengrass.lifecyclemanager.GenericExternalService: generic-service-finished. Nothing done. {serviceName=main, currentState=STARTING}
2021-12-13T00:01:08.871Z [INFO] (main-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=main, currentState=STARTING, newState=FINISHED}
2021-12-13T00:01:08.871Z [INFO] (main-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=main, currentState=FINISHED, newState=STOPPING}
2021-12-13T00:01:08.872Z [INFO] (pool-2-thread-13) com.aws.greengrass.lifecyclemanager.GenericExternalService: Shutdown initiated. {serviceName=main, currentState=STOPPING}
2021-12-13T00:01:08.872Z [INFO] (pool-2-thread-13) com.aws.greengrass.lifecyclemanager.GenericExternalService: generic-service-shutdown. {serviceName=main, currentState=STOPPING}
2021-12-13T00:01:08.872Z [INFO] (main-lifecycle) com.aws.greengrass.lifecyclemanager.GenericExternalService: service-set-state. {serviceName=main, currentState=STOPPING, newState=FINISHED}
2021-12-13T00:01:09.122Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.AwsIotMqttClient: Unable to connect to AWS IoT Core. {clientId=Core_MyGreengrassCore}
software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)

2021-12-13T00:01:09.123Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.MqttClient: Error subscribing. {topic=$aws/things/Core_MyGreengrassCore/jobs/$next/namespace-aws-gg-deployment/get/accepted}
java.util.concurrent.CompletionException: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:783)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
    at software.amazon.awssdk.crt.AsyncCallback$1.onFailure(AsyncCallback.java:27)
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)
Caused by: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    ... 1 more

2021-12-13T00:01:09.123Z [WARN] (pool-2-thread-5) com.aws.greengrass.deployment.IotJobsHelper: No connection available during subscribing to Iot Jobs descriptions topic. Will retry in sometime. {ThingName=Core_MyGreengrassCore}
software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)

2021-12-13T00:01:19.920Z [INFO] (pool-2-thread-6) com.aws.greengrass.mqttclient.AwsIotMqttClient: Connecting to AWS IoT Core. {clientId=Core_MyGreengrassCore}
2021-12-13T00:01:20.146Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.AwsIotMqttClient: Unable to connect to AWS IoT Core. {clientId=Core_MyGreengrassCore}
software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at software.amazon.awssdk.crt.mqtt.MqttClientConnection.onConnectionComplete(MqttClientConnection.java:139)

2021-12-13T00:01:20.146Z [ERROR] (Thread-4) com.aws.greengrass.mqttclient.MqttClient: Error subscribing. {topic=$aws/things/Core_MyGreengrassCore/shadow/name/AWSManagedGreengrassV2Deployment/update/accepted}
java.util.concurrent.CompletionException: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:783)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)

这是我用来安装 Greengrass Core 的命令:

sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE -jar ./GreengrassInstaller/lib/Greengrass.jar --aws-region eu-west-2 --trusted-plugin ./GreengrassInstaller/aws.greengrass.FleetProvisioningByClaim.jar --init-config ./GreengrassInstaller/config.yaml --component-default-user ggc_user:ggc_group --setup-system-service true --deploy-dev-tools true 

这是 config.yaml 文件,它应该在其中获取所需的数据:

 ---
services:
  aws.greengrass.Nucleus:
    version: "2.5.2"
  aws.greengrass.FleetProvisioningByClaim:
    configuration:
      rootPath: /greengrass/v2
      awsRegion: "REGION"
      iotDataEndpoint: "ENDPOINT"
      iotCredentialEndpoint: "CREDENTIALENDPOINT"
      iotRoleAlias: "ROLEALIAS"
      provisioningTemplate: "PROVISIONINGTEMPLATE"
      claimCertificatePath: "/greengrass/v2/claim-certs/claim.pem.crt"
      claimCertificatePrivateKeyPath: "/greengrass/v2/claim-certs/claim.private.pem.key"
      rootCaPath: "/greengrass/v2/AmazonRootCA1.pem"
      templateParameters:
        ThingName: "MyGreengrassCore"
        ThingGroupName: "MyGreengrassCoreGroup"
4

1 回答 1

1

请注意,在您的日志中,您有一行关于您的 IoT 设备尝试与 AWS IoT Core 建立的 MQTT 连接。根据您的日志中出现的以下错误,Greengrass 似乎无法与 AWS IoT 核心连接:

2021-12-13T00:01:09.122Z [错误](线程 4)com.aws.greengrass.mqttclient.AwsIotMqttClient:无法连接到 AWS IoT Core。{clientId=Core_MyGreengrassCore}

这很可能是因为您没有提供 Greengrass 连接到 AWS IoT 核心所需的正确证书和设置。

如AWS指南中所述:您需要在配置文件中指定正确的设置,

  • awsRegion:您创建预置模板和其他资源的 AWS 区域。
  • iotDataEndpoint:带有您的 AWS IoT 数据终端节点的 iotDataEndpoint。
  • iotCredentialEndpoint:带有您的 AWS IoT 凭证终端节点的 iotCredentialEndpoint。
  • iotRoleAlias:令牌交换角色别名的名称。

应该指定如何使用 AWS CLI 获取上面的这些 IoT 端点

在配置文件中正确设置这些参数后,Greengrass 应该会正确安装设备。

注意:这是针对 Greengrass 版本 2.0

于 2022-01-08T22:03:58.337 回答