How do you use the Cassandra tool sstableloader?

Viewed 15399

I'm trying to use the sstableloader to load data into an existing Cassandra ring, but cant figure out how to actually get it to work. I'm trying to run it on a machine that has a running cassandra node on it, but when I run it I get an error saying that port 7000 is already in use, which is the port the running Cassandra node is using for gossip.

So does that mean I can only use sstableloader on a machine that is in the same network as the target cassandra ring, but isn't actually running a cassandra node?

Any details would be useful, thanks.

6 Answers

If you are looking to do this in Java see below utility class:

BulkWriterLoader

    List<String> argList = new ArrayList<>();
    argList.add("-v");
    argList.add("-d");
    argList.add(params.hosts);
    argList.add("-f");
    argList.add(params.cassYaml);
    argList.add(params.fullpath);
    LoaderOptions options = LoaderOptions.builder()
            .parseArgs(argList.stream().toArray(String[]::new))
            .build();
    try
    {
        BulkLoader.load(options);
    }
    catch (BulkLoadException e)
    {
        e.printStackTrace();
    }
    ...

The code will also generate the sstable files using the CQLSSTableWriter class.

Related