List of usage examples for com.amazonaws.services.redshift.model CreateClusterRequest setClusterIdentifier
public void setClusterIdentifier(String clusterIdentifier)
A unique identifier for the cluster.
From source file:com.amazon.services.awsrum.utils.RedshiftUtils.java
License:Open Source License
/** * Creates a Redshift cluster if it does not exist and waits for it to become active * //from w ww . j a va 2 s. c om * @param client * The {@link AmazonRedshiftClient} with read and write permissions * @param clusterIdentifier * The unique identifier of the Redshift cluster to create * @param databaseName * The database name associated with the Redshift cluster * @param masterUsername * The master username for the Redshift database * @param masterUserPassword * The master password for the Redshift database * @param clusterType * dw.hs1.xlarge or dw.hs1.8xlarge * @param numberOfNodes * The number of nodes for the Redshift cluster */ public static void createCluster(AmazonRedshiftClient client, String clusterIdentifier, String databaseName, String masterUsername, String masterUserPassword, String clusterType, int numberOfNodes) { if (clusterExists(client, clusterIdentifier)) { LOG.info("Cluster " + clusterIdentifier + " is available"); return; } LOG.info(databaseName); CreateClusterRequest createClusterRequest = new CreateClusterRequest(); createClusterRequest.setClusterIdentifier(clusterIdentifier); createClusterRequest.setMasterUsername(masterUsername); createClusterRequest.setMasterUserPassword(masterUserPassword); createClusterRequest.setNodeType(clusterType); createClusterRequest.setNumberOfNodes(numberOfNodes); createClusterRequest.setDBName(databaseName); client.createCluster(createClusterRequest); LOG.info("Created cluster " + clusterIdentifier); String state = null; while (!(state = clusterState(client, clusterIdentifier)).equals("available")) { try { Thread.sleep(10 * 1000); LOG.info(clusterIdentifier + " is " + state + ". Waiting for cluster to become available."); } catch (InterruptedException e) { } } LOG.info("Cluster " + clusterIdentifier + " is available"); }
From source file:com.elsevier.utils.RedshiftUtils.java
License:Open Source License
/** * Creates a Redshift cluster if it does not exist and waits for it to become active * /*from w ww.jav a 2 s .c o m*/ * @param client * The {@link AmazonRedshiftClient} with read and write permissions * @param clusterIdentifier * The unique identifier of the Redshift cluster to create * @param databaseName * The database name associated with the Redshift cluster * @param masterUsername * The master username for the Redshift database * @param masterUserPassword * The master password for the Redshift database * @param clusterType * dw.hs1.xlarge or dw.hs1.8xlarge * @param numberOfNodes * The number of nodes for the Redshift cluster */ public static void createCluster(AmazonRedshiftClient client, String clusterIdentifier, String databaseName, String masterUsername, String masterUserPassword, String clusterType, int numberOfNodes) { if (clusterExists(client, clusterIdentifier)) { LOG.info("Cluster " + clusterIdentifier + " is available"); return; } CreateClusterRequest createClusterRequest = new CreateClusterRequest(); createClusterRequest.setClusterIdentifier(clusterIdentifier); createClusterRequest.setMasterUsername(masterUsername); createClusterRequest.setMasterUserPassword(masterUserPassword); createClusterRequest.setNodeType(clusterType); createClusterRequest.setNumberOfNodes(numberOfNodes); createClusterRequest.setDBName(databaseName); client.createCluster(createClusterRequest); LOG.info("Created cluster " + clusterIdentifier); String state = null; while (!(state = clusterState(client, clusterIdentifier)).equals("available")) { try { Thread.sleep(10 * 1000); LOG.info(clusterIdentifier + " is " + state + ". Waiting for cluster to become available."); } catch (InterruptedException e) { } } LOG.info("Cluster " + clusterIdentifier + " is available"); }