Kinesis GetShardIterator ...无效,因为它不是来自此流

时间:2015-06-12 08:31:41

标签: emr amazon-kinesis

我已经构建了一个KCL plus spark base https://spark.apache.org/docs/1.2.0/streaming-kinesis-integration.html

我在EMR上运行它(通过bootstrap安装spark)。我已经在流上创建了sparkTest并且我的测试工作正常。我观察到没有创建DynamoDB。 我删除了流和群集。第二天,我再次使用相同的名称创建了Kinesis Steam,并使用新启动的集群部署了我的代码。 现在我正在

5/06/12 08:17:28 ERROR worker.InitializeTask: Caught exception:
com.amazonaws.services.kinesis.model.InvalidArgumentException: StartingSequenceNumber 49551532098093284204238000035066183240246145871536717826 used in GetShardIterator on shard shardId-000000000000 in stream sparkTest under account 618673372431 is invalid because it did not come from this stream. (Service: AmazonKinesis; Status Code: 400; Error Code: InvalidArgumentException; Request ID: 770ef875-10db-11e5-b24b-af6f372168ae)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1078)
        at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:726)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:461)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClie

我无法理解为什么会这样。如果我创建新的kinesis流然后再做工作它再次工作。 这是Kinesis的问题吗?

另一个线程就是这个 https://github.com/awslabs/amazon-kinesis-connectors/issues/8 但是我没有使用kinesis应用程序名称和使用

创建流
KinesisUtils.createStream(
                        jssc, streamName, endpointUrl, kinesisCheckpointInterval, InitialPositionInStream.LATEST, StorageLevel.MEMORY_AND_DISK_2())

1 个答案:

答案 0 :(得分:3)

SparkConf sparkConfig = new SparkConf().setAppName("arbitraryName").setMaster("local[2]");

KinesisUtils.createStream(
                        jssc, streamName, endpointUrl, kinesisCheckpointInterval, InitialPositionInStream.LATEST, StorageLevel.MEMORY_AND_DISK_2()));

如果我更改名称" arbitraryName"。它工作正常。我发现了这个提示 https://spark.apache.org/docs/1.2.0/streaming-kinesis-integration.html

key points:
The application name used in the streaming context becomes the Kinesis application name
The application name must be unique for a given account and region.