将多个客户端数据加载到Hadoop的最佳实践(best practice to load multiple client data into Hadoop)
我们使用Cloudera CDH在Hadoop框架上创建POC。 我们想要将多个客户端的数据加载到Hive表中。
截至目前,我们为SQL Server上的每个客户端都有单独的数据库。 OLTP的这种基础结构将保持不变。 Hadoop将用于OLAP。 我们有一些主要维度表,每个客户端都是相同的。 所有客户端数据库都有完全相同的模式 这些表具有相同的主键值。 到目前为止,这很好,因为我们有单独的客户端数据库。 现在我们试图将多个客户端数据加载到同一个数据容器(Hive表)中。 现在,如果我们通过Sqoop作业将数据直接从多个SQL Server数据库加载到Hive中,我们将拥有多个具有相同主键值的行。 我想在Hive表中使用代理键,但Hive不支持自动增量,但可以使用UDF实现。
我们不想在运行生产数据时修改SQL Server数据。
一个。 将多个客户端数据加载到Hadoop生态系统中的标准/通用方式/解决方案是什么?
湾 如何将sql server数据库表的主键轻松映射到Hadoop Hive表?
C。 我们如何确保一个客户端永远无法看到其他客户端的数据?
谢谢
We are creating POC on Hadoop framework with Cloudera CDH. We want to load data of multiple client into Hive tables.
As of now, we have separate database for each client on SQL Server. This infrastructure will remain same for OLTP. Hadoop will be used for OLAP. We have some primary dimension tables which are same for each client. All client database has exact same schema. These tables have same primary key value. Till now, this was fine as we have separate database for client. Now we are trying to load multiple client data into same data container (Hive tables). Now we will have multiple row with same primary key value if we load data directly into Hive from multiple SQL Server databases through Sqoop job. I am thinking to use the surrogate key in Hive tables but Hive does not support auto increment but can be achieved with UDF.
We don't want to modify the SQL Server data as it's running production data.
a. What are the standard/generic way/solution to load multiple client data into Hadoop ecosystem?
b. How primary key of sql server database table can be mapped easily to Hadoop Hive table ?
c. How we can ensure that one client is never able to see the data of other client?
Thanks
原文:https://stackoverflow.com/questions/35034754
最满意答案
我记得遇到过类似的情况。
并且,正如@nulltoken所建议的那样,在尝试删除它所保存的文件之前,您必须先
Dispose()
Repository
。
using
应该是最好的选择。using (var repo = new Repository(repositoryPath)) { //Your repo specific implementation. } //Code to Delete your local temp dir
参考:从LibGit2Sharp 克隆夹具
I remember having faced a similar situation.
And, as advised by @nulltoken, you would have to
Dispose()
theRepository
before trying to delete the files that are being held by it.
using
should be the best option.using (var repo = new Repository(repositoryPath)) { //Your repo specific implementation. } //Code to Delete your local temp dir
Reference: Clone Fixture from LibGit2Sharp
相关问答
更多-
在删除1.1之前,您可能希望首先将其标记为1.0。 git checkout v1.1 git tag v1.0 #tag release. use git tag -d v1.0 if v1.0 exists. git push origin v1.0 #push tag to origin 假设您可以访问源的远程存储库,则可以使用以下命令删除标记: git push origin :refs/tags/v1.1 #remove remote copy of tag g ...
-
我认为你正在寻找assume-unchanged旗帜。 基本上,请尝试运行以下命令 git update-index --assume-unchanged
这将停止跟踪file任何本地更改。 要撤消上述命令的效果,请使用git update-index --no-assume-unchanged I think you are looking for assume-unchanged flag. Basically, try running the following command git ... -
我想删除使用LibGit2Sharp从远程存储库克隆的本地repo文件夹。 我在这里读到,我必须在删除之前Dispose()存储库。 LibGit2Sharp保持.git文件夹中的一些文件(主要是出于性能原因的包文件)。 调用Dispose()将释放这些句柄并释放非托管内存。 因此,依赖using语句确实是一个强烈的建议(或者,至少在完成时使用Dispose()存储库实例)。 如果你不这样做,那么当你的AppDomain卸载时,这些句柄最终将通过终结器发布,但是你将不能真正控制将要发生的“何时”。 编辑:再 ...
-
你应该遵循的过程是: hg remove或hg forget文件 。 Mercurial不跟踪目录,因此如果从特定目录中删除所有文件,则目录本身将从Mercurial的角度不再存在。 最后,一旦跟踪了文件,就无法使用标准的rm或del命令将其删除,也无法从文件浏览器中删除它。 执行此操作将导致Mercurial将文件标记为“缺失”,这意味着它仍在被跟踪。 完成此操作后,您可以运行hg status ,它应该显示您刚刚使用R前缀删除的所有文件。 提交删除。 与任何其他修改一样,hg remove / forg ...
-
是的,你可以这么做。 它只会删除您的本地副本。 话虽如此,更简单的方法可能是简单地将其移动到首选位置。 每个git存储库都是自包含的,并不关心它被克隆到的位置。 Yes, you can do that. It will only delete your local copy. Having said that, the easier way probably will be to simply move it to the preferred location. Each git repository i ...
-
你需要记住git pull实际上是一个两步的过程。首先它使用fetch来检索远程文件。 然后,它将尝试进行fast-forward merge以直接在您的工作之上应用更改。 所以在遥控器上使用fetch 。 这将确保您在git仓库中设置了远程更改集。 我想说从git repo运行以下命令: ls | xargs -I'{}' git checkout -- '{}' 但是你说你在Windows机器上,所以你可能只需要循环并手动完成。 此外,这假设您的仓库的根目录中没有创建新文件。 现在,如果您确实要还原目 ...
-
无法提交克隆的存储库(Can't commit to cloned repository)[2022-06-20]
该错误是因为存储库有一个名为HEAD的分支。 由于HEAD跟踪当前工作提交,Git在名为HEAD的分支和git的当前工作提交的内部指针之间变得混乱(因此warning: refname 'HEAD' is ambiguous消息。) 你可以尝试git branch -D HEAD (删除分支的常规方法),但我不确定这是否会让git更加混乱。 The error is because the repository has a branch called HEAD. Since HEAD keeps track ... -
我克隆了一个git存储库。(I cloned a git repository. How do I pull from it into a working directory?)[2022-09-18]
您已选择--bare选项(“Public repository,no working dir”)。 此选项不会创建工作目录。 而是选择“个人存储库”选项,该选项可创建工作目录。 You have selected the --bare option ("Public repository, no working dir"). This option does not create a working directory. Instead, choose the "Personal repository" o ... -
我记得遇到过类似的情况。 并且,正如@nulltoken所建议的那样,在尝试删除它所保存的文件之前,您必须先Dispose() Repository 。 using应该是最好的选择。 using (var repo = new Repository(repositoryPath)) { //Your repo specific implementation. } //Code to Delete your local temp dir 参考:从LibGit2Sharp 克隆夹具 I remember ...
-
在找到类似的 问题并没有完全按照我想要的方式完成后, 本文提供了答案:创建一个空分支。 git checkout --orphan empty git rm -rf . git commit --allow-empty -m "An empty working directory" 当然,请确保您首先将任何重要文件提交到您的仓库。 我把这个分支称为empty ,但你可以通过checkout命令给它任何名字。 设置完成后,您可以切换到任何分支以恢复文件: git checkout master 当您需要“ ...