Kinesis 代理未启动:原因:java.nio.file.AccessDeniedException

Kinesis Agent not starting : Caused by: java.nio.file.AccessDeniedException

我在 Ubuntu 14.04 上安装了代理...它之前工作正常,但后来突然停止,现在在启动时出现以下错误

sudo service aws-kinesis-agent start
 * Starting aws-kinesis-agent
[ OK ] 

2016-07-10 18:46:40.373+0530 prod-api-ip-10-0-0-48 (main) com.amazon.kinesis.streaming.agent.Agent [INFO] Reading configuration from file: /etc/aws-kinesis/agent.json
2016-07-10 18:46:40.404+0530 prod-api-ip-10-0-0-48 (main) com.amazon.kinesis.streaming.agent.Agent [INFO] null: Agent will use up to 96 threads for sending data.
2016-07-10 18:46:40.411+0530 prod-api-ip-10-0-0-48 (main) com.amazon.kinesis.streaming.agent.Agent [ERROR] Unhandled error.
java.lang.RuntimeException: Failed to create or connect to the checkpoint database.
        at com.amazon.kinesis.streaming.agent.tailing.checkpoints.SQLiteFileCheckpointStore.connect(Unknown Source)
        at com.amazon.kinesis.streaming.agent.tailing.checkpoints.SQLiteFileCheckpointStore.<init>(Unknown Source)
        at com.amazon.kinesis.streaming.agent.Agent.<init>(Unknown Source)
        at com.amazon.kinesis.streaming.agent.Agent.main(Unknown Source)
Caused by: java.nio.file.AccessDeniedException: /var/run/aws-kinesis-agent
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
        at java.nio.file.Files.createDirectory(Files.java:674)
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
        at java.nio.file.Files.createDirectories(Files.java:767)

我个人发现Kinesis Agent确实不稳定。只需重新启动代理即可解决上述问题!但又在 30 分钟后再次发生了一些其他异常。

我建议尝试一些其他代理,例如 Clodwatch 代理,它可以不断将日志发送到 CloudWatch 日志(尽管我还没有测试过)。

我将采用使用 logrotate 然后将日志文件复制到 S3 存储桶的方法。我知道这里;可以有最大值。延迟 1 小时。

将 aws-kinesis-agent-user 添加到 sudoers 组:

sudo usermod -aG sudo aws-kinesis-agent-user

工作代理的其他配置: