Example usage for org.apache.cassandra.service CassandraDaemon main

List of usage examples for org.apache.cassandra.service CassandraDaemon main

Introduction

In this page you can find the example usage for org.apache.cassandra.service CassandraDaemon main.

Prototype

public static void main(String[] args) 

Source Link

Usage

From source file:my.test.cluster.Node0.java

License:Apache License

public static void main(String[] args) {
    //        System.setProperty("cassandra.rpc_port", "9160");
    //        System.setProperty("cassandra.start_native_transport", "true"); //?native server?CQL
    //        System.setProperty("cassandra.native_transport_port", "9042");

    System.setProperty("cassandra.config", "node0.yaml");

    System.setProperty("log4j.defaultInitOverride", "true");
    System.setProperty("log4j.configuration", "my-log4j-server.properties");

    //System.setProperty("cassandra.start_rpc", "false"); //??thrift server

    System.setProperty("cassandra-foreground", "true"); //??

    CassandraDaemon.main(new String[] {});
}

From source file:my.test.cluster.Node1.java

License:Apache License

public static void main(String[] args) {
    //        System.setProperty("cassandra.rpc_port", "9160");
    //        System.setProperty("cassandra.start_native_transport", "true"); //?native server?CQL
    //        System.setProperty("cassandra.native_transport_port", "9042");

    System.setProperty("cassandra.config", "node1.yaml");

    System.setProperty("log4j.defaultInitOverride", "true");
    System.setProperty("log4j.configuration", "my-log4j-server.properties");

    //System.setProperty("cassandra.start_rpc", "false"); //??thrift server

    System.setProperty("cassandra-foreground", "true"); //??

    CassandraDaemon.main(new String[] {});
}

From source file:my.test.cluster.Node2.java

License:Apache License

public static void main(String[] args) {
    //        System.setProperty("cassandra.rpc_port", "9160");
    //        System.setProperty("cassandra.start_native_transport", "true"); //?native server?CQL
    //        System.setProperty("cassandra.native_transport_port", "9042");

    System.setProperty("cassandra.config", "node2.yaml");

    System.setProperty("log4j.defaultInitOverride", "true");
    System.setProperty("log4j.configuration", "my-log4j-server.properties");

    //System.setProperty("cassandra.start_rpc", "false"); //??thrift server

    System.setProperty("cassandra-foreground", "true"); //??

    CassandraDaemon.main(new String[] {});
}

From source file:my.test.start.CassandraDaemonStart.java

License:Apache License

public static void main(String[] args) {
    System.setProperty("cassandra.rpc_port", "9160");
    System.setProperty("cassandra.start_native_transport", "true"); //?native server?CQL
    System.setProperty("cassandra.native_transport_port", "9042");

    System.setProperty("cassandra.config", "my-cassandra.yaml");

    System.setProperty("log4j.defaultInitOverride", "true");
    System.setProperty("log4j.configuration", "my-log4j-server.properties");

    System.setProperty("cassandra.start_rpc", "false"); //??thrift server

    System.setProperty("cassandra-foreground", "true"); //??

    CassandraDaemon.main(new String[] {});
}

From source file:org.codehaus.mojo.cassandra.CassandraMonitor.java

License:Apache License

/**
 * Starts the {@link CassandraMonitor} and then delegates to {@link CassandraDaemon}.
 *
 * @param args the command line arguments.
 * @throws IOException if something goes wrong.
 *//*from ww w . j  a v a  2 s  .  c  o  m*/
public static void main(String[] args) throws IOException {
    String host = System.getProperty(HOST_PROPERTY_NAME, "127.0.0.1");
    String property = System.getProperty(PORT_PROPERTY_NAME);
    String key = System.getProperty(KEY_PROPERTY_NAME);
    if (property != null && key != null) {
        int port = Integer.parseInt(property);
        CassandraMonitor monitor = new CassandraMonitor(host, port, key);
        monitor.setDaemon(true);
        monitor.start();
    }
    CassandraDaemon.main(args);
}

From source file:org.janusgraph.diskstorage.cassandra.utils.CassandraDaemonWrapper.java

License:Apache License

public static synchronized void start(String config) {

    if (started) {
        if (null != config && !config.equals(activeConfig)) {
            log.warn("Can't start in-process Cassandra instance " + "with yaml path {} because an instance was "
                    + "previously started with yaml path {}", config, activeConfig);
        }/*w  ww.  ja va  2  s  .  c  om*/

        return;
    }

    started = true;

    log.debug("Current working directory: {}", System.getProperty("user.dir"));

    System.setProperty("cassandra.config", config);
    // Prevent Cassandra from closing stdout/stderr streams
    System.setProperty("cassandra-foreground", "yes");
    // Prevent Cassandra from overwriting Log4J configuration
    System.setProperty("log4j.defaultInitOverride", "false");

    log.info("Starting cassandra with {}", config);

    /*
     * This main method doesn't block for any substantial length of time. It
     * creates and starts threads and returns in relatively short order.
     */
    CassandraDaemon.main(new String[0]);

    activeConfig = config;
}