연결 클러스터 삭제

Connect 클러스터를 삭제하면 기본 Kafka 클러스터에 저장된 커넥터 구성을 비롯한 모든 연결된 데이터가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.

Connect 클러스터를 삭제하려면 Google Cloud 콘솔, gcloud CLI, 클라이언트 라이브러리 또는 관리형 Kafka API를 사용하면 됩니다. 오픈소스 Apache Kafka API를 사용하여 Connect 클러스터를 삭제할 수는 없습니다.

Connect 클러스터를 삭제하는 데 필요한 역할 및 권한

Connect 클러스터를 삭제하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 관리형 Kafka Connect 클러스터 편집자 (roles/managedkafka.connectClusterEditor) IAM 역할을 부여해 달라고 요청하세요. 역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

이 사전 정의된 역할에는 Connect 클러스터를 삭제하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.

필수 권한

Connect 클러스터를 삭제하려면 다음 권한이 필요합니다.

  • 연결 클러스터에 연결 클러스터 삭제 권한을 부여합니다. managedkafka.connectClusters.delete
  • 지정된 위치에 커넥트 클러스터 목록 권한을 부여합니다. 이 권한은 Google Cloud 콘솔을 사용하여 연결 클러스터를 삭제하는 경우에만 필요합니다. managedkafka.connectClusters.list

커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.

관리형 Kafka Connect 클러스터 편집자 역할에 대한 자세한 내용은 Apache Kafka용 관리형 서비스 사전 정의된 역할을 참고하세요.

연결 클러스터 삭제

  • 데이터 손실 영향 이해: 커넥트 클러스터를 삭제하면 커넥트 클러스터 자체 내에 저장된 모든 데이터가 삭제됩니다. 여기에는 다음이 포함됩니다.

    • 커넥터 및 구성

    • Connect 클러스터에서 직접 관리하는 기타 데이터

    Connect 클러스터를 삭제해도 소스 또는 타겟 Kafka 클러스터의 데이터는 삭제되지 않습니다. 소스 커넥터를 사용하여 Kafka 주제로 데이터를 이동하는 경우 Connect 클러스터를 삭제해도 해당 Kafka 주제에 이미 게시된 데이터는 삭제되지 않습니다. 마찬가지로 Connect 클러스터를 삭제해도 Connect 클러스터와 연결된 Kafka 클러스터는 삭제되지 않습니다.

  • 서비스 중단 계획: 연결 클러스터에서 읽거나 쓰는 데이터에 의존하는 애플리케이션 또는 서비스는 중단될 수 있습니다. 클러스터를 삭제하기 전에 이 서비스 중단을 계획하세요.

  • 결제 관련 사항 검토: 클러스터를 삭제하면 클러스터에 대한 요금 청구가 중지됩니다. 삭제될 때까지 사용한 리소스에 대해서는 요금이 청구될 수 있습니다.

  • 비동기 작업 예상: 클러스터 삭제는 기본적으로 비동기식입니다. 명령어가 즉시 반환되며 삭제 진행 상황을 별도로 추적할 수 있습니다.

콘솔

  1. Google Cloud 콘솔에서 클러스터 연결 페이지로 이동합니다.

    클러스터 연결로 이동

  2. 삭제할 Connect 클러스터를 선택합니다. 두 개 이상 선택할 수 있습니다.

  3. 삭제를 클릭합니다.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. gcloud managed-kafka connect-clusters delete 명령어를 사용하여 Connect 클러스터를 삭제합니다.

    gcloud managed-kafka connect-clusters delete CONNECT_CLUSTER \
        --location=LOCATION [--async]
    

    다음을 바꿉니다.

    • CONNECT_CLUSTER: 삭제할 Connect 클러스터의 ID입니다.
    • LOCATION: Connect 클러스터의 위치입니다.

    다음 플래그는 선택사항입니다.

    • --async: 진행 중인 작업이 완료될 때까지 기다리지 않고 즉시 반환합니다.
  3. Go

    이 샘플을 사용해 보기 전에 클라이언트 라이브러리 설치의 Go 설정 안내를 따르세요. 자세한 내용은 Apache Kafka용 관리형 서비스 Go API 참조 문서를 참고하세요.

    Managed Service for Apache Kafka에 인증하려면 애플리케이션 기본 사용자 인증 정보(ADC)를 설정합니다. 자세한 내용은 로컬 개발 환경의 ADC 설정을 참고하세요.

    import (
    	"context"
    	"fmt"
    	"io"
    
    	"cloud.google.com/go/managedkafka/apiv1/managedkafkapb"
    	"google.golang.org/api/option"
    
    	managedkafka "cloud.google.com/go/managedkafka/apiv1"
    )
    
    func deleteConnectCluster(w io.Writer, projectID, region, clusterID string, opts ...option.ClientOption) error {
    	// projectID := "my-project-id"
    	// region := "us-central1"
    	// clusterID := "my-connect-cluster"
    	ctx := context.Background()
    	client, err := managedkafka.NewManagedKafkaConnectClient(ctx, opts...)
    	if err != nil {
    		return fmt.Errorf("managedkafka.NewManagedKafkaConnectClient got err: %w", err)
    	}
    	defer client.Close()
    
    	clusterPath := fmt.Sprintf("projects/%s/locations/%s/connectClusters/%s", projectID, region, clusterID)
    	req := &managedkafkapb.DeleteConnectClusterRequest{
    		Name: clusterPath,
    	}
    	op, err := client.DeleteConnectCluster(ctx, req)
    	if err != nil {
    		return fmt.Errorf("client.DeleteConnectCluster got err: %w", err)
    	}
    	err = op.Wait(ctx)
    	if err != nil {
    		return fmt.Errorf("op.Wait got err: %w", err)
    	}
    	fmt.Fprint(w, "Deleted connect cluster\n")
    	return nil
    }
    

    자바

    이 샘플을 시도하기 전에 클라이언트 라이브러리 설치의 Java 설정 안내를 따르세요. 자세한 내용은 Apache Kafka용 관리형 서비스 Java API 참조 문서를 참고하세요.

    Managed Service for Apache Kafka에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 ADC 설정을 참고하세요.

    
    import com.google.api.gax.longrunning.OperationFuture;
    import com.google.api.gax.longrunning.OperationSnapshot;
    import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
    import com.google.api.gax.retrying.RetrySettings;
    import com.google.api.gax.retrying.TimedRetryAlgorithm;
    import com.google.api.gax.rpc.ApiException;
    import com.google.cloud.managedkafka.v1.ConnectClusterName;
    import com.google.cloud.managedkafka.v1.DeleteConnectClusterRequest;
    import com.google.cloud.managedkafka.v1.ManagedKafkaConnectClient;
    import com.google.cloud.managedkafka.v1.ManagedKafkaConnectSettings;
    import com.google.cloud.managedkafka.v1.OperationMetadata;
    import com.google.protobuf.Empty;
    import java.io.IOException;
    import java.time.Duration;
    
    public class DeleteConnectCluster {
    
      public static void main(String[] args) throws Exception {
        // TODO(developer): Replace these variables before running the example.
        String projectId = "my-project-id";
        String region = "my-region"; // e.g. us-east1
        String clusterId = "my-connect-cluster";
        deleteConnectCluster(projectId, region, clusterId);
      }
    
      public static void deleteConnectCluster(String projectId, String region, String clusterId)
          throws Exception {
    
        // Create the settings to configure the timeout for polling operations
        ManagedKafkaConnectSettings.Builder settingsBuilder = ManagedKafkaConnectSettings.newBuilder();
        TimedRetryAlgorithm timedRetryAlgorithm = OperationTimedPollAlgorithm.create(
            RetrySettings.newBuilder()
                .setTotalTimeoutDuration(Duration.ofHours(1L))
                .build());
        settingsBuilder.deleteConnectClusterOperationSettings()
            .setPollingAlgorithm(timedRetryAlgorithm);
    
        try (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create(
            settingsBuilder.build())) {
          DeleteConnectClusterRequest request = DeleteConnectClusterRequest.newBuilder()
              .setName(ConnectClusterName.of(projectId, region, clusterId).toString())
              .build();
          OperationFuture<Empty, OperationMetadata> future = managedKafkaConnectClient
              .deleteConnectClusterOperationCallable().futureCall(request);
    
          // Get the initial LRO and print details. CreateConnectCluster contains sample
          // code for polling logs.
          OperationSnapshot operation = future.getInitialFuture().get();
          System.out.printf(
              "Connect cluster deletion started. Operation name: %s\nDone: %s\nMetadata: %s\n",
              operation.getName(),
              operation.isDone(),
              future.getMetadata().get().toString());
    
          future.get();
          System.out.println("Deleted connect cluster");
        } catch (IOException | ApiException e) {
          System.err.printf("managedKafkaConnectClient.deleteConnectCluster got err: %s\n", 
              e.getMessage());
        }
      }
    }
    

    Python

    이 샘플을 시도하기 전에 클라이언트 라이브러리 설치의 Python 설정 안내를 따르세요. 자세한 내용은 Apache Kafka용 관리형 서비스 Python API 참조 문서를 참고하세요.

    Managed Service for Apache Kafka에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 ADC 설정을 참고하세요.

    from google.api_core.exceptions import GoogleAPICallError
    from google.cloud.managedkafka_v1.services.managed_kafka_connect import (
        ManagedKafkaConnectClient,
    )
    from google.cloud import managedkafka_v1
    
    # TODO(developer)
    # project_id = "my-project-id"
    # region = "us-central1"
    # connect_cluster_id = "my-connect-cluster"
    
    connect_client = ManagedKafkaConnectClient()
    
    request = managedkafka_v1.DeleteConnectClusterRequest(
        name=connect_client.connect_cluster_path(project_id, region, connect_cluster_id),
    )
    
    try:
        operation = connect_client.delete_connect_cluster(request=request)
        print(f"Waiting for operation {operation.operation.name} to complete...")
        operation.result()
        print("Deleted Connect cluster")
    except GoogleAPICallError as e:
        print(f"The operation failed with error: {e}")
    

다음 단계

Apache Kafka®는 미국 및/또는 다른 국가에서 사용되는 Apache Software Foundation 또는 해당 계열사의 등록 상표입니다.