当前位置: 首页>>代码示例>>Java>>正文


Java SSTableLoader类代码示例

本文整理汇总了Java中org.apache.cassandra.io.sstable.SSTableLoader的典型用法代码示例。如果您正苦于以下问题:Java SSTableLoader类的具体用法?Java SSTableLoader怎么用?Java SSTableLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SSTableLoader类属于org.apache.cassandra.io.sstable包,在下文中一共展示了SSTableLoader类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
public static void main(String args[])
{
    LoaderOptions options = LoaderOptions.parseArgs(args);
    OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
    SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(options.hosts, options.rpcPort, options.user, options.passwd), handler);
    DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
    StreamResultFuture future = loader.stream(options.ignores);
    future.addEventListener(new ProgressIndicator());
    try
    {
        future.get();
        System.exit(0); // We need that to stop non daemonized threads
    }
    catch (Exception e)
    {
        System.err.println("Streaming to the following hosts failed:");
        System.err.println(loader.getFailedHosts());
        System.err.println(e);
        if (options.debug)
            e.printStackTrace(System.err);
        System.exit(1);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:BulkLoader.java

示例2: prepareWriter

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void prepareWriter()  {
  try {
    if (writer == null) {
      writer = CQLSSTableWriter.builder()
          .forTable(schema)
          .using(insertStatement)
          .withPartitioner(ConfigHelper.getOutputPartitioner(conf))
          .inDirectory(outputDir)
          .sorted()
          .build();
    }
    if (loader == null) {
      CrunchExternalClient externalClient = new CrunchExternalClient(conf);
      externalClient.addKnownCfs(keyspace, schema);
      this.loader = new SSTableLoader(outputDir, externalClient,
          new BulkRecordWriter.NullOutputHandler());
    }
  } catch (Exception e) {
    throw new CrunchRuntimeException(e);
  }
}
 
开发者ID:spotify,项目名称:hdfs2cass,代码行数:22,代码来源:CrunchCqlBulkRecordWriter.java

示例3: prepareWriter

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void prepareWriter() throws IOException
{
    try
    {
        if (writer == null)
        {
            writer = CQLSSTableWriter.builder()
                .forTable(schema)
                .using(insertStatement)
                .withPartitioner(ConfigHelper.getOutputPartitioner(conf))
                .inDirectory(outputDir)
                .withBufferSizeInMB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64")))
                .build();
        }
        if (loader == null)
        {
            ExternalClient externalClient = new ExternalClient(conf);
            
            externalClient.addKnownCfs(keyspace, schema);

            this.loader = new SSTableLoader(outputDir, externalClient, new BulkRecordWriter.NullOutputHandler()) {
                @Override
                public void onSuccess(StreamState finalState)
                {
                    if (deleteSrc)
                        FileUtils.deleteRecursive(outputDir);
                }
            };
        }
    }
    catch (Exception e)
    {
        throw new IOException(e);
    }      
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:36,代码来源:CqlBulkRecordWriter.java

示例4: prepareWriter

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void prepareWriter() throws IOException
{
    if (outputdir == null)
    {
        String keyspace = ConfigHelper.getOutputKeyspace(conf);
        //dir must be named by ks/cf for the loader
        outputdir = new File(getOutputLocation() + File.separator + keyspace + File.separator + ConfigHelper.getOutputColumnFamily(conf));
        outputdir.mkdirs();
    }
    
    if (writer == null)
    {
        AbstractType<?> subcomparator = null;
        ExternalClient externalClient = null;
        String username = ConfigHelper.getOutputKeyspaceUserName(conf);
        String password = ConfigHelper.getOutputKeyspacePassword(conf);

        if (cfType == CFType.SUPER)
            subcomparator = BytesType.instance;

        this.writer = new SSTableSimpleUnsortedWriter(
                outputdir,
                ConfigHelper.getOutputPartitioner(conf),
                ConfigHelper.getOutputKeyspace(conf),
                ConfigHelper.getOutputColumnFamily(conf),
                BytesType.instance,
                subcomparator,
                Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64")),
                ConfigHelper.getOutputCompressionParamaters(conf));

        externalClient = new ExternalClient(ConfigHelper.getOutputInitialAddress(conf),
                                            ConfigHelper.getOutputRpcPort(conf),
                                            username,
                                            password);

        this.loader = new SSTableLoader(outputdir, externalClient, new NullOutputHandler());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:39,代码来源:BulkRecordWriter.java

示例5: prepareWriter

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void prepareWriter() throws IOException
{
    try
    {
        if (writer == null)
        {
            writer = CQLSSTableWriter.builder()
                .forTable(schema)
                .using(insertStatement)
                .withPartitioner(ConfigHelper.getOutputPartitioner(conf))
                .inDirectory(outputDir)
                .withBufferSizeInMB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64")))
                .build();
        }
        if (loader == null)
        {
            ExternalClient externalClient = new ExternalClient(conf);
            
            externalClient.addKnownCfs(keyspace, schema);

            this.loader = new SSTableLoader(outputDir, externalClient, new BulkRecordWriter.NullOutputHandler());
        }
    }
    catch (Exception e)
    {
        throw new IOException(e);
    }      
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:29,代码来源:CqlBulkRecordWriter.java

示例6: close

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void close() throws IOException
{
    if (writer != null)
    {
        writer.close();
        SSTableLoader.LoaderFuture future = loader.stream();
        while (true)
        {
            try
            {
                future.get(1000, TimeUnit.MILLISECONDS);
                break;
            }
            catch (TimeoutException te)
            {
                progress.progress();
            }
            catch (InterruptedException e)
            {
                throw new IOException(e);
            }
        }
        if (future.hadFailures())
        {
            if (future.getFailedHosts().size() > maxFailures)
                throw new IOException("Too many hosts failed: " + future.getFailedHosts());
            else
                logger.warn("Some hosts failed: " + future.getFailedHosts());
        }
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:32,代码来源:BulkRecordWriter.java

示例7: prepareWriter

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
private void prepareWriter() throws IOException {
    if (outputdir == null) {
        String keyspace = org.apache.cassandra.hadoop2.ConfigHelper.getOutputKeyspace(conf);
        //dir must be named by ks/cf for the loader
        outputdir = new File(getOutputLocation() + File.separator + keyspace + File.separator + org.apache.cassandra.hadoop2.ConfigHelper.getOutputColumnFamily(conf));
        outputdir.mkdirs();
    }

    if (writer == null) {
        AbstractType<?> subcomparator = null;
        ExternalClient externalClient = null;
        String username = org.apache.cassandra.hadoop2.ConfigHelper.getOutputKeyspaceUserName(conf);
        String password = org.apache.cassandra.hadoop2.ConfigHelper.getOutputKeyspacePassword(conf);

        if (cfType == CFType.SUPER) {
            subcomparator = BytesType.instance;
        }

        this.writer = new SSTableSimpleUnsortedWriter(
                outputdir,
                org.apache.cassandra.hadoop2.ConfigHelper.getOutputPartitioner(conf),
                org.apache.cassandra.hadoop2.ConfigHelper.getOutputKeyspace(conf),
                org.apache.cassandra.hadoop2.ConfigHelper.getOutputColumnFamily(conf),
                BytesType.instance,
                subcomparator,
                Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64")),
                org.apache.cassandra.hadoop2.ConfigHelper.getOutputCompressionParamaters(conf));

        externalClient = new ExternalClient(org.apache.cassandra.hadoop2.ConfigHelper.getOutputInitialAddress(conf),
                org.apache.cassandra.hadoop2.ConfigHelper.getOutputRpcPort(conf),
                username,
                password);

        this.loader = new SSTableLoader(outputdir, externalClient, new NullOutputHandler());
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:37,代码来源:BulkRecordWriter.java

示例8: ExternalClient

import org.apache.cassandra.io.sstable.SSTableLoader; //导入依赖的package包/类
public ExternalClient(SSTableLoader.OutputHandler outputHandler)
{
    super();
    this.outputHandler = outputHandler;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:6,代码来源:BulkLoader.java


注:本文中的org.apache.cassandra.io.sstable.SSTableLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。