Search in sources :

Example 1 with AzureCloudConfig

use of com.github.ambry.cloud.azure.AzureCloudConfig in project ambry by linkedin.

the class CloudBlobStoreIntegrationTest method setup.

@Before
public void setup() throws ReflectiveOperationException {
    Properties testProperties = new Properties();
    try (InputStream input = this.getClass().getClassLoader().getResourceAsStream(PROPS_FILE_NAME)) {
        if (input == null) {
            throw new IllegalStateException("Could not find resource: " + PROPS_FILE_NAME);
        }
        testProperties.load(input);
    } catch (IOException ex) {
        throw new IllegalStateException("Could not load properties from resource: " + PROPS_FILE_NAME);
    }
    testProperties.setProperty("clustermap.cluster.name", "Integration-Test");
    testProperties.setProperty("clustermap.datacenter.name", "uswest");
    testProperties.setProperty("clustermap.host.name", "localhost");
    testProperties.setProperty("kms.default.container.key", "B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF");
    testProperties.setProperty(CloudConfig.CLOUD_DELETED_BLOB_RETENTION_DAYS, String.valueOf(1));
    testProperties.setProperty(AzureCloudConfig.AZURE_PURGE_BATCH_SIZE, "10");
    testProperties.setProperty(CloudConfig.CLOUD_IS_VCR, "" + isVcr);
    verifiableProperties = new VerifiableProperties(testProperties);
    azureCloudConfig = new AzureCloudConfig(verifiableProperties);
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties);
    CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
    partitionId = new Partition(666, clusterMapConfig.clusterMapDefaultPartitionClass, PartitionState.READ_WRITE, 100 * 1024 * 1024 * 1024L);
    ClusterMap clusterMap = new MockClusterMap(false, Collections.singletonList(new MockDataNodeId(Collections.singletonList(new Port(6666, PortType.PLAINTEXT)), Collections.singletonList("test"), "AzureTest")), 1, Collections.singletonList(partitionId), "AzureTest");
    MetricRegistry registry = new MetricRegistry();
    vcrMetrics = new VcrMetrics(registry);
    azureMetrics = new AzureMetrics(registry);
    CloudDestinationFactory cloudDestinationFactory = Utils.getObj(cloudConfig.cloudDestinationFactoryClass, verifiableProperties, registry, clusterMap);
    cloudDestination = cloudDestinationFactory.getCloudDestination();
    cloudBlobStore = new CloudBlobStore(verifiableProperties, partitionId, cloudDestination, clusterMap, vcrMetrics);
    cloudBlobStore.start();
}
Also used : Partition(com.github.ambry.clustermap.Partition) ClusterMap(com.github.ambry.clustermap.ClusterMap) MockClusterMap(com.github.ambry.clustermap.MockClusterMap) VerifiableProperties(com.github.ambry.config.VerifiableProperties) InputStream(java.io.InputStream) Port(com.github.ambry.network.Port) MetricRegistry(com.codahale.metrics.MetricRegistry) AzureCloudConfig(com.github.ambry.cloud.azure.AzureCloudConfig) CloudConfig(com.github.ambry.config.CloudConfig) IOException(java.io.IOException) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties) AzureCloudConfig(com.github.ambry.cloud.azure.AzureCloudConfig) ClusterMapConfig(com.github.ambry.config.ClusterMapConfig) MockDataNodeId(com.github.ambry.clustermap.MockDataNodeId) AzureMetrics(com.github.ambry.cloud.azure.AzureMetrics) MockClusterMap(com.github.ambry.clustermap.MockClusterMap) Before(org.junit.Before)

Example 2 with AzureCloudConfig

use of com.github.ambry.cloud.azure.AzureCloudConfig in project ambry by linkedin.

the class AzureTokenResetTool method main.

public static void main(String[] args) {
    String commandName = AzureTokenResetTool.class.getSimpleName();
    try {
        VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
        String clusterName = verifiableProperties.getString(ClusterMapConfig.CLUSTERMAP_CLUSTER_NAME);
        CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
        AzureCloudConfig azureCloudConfig = new AzureCloudConfig(verifiableProperties);
        AzureMetrics azureMetrics = new AzureMetrics(new MetricRegistry());
        AzureBlobLayoutStrategy blobLayoutStrategy = new AzureBlobLayoutStrategy(clusterName, azureCloudConfig);
        AzureBlobDataAccessor dataAccessor = new AzureBlobDataAccessor(cloudConfig, azureCloudConfig, blobLayoutStrategy, azureMetrics);
        storageClient = dataAccessor.getStorageClient();
        int tokensDeleted = resetTokens(clusterName);
        logger.info("Deleted tokens for {} partitions", tokensDeleted);
    } catch (Exception ex) {
        ex.printStackTrace();
        logger.error("Command {} failed", commandName, ex);
        System.exit(1);
    }
}
Also used : VerifiableProperties(com.github.ambry.config.VerifiableProperties) MetricRegistry(com.codahale.metrics.MetricRegistry) AzureCloudConfig(com.github.ambry.cloud.azure.AzureCloudConfig) CloudConfig(com.github.ambry.config.CloudConfig) AzureBlobLayoutStrategy(com.github.ambry.cloud.azure.AzureBlobLayoutStrategy) AzureBlobDataAccessor(com.github.ambry.cloud.azure.AzureBlobDataAccessor) AzureCloudConfig(com.github.ambry.cloud.azure.AzureCloudConfig) AzureMetrics(com.github.ambry.cloud.azure.AzureMetrics) BlobStorageException(com.azure.storage.blob.models.BlobStorageException)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)2 AzureCloudConfig (com.github.ambry.cloud.azure.AzureCloudConfig)2 AzureMetrics (com.github.ambry.cloud.azure.AzureMetrics)2 CloudConfig (com.github.ambry.config.CloudConfig)2 VerifiableProperties (com.github.ambry.config.VerifiableProperties)2 BlobStorageException (com.azure.storage.blob.models.BlobStorageException)1 AzureBlobDataAccessor (com.github.ambry.cloud.azure.AzureBlobDataAccessor)1 AzureBlobLayoutStrategy (com.github.ambry.cloud.azure.AzureBlobLayoutStrategy)1 ClusterMap (com.github.ambry.clustermap.ClusterMap)1 MockClusterMap (com.github.ambry.clustermap.MockClusterMap)1 MockDataNodeId (com.github.ambry.clustermap.MockDataNodeId)1 Partition (com.github.ambry.clustermap.Partition)1 ClusterMapConfig (com.github.ambry.config.ClusterMapConfig)1 Port (com.github.ambry.network.Port)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 Before (org.junit.Before)1