首页 \ 问答 \ Hadoop和RDBMS(Hadoop and RDBMS)

Hadoop和RDBMS(Hadoop and RDBMS)

Hadoop主要用于处理非结构化或半结构化数据。 我想使用Hadoop处理大量结构化数据。

尽管hadoop能够从数据库中读取(通过DBInputFormat),但它不被视为可扩展的方法,因为数据库连接的数量将受到限制。

有人用hadoop从RDBMS读取数据吗? 表现如何? 它可以支持多少个节点?

谢谢


Hadoop is mainly used to process unstructured or semi-structured data. I want to use Hadoop to process large amount of structured data.

Though hadoop is capable of reading from database (via DBInputFormat), it is not considered as a scalable approach as number of database connection would be limited.

Has anybody used hadoop to read data from RDBMS? What was the performance? How many nodes could it support?

Thanks


原文:https://stackoverflow.com/questions/8339491
更新时间:2023-09-10 14:09

最满意答案

当您启动子shell时,与反引号一样,bash自行分叉,然后执行您想要运行的命令。 然后你还运行一个管道,导致所有这些都在他们自己的子shell中运行,所以你最终得到了等待管道完成的脚本的“额外”副本,这样它就可以收集输出并将其返回给原始剧本。

我们将使用(...)在子shell中显式运行进程并使用pgrep命令来做一些实验ps | grep "name" | grep -v grep ps | grep "name" | grep -v grep ps | grep "name" | grep -v grep对我们来说,只是向我们展示了与我们的字符串匹配的进程:

echo "Start"
(pgrep test.sh)
(pgrep test.sh) | wc -l
(pgrep test.sh | wc -l)
echo "end"

这对我来说就是产生输出:

Start
30885
1
2
end

所以我们可以看到,在子shell中运行pgrep test.sh只能找到test.sh的单个实例,即使该子shell是管道本身的一部分。 但是,如果子shell包含一个管道,那么我们会得到等待管道完成的脚本的分叉副本


When you start a subshell, as with the backticks, bash forks itself, then executes the command you wanted to run. You then also run a pipeline which causes all of those to be run in their own subshells, so you end up with the "extra" copy of the script that's waiting for the pipeline to finish so it can gather up the output and return that to the original script.

We'll do a little expermiment using (...) to run processes explicitly in subshells and using the pgrep command which does ps | grep "name" | grep -v grep for us, just showing us the processes that match our string:

echo "Start"
(pgrep test.sh)
(pgrep test.sh) | wc -l
(pgrep test.sh | wc -l)
echo "end"

which on a run for me produces the output:

Start
30885
1
2
end

So we can see that running pgrep test.sh in a subshell only finds the single instance of test.sh, even when that subshell is part of a pipeline itself. However, if the subshell contains a pipeline then we get the forked copy of the script waiting for the pipeline to finish

相关问答

更多
  • 根据你想做什么xargs也可以帮助(这里:用pdf2ps转换文件): cpus=$( ls -d /sys/devices/system/cpu/cpu[[:digit:]]* | wc -w ) find . -name \*.pdf | xargs --max-args=1 --max-procs=$cpus pdf2ps 从文档: --max-procs=max-procs -P max-procs Run up to max-procs processes at a time; ...
  • 对任何shell脚本进行良好的健全性检查是在其上运行ShellCheck: Line 9: kill ${pids[@]} 1>/dev/null 2>&1 || true ^-- SC2145: Argument mixes string and array. Use * or separate argument. 事实上,你的xtrace在这一行上做了一些奇怪的事情: kill 31678' '32048 1>/dev/null 2>&1 || true ...
  • 1,2。 使用pgrep 。 我不记得pgrep是否有-c参数,所以你可能需要将它传递给wc -l 。 3:该输出由shell的作业控件生成。 我认为如果你将其作为脚本运行(不在交互式shell中),则不应该有这样的输出。 对于交互式shell,有多少方法可以关闭它,但它们与shell有关,因此请参阅shell的手册。 1,2. Use pgrep. I don't remember off the top of my head whether pgrep has -c parameter, so you ...
  • 由于schemathings间接指示,您可能希望使用tasty_watch.sh将“&”字符附加到行的末尾。 (没有单引号)。 我没有看到任何理由使用'&'作为最终的watch命令,除非你在此之后添加更多命令。 unix命令行末尾的“&”表示“在后台运行”。 你可能想在调用fresh_watch之后插入一个sleep $ {someNumOfSecs},给它一些时间让CPU自己动手。 看到你提到xterm,你知道crontab工具,它允许你安排一个你想要的任何时间运行的工作,并且没有用户必须登录? (也许这 ...
  • 不要使用while循环。 只需阻止并等待SIGCHLD告诉您其中一个进程已终止。 在陷阱中,终止剩余的正在运行的进程。 例如: #!/bin/bash set -m trap 'list=$( jobs -rp ); test -n "$list" && kill $list' CHLD cmd1 & cmd2 & cmd3 & wait 这将运行3个命令。 当一个退出时,另外两个将被发送SIGTERM。 Do not use a while loop. Just block and wait for ...
  • 如果子进程没有自己的子进程,那很容易: $ ps h --ppid "$PID" -o vsz | awk '{ SUM+=$0 }; END { print SUM }' 否则,您可能依赖于进程组ID(PGID),但是确保从脚本调用的程序不会设置自己的进程组是值得的。 $ ps h -e -o pgid,vsz | awk -v "PGID=$PID" '$1==PGID { SUM+=$2 }; END { print SUM }' 如果脚本的所有子节点都不属于同一个PGID,我们只能递归循环遍历进 ...
  • 当您启动子shell时,与反引号一样,bash自行分叉,然后执行您想要运行的命令。 然后你还运行一个管道,导致所有这些都在他们自己的子shell中运行,所以你最终得到了等待管道完成的脚本的“额外”副本,这样它就可以收集输出并将其返回给原始剧本。 我们将使用(...)在子shell中显式运行进程并使用pgrep命令来做一些实验ps | grep "name" | grep -v grep ps | grep "name" | grep -v grep ps | grep "name" | grep -v gr ...
  • 看看bash中的wait函数 。 它只是等待所有子进程完成。 然后您可以轻松计算经过的时间,例如使用SECONDS内部变量( 此处说明): SECONDS=0 declare -a arr=("seed_automation_data_1" "seed_automation_data_2" "seed_automation_data_3" "seed_automation_data_4") command="bundle exec rake db:seed:" for i in "${arr[@]}" d ...
  • grep -vw将删除匹配正则表达式w (这只是包含字符串w任何东西)。 要运行命令,你必须这样说; 但正如在说明书中暗示的那样,您还需要使用cut来对输出进行后处理。 为了不完全给出答案,这里是粗略的伪代码。 w | cut something >tempfile ps -A | grep -Fvf tempfile 如果你可以在管道中传递w的后处理结果,但标准输入已经与ps -A绑定,那将会很好。 如果你有一个支持进程替换的shell,你可以使用它。 ps -A | grep -Fvf <(w | c ...
  • 这些消息不是来自killall命令。 当它注意到它的一个后台子进程已经死亡时,它们就来自shell。 您可以通过在子shell中运行命令来防止这种情况: (phantomjs Lib/loadtester/runTests $TEST_COUNT $CLIENT_LIMIT $ACTION $PROFILE $TEST_SERVER $TEST_INCREMENT $DEBUG_MODE > "/tmp/"$TEST_COUNT"_log.txt" &) 后台进程现在是子shell的子进程,而不是原始脚本 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。