Revision 261

Date:
2010/01/31 16:44:33
Author:
dpavlin
Revision Log:
import everything from pxelator
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/bin/mongodb2shards.pl

     
    4 4 use Sack::Shard;
    5 5
    6 6 use Data::Dump qw(dump);
    7 use Data::Structure::Util qw(unbless);
    8 7 use autodie;
    9 8
    10 9 use MongoDB;
    11 10
    12 my $name = 'dns';
    11 my $name = 'pxelator';
    13 12 my $shard_size = 5000;
    14 13
    15 14
     
    17 16 my $database = $connection->get_database('pxelator');
    18 17 my $collection = $database->get_collection('audit');
    19 18
    20 my $q = {"package.name" => "dnsd", "source" => "upstream"};
    19 my $q;
    20 #$q = {"package.name" => "dnsd", "source" => "upstream"};
    21 21
    22 22 warn "# mongodb query: ", dump($q), $/;
    23 23
     
    26 26 Sack::Shard::create( $name, $cursor->count, $shard_size );
    27 27
    28 28 while( my $o = $cursor->next ) {
    29 $o->{_id} .= '';
    29 $o->{_id} .= ''; # convert _id to scalar
    30 30 Sack::Shard::add( $o );
    31 31 }
    32 32 Sack::Shard::finish;