简体   繁体   English

将数据从 ec2 加载到 redshift 而不上传到 s3

[英]Load data to redshift from ec2 without uploading to s3

I am developing a java program and is looking to load data to redshift table directly from ec2 .我正在开发一个 java 程序,并希望直接从 ec2数据加载到 redshift 表 I know s3 is a storage location.我知道 s3 是一个存储位置。 About ec2 I know only that ec2 instance is a like a virtual machine.关于 ec2 我只知道 ec2 实例就像一个虚拟机。 I am now loading data from s3.我现在正在从 s3 加载数据。 Now I want to know how to load data from ec2 without the help of s3 .现在我想知道如何在没有 s3 帮助的情况下从 ec2 加载数据

Please help I am new to this请帮助我是新手

It is possible to do so.这样做是可能的。 Since your question is too broad, I can only give relevant links from Redshift documentation:由于您的问题太广泛,我只能提供 Redshift 文档中的相关链接:

You cannot COPY from ec2 without the help of s3.没有 s3 的帮助,您无法从 ec2 复制。 See: https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-source.html请参阅: https : //docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-source.html

You would have to connect to redshift from ec2 and perform INSERT queries.您必须从 ec2 连接到 redshift 并执行 INSERT 查询。

An alternative method (though not better) is to insert the values as literals from SQL.另一种方法(虽然不是更好)是将值作为 SQL 中的文字插入。 It is not better b/c this is a highly inefficient data transfer method but for small data payloads works just fine.这不是更好的 b/c,这是一种非常低效的数据传输方法,但对于小数据有效负载来说效果很好。

Insert into <table> values 
    ('A', 1, 9),
    ('B', 2, 8),
    ('C', 3, 7);

Again, this is NOT a good method for transferring even moderate amounts of data.同样,这也不是传输中等数量数据的好方法。 There is also SQL character length limit of 64K characters but if you are running up against this you are using this for too much data.还有 64K 个字符的 SQL 字符长度限制,但如果您遇到此限制,则您将其用于太多数据。 The best method for moving large amounts of data to Redshift is COPY from S3.将大量数据移动到 Redshift 的最佳方法是从 S3 复制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM