在到达s3之前如何对运动学中的数据进行解密 [英] How is data in kinesis decrypted before hitting s3

查看:130
本文介绍了在到达s3之前如何对运动学中的数据进行解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个架构,其中我的kinesis -> kinesis firehouse -> s3

我正在使用以下方法直接在运动学中创建记录:

 aws kinesis put-record --stream-name <some_kinesis_stream> --partition-key 123 --data testdata --profile sandbox

我运行时的数据:

aws kinesis获取记录--shard-iterator --profile沙箱

看起来像这样:

 {
            "SequenceNumber": "49597697038430366340153578495294928515816248592826368002",
            "ApproximateArrivalTimestamp": 1563835989.441,
            "Data": "eyJrZXkiOnsiZW1wX25vIjo1Mjc2OCwiZGVwdF9ubyI6ImQwMDUifSwidmFsdWUiOnsiYmVmb3JlIjpudWxsLCJhZnRlciI6eyJlbXBfbm8iOjUyNzY4LCJkZXB0X25vIjoiZDAwNSIsImZyb21fZGF0ZSI6Nzk2NSwidG9fZGF0ZSI6MjkzMjUzMX0sInNvdXJjZSI6eyJ2ZXJzaW9uIjoiMC45LjUuRmluYWwiLCJjb25uZWN0b3IiOiJteXNxbCIsIm5hbWUiOiJraW5lc2lzIiwic2VydmVyX2lkIjowLCJ0c19zZWMiOjAsImd0aWQiOm51bGwsImZpbGUiOiJteXNxbC1iaW4tY2hhbmdlbG9nLjAwMDAwMiIsInBvcyI6MTU0LCJyb3ciOjAsInNuYXBzaG90Ijp0cnVlLCJ0aHJlYWQiOm51bGwsImRiIjoiZW1wbG95ZWVzIiwidGFibGUiOiJkZXB0X2VtcCIsInF1ZXJ5IjpudWxsfSwib3AiOiJjIiwidHNfbXMiOjE1NjM4MzEzMTI2Njh9fQ==",
            "PartitionKey": "-591791328"
        }

但是在s3中,它看起来像:

`testdatatestdatatestdatatestdatatestdatatestdatatestdatatestdata`

因为我多次运行了putrecord.

那是怎么回事?运行get-records时,我获得什么记录?那是什么数据然后如何将这些数据解密为我的原始字符串?发生了什么事?

解决方案

现在已经15天了,所以希望您已经找到答案了.

如果不是,这似乎是您在get-records和S3中看到的数据不匹配的原因是基于执行aws kinesis get-records --shard-iterator --profile sandbox调用的方式,您没有明确提供分片迭代器值./p>

根据您的--data testdata put-record调用,您在S3中看到的内容是正确的和预期的. testdatatestdatatestdatatestdatatestdatatestdatatestdatatestdata

您在Kinesis中看到的是base64编码的: "Data": "eyJrZXkiOnsiZW1wX25vIjo1Mjc2OCwiZGVwdF9ubyI6ImQwMDUifSwidmFsdWUiOnsiYmVmb3JlIjpudWxsLCJhZnRlciI6eyJlbXBfbm8iOjUyNzY4LCJkZXB0X25vIjoiZDAwNSIsImZyb21fZGF0ZSI6Nzk2NSwidG9fZGF0ZSI6MjkzMjUzMX0sInNvdXJjZSI6eyJ2ZXJzaW9uIjoiMC45LjUuRmluYWwiLCJjb25uZWN0b3IiOiJteXNxbCIsIm5hbWUiOiJraW5lc2lzIiwic2VydmVyX2lkIjowLCJ0c19zZWMiOjAsImd0aWQiOm51bGwsImZpbGUiOiJteXNxbC1iaW4tY2hhbmdlbG9nLjAwMDAwMiIsInBvcyI6MTU0LCJyb3ciOjAsInNuYXBzaG90Ijp0cnVlLCJ0aHJlYWQiOm51bGwsImRiIjoiZW1wbG95ZWVzIiwidGFibGUiOiJkZXB0X2VtcCIsInF1ZXJ5IjpudWxsfSwib3AiOiJjIiwidHNfbXMiOjE1NjM4MzEzMTI2Njh9fQ==",

所以解码使您: { "key": { "emp_no": 52768, "dept_no": "d005" }, "value": { "before": null, "after": { "emp_no": 52768, "dept_no": "d005", "from_date": 7965, "to_date": 2932531 }, "source": { "version": "0.9.5.Final", "connector": "mysql", "name": "kinesis", "server_id": 0, "ts_sec": 0, "gtid": null, "file": "mysql-bin-changelog.000002", "pos": 154, "row": 0, "snapshot": true, "thread": null, "db": "employees", "table": "dept_emp", "query": null }, "op": "c", "ts_ms": 1563831312668 } }

之所以与您的"testdata"不匹配,是因为您在错误的分片上寻找了错误的分片迭代器.不确定您的运动学设置到底是什么.

再次给这篇文章 https://docs.aws.amazon.com/streams/latest/dev/fundamental-stream.html .应该为您提供测试此工作流程的步骤.

I currently have an architecture where my kinesis -> kinesis firehouse -> s3

I am creating records directly in kinesis using:

 aws kinesis put-record --stream-name <some_kinesis_stream> --partition-key 123 --data testdata --profile sandbox

The data when I run:

aws kinesis get-records --shard-iterator --profile sandbox

looks like this:

 {
            "SequenceNumber": "49597697038430366340153578495294928515816248592826368002",
            "ApproximateArrivalTimestamp": 1563835989.441,
            "Data": "eyJrZXkiOnsiZW1wX25vIjo1Mjc2OCwiZGVwdF9ubyI6ImQwMDUifSwidmFsdWUiOnsiYmVmb3JlIjpudWxsLCJhZnRlciI6eyJlbXBfbm8iOjUyNzY4LCJkZXB0X25vIjoiZDAwNSIsImZyb21fZGF0ZSI6Nzk2NSwidG9fZGF0ZSI6MjkzMjUzMX0sInNvdXJjZSI6eyJ2ZXJzaW9uIjoiMC45LjUuRmluYWwiLCJjb25uZWN0b3IiOiJteXNxbCIsIm5hbWUiOiJraW5lc2lzIiwic2VydmVyX2lkIjowLCJ0c19zZWMiOjAsImd0aWQiOm51bGwsImZpbGUiOiJteXNxbC1iaW4tY2hhbmdlbG9nLjAwMDAwMiIsInBvcyI6MTU0LCJyb3ciOjAsInNuYXBzaG90Ijp0cnVlLCJ0aHJlYWQiOm51bGwsImRiIjoiZW1wbG95ZWVzIiwidGFibGUiOiJkZXB0X2VtcCIsInF1ZXJ5IjpudWxsfSwib3AiOiJjIiwidHNfbXMiOjE1NjM4MzEzMTI2Njh9fQ==",
            "PartitionKey": "-591791328"
        }

but in s3, it looks like:

`testdatatestdatatestdatatestdatatestdatatestdatatestdatatestdata`

because I ran the putrecords several times.

So what is going on? When I run get-records, what records am I obtaining? What is that data? How is that data then decrypted into my original string? What is going on?

解决方案

15 days old now, so hopefully you found the answer already.

If not, it seems the reason you have a mismatch in data between get-records and what you see in S3 is based on how you performed the aws kinesis get-records --shard-iterator --profile sandbox call, you didn't explicitly provide a shard iterator value.

What you saw in S3 is correct and expected based on your --data testdata put-record calls. testdatatestdatatestdatatestdatatestdatatestdatatestdatatestdata

What you saw in Kinesis is base64 encoded: "Data": "eyJrZXkiOnsiZW1wX25vIjo1Mjc2OCwiZGVwdF9ubyI6ImQwMDUifSwidmFsdWUiOnsiYmVmb3JlIjpudWxsLCJhZnRlciI6eyJlbXBfbm8iOjUyNzY4LCJkZXB0X25vIjoiZDAwNSIsImZyb21fZGF0ZSI6Nzk2NSwidG9fZGF0ZSI6MjkzMjUzMX0sInNvdXJjZSI6eyJ2ZXJzaW9uIjoiMC45LjUuRmluYWwiLCJjb25uZWN0b3IiOiJteXNxbCIsIm5hbWUiOiJraW5lc2lzIiwic2VydmVyX2lkIjowLCJ0c19zZWMiOjAsImd0aWQiOm51bGwsImZpbGUiOiJteXNxbC1iaW4tY2hhbmdlbG9nLjAwMDAwMiIsInBvcyI6MTU0LCJyb3ciOjAsInNuYXBzaG90Ijp0cnVlLCJ0aHJlYWQiOm51bGwsImRiIjoiZW1wbG95ZWVzIiwidGFibGUiOiJkZXB0X2VtcCIsInF1ZXJ5IjpudWxsfSwib3AiOiJjIiwidHNfbXMiOjE1NjM4MzEzMTI2Njh9fQ==",

So decoding gets you: { "key": { "emp_no": 52768, "dept_no": "d005" }, "value": { "before": null, "after": { "emp_no": 52768, "dept_no": "d005", "from_date": 7965, "to_date": 2932531 }, "source": { "version": "0.9.5.Final", "connector": "mysql", "name": "kinesis", "server_id": 0, "ts_sec": 0, "gtid": null, "file": "mysql-bin-changelog.000002", "pos": 154, "row": 0, "snapshot": true, "thread": null, "db": "employees", "table": "dept_emp", "query": null }, "op": "c", "ts_ms": 1563831312668 } }

The reason why it didn't match your "testdata" is because you were looking into the wrong shard iterator on possibly the wrong shard. Unsure what your kinesis setup is exactly.

Give this article a once over, https://docs.aws.amazon.com/streams/latest/dev/fundamental-stream.html . Should give you the steps to test this workflow.

这篇关于在到达s3之前如何对运动学中的数据进行解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆