首页 \ 问答 \ 太多的小文件HDFS Sink Flume(Too many small files HDFS Sink Flume)

太多的小文件HDFS Sink Flume(Too many small files HDFS Sink Flume)

agent.sinks=hpd
agent.sinks.hpd.type=hdfs
agent.sinks.hpd.channel=memoryChannel
agent.sinks.hpd.hdfs.path=hdfs://master:9000/user/hduser/gde
agent.sinks.hpd.hdfs.fileType=DataStream
agent.sinks.hpd.hdfs.writeFormat=Text
agent.sinks.hpd.hdfs.rollSize=0
agent.sinks.hpd.hdfs.batchSize=1000
agent.sinks.hpd.hdfs.fileSuffix=.i  
agent.sinks.hpd.hdfs.rollCount=1000
agent.sinks.hpd.hdfs.rollInterval=0

我正在尝试使用HDFS Sink将事件写入HDFS。 并尝试过大小​​,计数和时间基础滚动,但没有一个按预期工作。 它在HDFS中生成太多小文件,如:

-rw-r--r--   2 hduser supergroup      11617 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832879.i
-rw-r--r--   2 hduser supergroup       1381 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832880.i
-rw-r--r--   2 hduser supergroup        553 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832881.i
-rw-r--r--   2 hduser supergroup       2212 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832882.i
-rw-r--r--   2 hduser supergroup       1379 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832883.i
-rw-r--r--   2 hduser supergroup       2762 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832884.i.tmp

请协助解决给定的问题。 我正在使用水槽1.6.0

〜谢谢


agent.sinks=hpd
agent.sinks.hpd.type=hdfs
agent.sinks.hpd.channel=memoryChannel
agent.sinks.hpd.hdfs.path=hdfs://master:9000/user/hduser/gde
agent.sinks.hpd.hdfs.fileType=DataStream
agent.sinks.hpd.hdfs.writeFormat=Text
agent.sinks.hpd.hdfs.rollSize=0
agent.sinks.hpd.hdfs.batchSize=1000
agent.sinks.hpd.hdfs.fileSuffix=.i  
agent.sinks.hpd.hdfs.rollCount=1000
agent.sinks.hpd.hdfs.rollInterval=0

I'm trying to use HDFS Sink to write events to HDFS. And have tried Size, Count and Time bases rolling but none is working as expected. It is generating too many small files in HDFS like:

-rw-r--r--   2 hduser supergroup      11617 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832879.i
-rw-r--r--   2 hduser supergroup       1381 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832880.i
-rw-r--r--   2 hduser supergroup        553 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832881.i
-rw-r--r--   2 hduser supergroup       2212 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832882.i
-rw-r--r--   2 hduser supergroup       1379 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832883.i
-rw-r--r--   2 hduser supergroup       2762 2016-03-05 19:37 hdfs://master:9000/user/hduser/gde/FlumeData.1457186832884.i.tmp

Please assist to resolve the given problem. I'm using flume 1.6.0

~Thanks


原文:https://stackoverflow.com/questions/35815163
更新时间:2023-05-12 18:05

最满意答案

Catalyst::Action::Renderview在决定是否调用视图时使用一Catalyst::Action::Renderview标准。 如果出现以下情况,它将跳过视图:

  • 该请求是HEAD请求。
  • 有些东西已经将$c->response->body设置为定义的值。
  • $c->response->status设置为204(“No Content”)或任何3xx(重定向)。
  • $c->error包含一个或多个错误并且$c->stash->{template}尚未设置(以便finalize_error可以完成其工作)。

老实说这不是最好的安排,但我会在你的情况下尝试设置$c->res->body(""); 在你的time_server动作中。 一个空体不会写任何东西,并且你的标题已经完成,因为你已经调用了write_fh ,但是仍然定义了一个空字符串,所以它会让RenderView不做任何事情。


Catalyst::Action::Renderview has a small set of criteria it uses when deciding whether or not to call the view. It will skip running the view if:

  • The request was a HEAD request.
  • Something has already set $c->response->body to a defined value.
  • $c->response->status is set to 204 ("No Content") or any 3xx (redirection).
  • $c->error contains one or more errors and $c->stash->{template} hasn't been set (so that finalize_error can do its job instead).

Honestly this isn't the best possible arrangement, but what I would try in your situation is setting $c->res->body(""); in your time_server action. An empty body won't write anything, and your headers are already finalized since you've called write_fh, but an empty string is still defined so it'll keep RenderView from doing anything.

相关问答

更多
  • 如果您运行Fiddler ,问题会消失吗? 如果是这样,你可能会遇到的问题是你的网络服务器不正确的多线程和IE9的后台连接功能导致你的服务器挂起,因为它的后台连接没有请求它的死锁。 Does the problem go away if you run Fiddler? If so, the problem you're likely hitting is that your webserver isn't properly multithreaded and IE9's background connec ...
  • 看起来您的配置没有生效。 尝试将模板放在root/homescreen/homescreen.tt2而不是root/src/homescreen/homescreen.tt2 ,然后Catalyst找到它。 啊,你的lib / Myproject.pm中有一个拼写错误: __PACKAGE__->config( #Configure the view 'View::HMTL' => { 请尝试'View::HTML' (注意你有HMTL - 拼写错误)。 It looks ...
  • 我不认为TTSite在支持方面被正式弃用..它仍然包含在Catalyst :: View :: TT发行版中,截至0。39(2012年4月10日发布)。 我怀疑这是一些开发人员不喜欢提供的基本模板的情况,并且TTSite不再被推荐为默认Catalyst教程的一部分。 TTSite提供了一个非常简单的基础,有一些怪癖。 例如,上下文对象被称为Catalyst而不是c,并且使用TT的WRAPPER命令可能会妨碍AJAX和非HTML视图。 更多背景阅读: 讨论关于将Catalyst教程从TTSite更改为直接TT ...
  • 我现在可以使用Catalyst :: Plugin :: Email发送HTML电子邮件。 从文档: “email()接受与Email :: MIME :: Creator的create()相同的参数。” 查看Email :: MIME :: Creator,create方法结构是: my $single = Email::MIME->create( header_str => [ ... ], body_str => '...', attributes => { ... }, ...
  • 我只是在尝试,所以可能有一个更好/更强大/更优雅的解决方案。 catalyst.pl MyApp cd MyApp mkdir -p lib / Catalyst / Helper / View wget --output-document lib / Catalyst / Helper / View / TTMySite.pm http://api.metacpan.org/source/JJNAPIORK/Catalyst-View-TT-0.41/lib/Catalyst/Helper/View/TT ...
  • Catalyst::Action::Renderview在决定是否调用视图时使用一Catalyst::Action::Renderview标准。 如果出现以下情况,它将跳过视图: 该请求是HEAD请求。 有些东西已经将$c->response->body设置为定义的值。 $c->response->status设置为204(“No Content”)或任何3xx(重定向)。 $c->error包含一个或多个错误并且$c->stash->{template}尚未设置(以便finalize_error可以完成其 ...
  • 这可能有点棘手,因为它是极其灵活和简单的DWIW的组合。 模板名称中的.tt表示Template :: Toolkit是推定的默认值。 根本没有必要使用此视图,但在大多数文档中都使用了它。 您可以通过转发到视图来渲染存储/ $ctx的任何内容: $c->forward($c->view("JSON")); 例如,或者您可以决定请求周期的其余部分,例如$c->stash( current_view => "CSV" ) 。 当然,您必须在应用程序中安装和配置视图。 您也可以直接使用视图 - my $body ...
  • Catalyst的优点之一是它的灵活性。 您可以这样做但最适合您的应用。 如果您只支持少数几个URL,那么将它们全部放入Root.pm中并没有什么本质上的错误。 特别是如果没有深度,即localhost:3000 / foo和localhost:3000 / bar 但是,只要你开始有更长的URL,例如localhost:3000 / foo / bar / baz / quux,其中baz和quux是bar的参数,你就会看到分离出包含动作的Foo.pm的好处(子)称为'酒吧'。 (那是在我们进入Chain ...
  • 试试这段代码: def writetoaFile(){ response.setContentType("text/plain") response.setHeader("Content-disposition", "attachment; filename=test.txt") response <<"Hello World" response.flushBuffer() } Try this code: def writetoaFile(){ respo ...
  • 据我所知(作为Haml的作者),还没有Perl的实现。 As far as I know (as the author of Haml), there's no Perl implementation yet.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)