List of usage examples for org.apache.cassandra.config YamlConfigurationLoader YamlConfigurationLoader
YamlConfigurationLoader
From source file:com.tuplejump.stargate.cassandra.CassandraUtils.java
License:Apache License
static void loadYaml() throws ConfigurationException, IOException { URL url = CassandraUtils.getStorageConfigURL(); logger.info("Loading settings from " + url); String loaderClass = System.getProperty("cassandra.config.loader"); ConfigurationLoader loader = loaderClass == null ? new YamlConfigurationLoader() : FBUtilities.<ConfigurationLoader>construct(loaderClass, "configuration loading"); conf = loader.loadConfig();//from w w w . j a v a 2 s. c o m logger.info("Data files directories: " + Arrays.toString(conf.data_file_directories)); }
From source file:org.jesterj.ingest.logging.Cassandra.java
License:Apache License
public static void start(File cassandraDir) { System.out.println("Booting to run cassandra"); try {/*from w w w . j av a 2 s. c om*/ if (!cassandraDir.exists() && !cassandraDir.mkdirs()) { throw new RuntimeException("could not create" + cassandraDir); } File yaml = new File(cassandraDir, "cassandra.yaml"); System.setProperty("cassandra.config", yaml.toURI().toString()); if (!yaml.exists()) { CassandraConfig cfg = new CassandraConfig(cassandraDir.getCanonicalPath()); cfg.guessIp(); listenAddress = cfg.getListen_address(); String cfgStr = new Yaml().dumpAsMap(cfg); Files.write(yaml.toPath(), cfgStr.getBytes(), StandardOpenOption.CREATE); } else { ConfigurationLoader cl = new YamlConfigurationLoader(); Config conf = cl.loadConfig(); listenAddress = conf.listen_address; } } catch (IOException | ConfigurationException e) { e.printStackTrace(); } cassandra = new CassandraDaemon(); try { // keep cassandra from clobering system.out and sytem.err System.setProperty("cassandra-foreground", "true"); cassandra.activate(); } catch (Exception e) { e.printStackTrace(); } synchronized (finalBootActions) { while (finalBootActions.peek() != null) { finalBootActions.remove().run(); } booting = false; } System.out.println("Cassandra booted"); }