public void startup() throws Exception {
    if (isRunning()) {
      throw new RuntimeException("Cluster already running.");
    }

    // TODO: Check that the number of nodes is legal...
    List<String> seeds = getSeeds();

    mNodes = Lists.newArrayList();

    // Create a separate object for each node in the cluster.
    for (int nodeNum = 0; nodeNum < mCassandraConfiguration.getNumNodes(); nodeNum++) {
      mNodes.add(new MiniCassandraClusterNode(
          getLog(),
          nodeNum,
          seeds.get(nodeNum),
          seeds,
          mCassandraConfiguration));
    }

    // Create root directory.
    if (!mCassandraConfiguration.getCassandraDir().mkdir()) {
      throw new RuntimeException("Could not create root C* dir " + mCassandraConfiguration.getCassandraDir());
    }

    // Set up all of the different conf directories.
    for (MiniCassandraClusterNode node : mNodes) {
      node.setup();
    }

    // Actually start the nodes!
    for (MiniCassandraClusterNode node : mNodes) {
      node.start();
    }

    mIsRunning = true;

    // Wait for the cluster to start running.

    // Seems that the cluster often needs ~10 sec to get started.
    Thread.sleep(1000 * 10);

    // Sanity check that we can connect to the cluster.
    Cluster cluster = Cluster.builder()
        .addContactPoints(seeds.toArray(new String[seeds.size()]))
        .withPort(mCassandraConfiguration.getPortNativeTransport())
        .build();

    // It often takes ~10 seconds for the cluster to start.
    final int MAX_NUM_TRIES = 5;
    final int SLEEP_TIME_SECONDS = 3;
    boolean connected = false;
    for (int numTries = 0; numTries < MAX_NUM_TRIES; numTries++) {
      // Sleep for two seconds.
      Thread.sleep(1000*SLEEP_TIME_SECONDS);
      try {
        Session session = cluster.connect();
        getLog().info("Connected to cluster.");
        session.close();
        connected = true;
        break;
      } catch (NoHostAvailableException ex) {
        // Don't do anything here -- just try again.
        getLog().info("No host available...");
      } catch (RejectedExecutionException ree) {
        // Don't do anything here -- just try again.
        getLog().info("RejectedExecutionException... (If you are on OS X, try running "
            + "sudo ifconfig lo0 alias 127.0.0.[0-15]");
      }
    }
    if (!connected) {
      throw new RuntimeException("Cassandra cluster should be up now, but cannot connect!");
    } else {
      getLog().info("Test connection to Cassandra successful -- cluster is up!");
    }
    cluster.close();
  }