Package org.rhq.cassandra

Examples of org.rhq.cassandra.ClusterInitService


            executeInClassScope(new Callable<Void>() {
                public Void call() throws Exception {
                    SchemaManager schemaManager = null;
                    try {
                        ClusterInitService clusterInitService = new ClusterInitService();

                        String[] nodes = null;
                        int[] jmxPorts = null;
                        int cqlPort = -1;

                        if (!Boolean.valueOf(System.getProperty("itest.use-external-storage-node", "false"))) {

                            DeploymentOptionsFactory factory = new DeploymentOptionsFactory();
                            DeploymentOptions options = factory.newDeploymentOptions();
                            File basedir = new File("target");
                            File clusterDir = new File(basedir, "cassandra");

                            options.setUsername("rhqadmin");
                            options.setPassword("1eeb2f255e832171df8592078de921bc");
                            options.setClusterDir(clusterDir.getAbsolutePath());
                            options.setHeapSize("256M");
                            options.setHeapNewSize("64M");
                            options.setStartRpc(true);

                            ccm = new CassandraClusterManager(options);
                            ccm.createCluster();

                            nodes = ccm.getNodes();
                            jmxPorts = ccm.getJmxPorts();
                            cqlPort = ccm.getCqlPort();

                            ccm.startCluster(false);

                            try {
                                clusterInitService.waitForClusterToStart(nodes, jmxPorts, nodes.length, 2000, 20, 10);
                                schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc", nodes,
                                    cqlPort);
                            } catch (Exception e) {
                                if (null != ccm) {
                                    ccm.shutdownCluster();
                                }
                                throw new RuntimeException("Cassandra cluster initialization failed", e);
                            }
                        } else {
                            try {
                                String nodesString = System.getProperty("rhq.storage.nodes", "127.0.0.1");
                                nodes = nodesString.split(",");

                                String cqlPortString = System.getProperty("rhq.storage.cql-port", "9042");
                                cqlPort = Integer.parseInt(cqlPortString);

                                String jmxPortString = System.getProperty("rhq.storage.jmx-port", "7299");
                                jmxPorts = new int[] { Integer.parseInt(jmxPortString) };

                                schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc", nodes, cqlPort);

                            } catch (Exception e) {
                                throw new RuntimeException("External Cassandra initialization failed", e);
                            }
                        }
                        try {
                            schemaManager.install();
                            clusterInitService.waitForSchemaAgreement(nodes, jmxPorts);
                            schemaManager.updateTopology();
                        } catch (Exception e) {
                            if (null != ccm) {
                                ccm.shutdownCluster();
                            }
View Full Code Here


        doDeployment(deploymentOptions);

        String[] addresses = new String[] {"127.0.0.1"};
        int[] jmxPorts = new int[] {7399};

        ClusterInitService clusterInitService = new ClusterInitService();
        clusterInitService.waitForClusterToStart(addresses, jmxPorts);

        SchemaManager schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc",
            addresses, 9142);
        try {
            schemaManager.install();
View Full Code Here

            deploymentOptions.setHeapSize("256M");
            deploymentOptions.setHeapNewSize("64M");
            deploymentOptions.load();

            doDeployment(deploymentOptions);
            ClusterInitService clusterInitService = new ClusterInitService();
            clusterInitService.waitForClusterToStart(new String [] {"127.0.0.2"}, new int[] {7400});

            InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
            InventoryReport inventoryReport = inventoryManager.executeServerScanImmediately();
            Resource newStorageNode = null;
View Full Code Here

        }

        ccm.createCluster();
        ccm.startCluster(false);

        ClusterInitService clusterInitService = new ClusterInitService();
        clusterInitService.waitForClusterToStart(new String[] {"127.0.0.1"}, new int[] {8399}, 1, 2000, 20, 10);
    }
View Full Code Here

TOP

Related Classes of org.rhq.cassandra.ClusterInitService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.