20100712: Upgrade to OSQA r516. Let me know if you experience any new issues. 20100708: Fixed the RSS feed.

Is there a solution for a distributed grep?

here's the story: I have a bunch of web servers and want to query their application logs (I'm using tomcat, if it matters). I don't want to have to copy the files to a common storage, they are too big, network is espensive and storage is too expensive so I want to keep them on the same web servers. So even haddop+hive or similar solutions won't fly.
So what I'm looking for is perhaps a local agent for which I can send the grep request to all hosts and get the results back.
Anything like that exists?

  • No file copying over the network
  • No common storage
  • Can't install hadoop on the web servers... I just can't...
  • grepping text files

Thanks!

asked Jul 18 '10 at 08:12

Ran%20Tavory's gravatar image

Ran Tavory
121236


You need to apply the master-worker pattern, sending a "grep" task to a master which will in turn forward the task to remote workers, each one running in a different web server machine whose logs you want to grep. Each worker will grep its local log and then send back the results so that they can be assembled.

The Terracotta Master Worker framework works exactly this way: http://forge.terracotta.org/releases/projects/tim-messaging/docs/mw-guide.html

Also, you could take a look at GridGain, which implements a map-reduce like framework for distributed computations: http://www.gridgain.com

answered Jul 19 '10 at 04:14

Sergio%20Bossa's gravatar image

Sergio Bossa
464

There exists tools which allow you to run the same command on multiple hosts over ssh and collect the results. One such tool is PSSH (parallel-ssh).

Running the same grep on multiple machines (listed in nodes.txt) is as easy as:

parallel-ssh -h nodes.txt -P grep foo /var/log/bar/quux.log

answered Jul 20 '10 at 08:25

Jukka%20Matilainen's gravatar image

Jukka Matilainen
11

http://www.gnu.org/software/parallel/man.html#example__parallel_grep

answered May 09 '11 at 19:44

Andy%20Schlaikjer's gravatar image

Andy Schlaikjer
1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×2
×2
×2

Asked: Jul 18 '10 at 08:12

Seen: 887 times

Last updated: May 09 '11 at 19:44

Related questions

powered by OSQA

User submitted content is under Creative Commons: Attribution - Share Alike; Other things copyright (C) 2010, MetaOptimize LLC.