Google Cloud Dataproc Sink Connector for Confluent Cloud

Note

If you are installing the connector locally for Confluent Platform, see Google Cloud Dataproc Sink Connector for Confluent Platform.

The Kafka Connect Google Cloud Dataproc Sink Connector for Confluent Cloud integrates Apache Kafka® with managed HDFS instances in Google Cloud Dataproc. The connector periodically polls data from Kafka and writes this data to HDFS. The connector supports Avro, JSON Schema, Protobuf, or JSON (schemaless) input data formats and Avro, JSON, and String output formats.

The Kafka Connect Google Cloud Dataproc sink connector integrates with Hive. When it is enabled, the connector automatically creates an external Hive partitioned table for each Kafka topic and updates the table according to the available data in HDFS.

Important

After this connector becomes generally available, Confluent Cloud Enterprise customers will need to contact their Confluent Account Executive for more information about using this connector.

Features

The Google Cloud Dataproc sink connector provides the following features:

  • Exactly Once Delivery: The connector uses a write ahead log to ensure each record exports to HDFS exactly once. Also, the connector manages the offsets commit by encoding the Kafka offset information into the file so that the connector can start from the last committed offsets in case of failures and task restarts.

  • Data formats: The connector supports Avro, JSON Schema, Protobuf, or JSON (schemaless) input data formats and Avro, JSON, and String output formats. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON Schema, or Protobuf).

  • Hive Integration: The connector supports Hive integration. When it is enabled, the connector automatically creates a Hive external partitioned table for each topic exported to HDFS. input.data.format should be AVRO

  • Time-Based Partitioner: The connector supports a daily and hourly partitioner.

  • Seamless Dataproc Integration: The only connection requirements are the Google Cloud Platform credentials and the Dataproc cluster name and project. No need to get the HDFS URL or adjust a Hadoop configuration.

  • High Availability (HA) Cluster Support: No additional configuration is required to connect to a multi-master HA cluster.

  • Flush size: flush.size defaults to 1000. The default value can be increased if needed. The default value can be lowered if you are running a Dedicated Confluent Cloud cluster.

    The following scenarios describe a couple of ways records may be flushed to storage:

    • You use the default setting of 1000 and your topic has six partitions. Files start to be created in storage after more than 1000 records exist in each partition.

    • You use the default setting of 1000 and the partitioner is set to Hourly. 500 records arrive at one partition from 2:00pm to 3:00pm. At 3:00pm, an additional 5 records arrive at the partition. You will see 500 records in storage at 3:00pm.

      Note

      The properties rotate.schedule.interval.ms and rotate.interval.ms can be used with flush.size to determine when files are created in storage. These parameters kick in and files are stored based on which condition is met first.

      For example: You have one topic partition. You set flush.size=1000 and rotate.schedule.interval.ms=600000 (10 minutes). 500 records arrive at the topic partition from 12:01 to 12:10. 500 additional records arrive from 12:11 to 12:20. You will see two files in the storage bucket with 500 records in each file. This is because the 10 minute rotate.schedule.interval.ms condition tripped before the flush.size=1000 condition was met.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Refer to Cloud connector limitations for additional information.

Caution

Preview connectors are not currently supported and are not recommended for production use.

Quick Start

Use this quick start to get up and running with the Confluent Cloud Google Cloud Dataproc sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to HDFS.

Prerequisites
  • Kafka cluster credentials. You can use one of the following ways to get credentials:
    • Create a Confluent Cloud API key and secret. To create a key and secret, go to Kafka API keys in your cluster or you can autogenerate the API key and secret directly in the UI when setting up the connector.
    • Create a Confluent Cloud service account for the connector.

Using the Confluent Cloud GUI

Complete the following steps to set up and run the connector using the Confluent Cloud GUI.

Step 1: Launch your Confluent Cloud cluster.

See the Quick Start for Apache Kafka using Confluent Cloud for installation instructions.

Step 2: Add a connector.

Click Connectors. If you already have connectors in your cluster, click Add connector.

Step 3: Select your connector.

Click the Google Cloud Dataproc Sink connector icon.

Google Cloud Dataproc Sink Connector Icon

Step 4: Enter the cluster details.

Note

  • Make sure you have all your prerequisites completed.
  • An asterisk ( * ) designates a required entry.

Complete the following and click Continue.

  1. Select an Input message format (data coming from the Kafka topic): AVRO, JSON_SR (JSON Schema), PROTOBUF, or JSON (schemaless). A valid schema must be available in Schema Registry to use a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).

    Note

    Input format JSON to output format AVRO does not work for the preview connector.

  2. Enter a Connector Name.

  3. Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.

Step 5: Enter the destination details.

Important

Your GCP credentials are validated here. Make sure you enter these correctly.

  1. Select the format for messages coming from the Kafka topic. Note that input format JSON to output format AVRO does not work for the preview connector. A valid schema must be available in Confluent Cloud Schema Registry to use a schema-based message format, like Avro.

  2. Upload your GCP credentials JSON file.

  3. Enter your Dataproc project ID and cluster name.

  4. Under HDFS details, enter the topics directory (optional) and the top-level HDFS directory where write-ahead logs are stored.

  5. Select an Output message format (data coming from the connector): AVRO, JSON, or STRING. A valid schema must be available in Schema Registry to use a schema-based message format (for example, Avro).

  6. Under Hive, select whether you want to use Hive integration and then add the details for your Hive configuration.

  7. Under Organize my data, enter the following properties:

    • Time interval: Select the time-based partitioning interval you want to use.

    • Flush size. This value defaults to 1000. The default value can be raised (and lowered, if running a dedicated cluster).

      The following scenarios describe a couple of ways records may be flushed to storage:

      • You use the default setting of 1000 and your topic has six partitions. Files start to be created in storage after more than 1000 records exist in each partition.

      • You use the default setting of 1000 and the partitioner is set to Hourly. 500 records arrive at one partition from 2:00pm to 3:00pm. At 3:00pm, an additional 5 records arrive at the partition. You will see 500 records in storage at 3:00pm.

        Note

        The properties rotate.schedule.interval.ms and rotate.interval.ms can be used with flush.size to determine when files are created in storage. These parameters kick in and files are stored based on which condition is met first.

        For example: You have one topic partition. You set flush.size=1000 and rotate.schedule.interval.ms=600000 (10 minutes). 500 records arrive at the topic partition from 12:01 to 12:10. 500 additional records arrive from 12:11 to 12:20. You will see two files in the storage bucket with 500 records in each file. This is because the 10 minute rotate.schedule.interval.ms condition tripped before the flush.size=1000 condition was met.

  8. Enter the maximum number of tasks the connector can use. Refer to Confluent Cloud connector limitations for additional information.

Configuration properties that are not shown in the Confluent Cloud UI use the default values. For default values and property definitions, see Google Cloud Dataproc Sink Connector Configuration Properties.

Step 6: Launch the connector.

Verify the following and click Launch.

Launch the connector

Step 7: Check the connector status.

The status for the connector should go from Provisioning to Running.

Step 8: Check the Dataproc cluster.

Go to your Dataproc cluster and make sure the topic is being populated with records.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See Dead Letter Queue for details.

For additional information about this connector, see Google Cloud Dataproc Sink Connector for Confluent Platform. Note that not all Confluent Platform connector features are provided in the Confluent Cloud connector.

See also

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent Cloud CLI to manage your resources in Confluent Cloud.

../_images/topology.png

Using the Confluent Cloud CLI

Complete the following steps to set up and run the connector using the Confluent Cloud CLI.

Note

Make sure you have all your prerequisites completed.

Step 1: List the available connectors.

Enter the following command to list available connectors:

ccloud connector-catalog list

Step 2: Show the required connector configuration properties.

Enter the following command to show the required connector properties:

ccloud connector-catalog describe <connector-catalog-name>

For example:

ccloud connector-catalog describe DataprocSink

Example output:

Following are the required configs:
connector.class: DataprocSink
name
kafka.api.key
kafka.api.secret
topics
input.data.format
gcp.dataproc.credentials.json
gcp.dataproc.projectId
gcp.dataproc.cluster
gcp.dataproc.namenode
logs.dir
output.data.format
time.interval
tasks.max

Step 3: Create the connector configuration file.

Create a JSON file that contains the connector configuration properties. The following example shows required and optional connector properties.

{
  "connector.class": "DataprocSink",
  "name": "dataproc-test",
  "kafka.api.key": "<my-kafka-api-key>",
  "kafka.api.secret": "<my-kafka-api-secret>",
  "topics": "<topic-name>",
  "input.data.format": "AVRO",
  "gcp.dataproc.credentials.json": "<credentials-json-file-contents>",
  "gcp.dataproc.projectId": "<my-dataproc-project-ID",
  "gcp.dataproc.cluster": "<my-dataproc-cluster-name>",
  "gcp.dataproc.namenode": "<IP-address-of-the-namenode>",
  "logs.dir": "<HDFS-logs-directory>",
  "output.data.format": "AVRO",
  "flush.size": "1000",
  "time.interval": "HOURLY",
  "tasks.max": "1"
}

Note the following property definitions:

  • "name": Sets a name for your new connector.

  • "connector.class": Identifies the connector plugin name.

  • "topics": Identifies the topic name or a comma-separated list of topic names.

  • "input.data.format": Sets the input message format (data coming from the Kafka topic). Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. You must have Confluent Cloud Schema Registry configured if using a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).

    Note

    Input format JSON to output format AVRO does not work for the preview connector.

  • "gcp.dataproc.credentials.json": This contains the contents of the downloaded JSON file. See Formatting GCP credentials for details about how to format and use the contents of the downloaded credentials file.

  • "gcp.dataproc.namenode": For VPC-peered environments, this is the internal IP address of the HDFS NameNode (GCP Dataproc master node). For non-VPC-peered environments, this the FQDN resolving to the public IP address or the public IP address of the NameNode (for example: cluster1-m.confluentinc.com). For non-VPC-peered environment configuration details, see Configuring a non-VPC peering environment.

  • "logs.dir": This is the the top-level HDFS directory where write-ahead logs are stored.

  • "output.data.format": Sets the output message format. Valid entries are AVRO, JSON, or STRING. You must have Confluent Cloud Schema Registry configured if using a schema-based output message format (for example, Avro).

  • (Optional) flush.size: This value defaults to 1000. The default value can be raised (and lowered, if running a dedicated cluster).

    The following scenarios describe a couple of ways records may be flushed to storage:

    • You use the default setting of 1000 and your topic has six partitions. Files start to be created in storage after more than 1000 records exist in each partition.

    • You use the default setting of 1000 and the partitioner is set to Hourly. 500 records arrive at one partition from 2:00pm to 3:00pm. At 3:00pm, an additional 5 records arrive at the partition. You will see 500 records in storage at 3:00pm.

      Note

      The properties rotate.schedule.interval.ms and rotate.interval.ms can be used with flush.size to determine when files are created in storage. These parameters kick in and files are stored based on which condition is met first.

      For example: You have one topic partition. You set flush.size=1000 and rotate.schedule.interval.ms=600000 (10 minutes). 500 records arrive at the topic partition from 12:01 to 12:10. 500 additional records arrive from 12:11 to 12:20. You will see two files in the storage bucket with 500 records in each file. This is because the 10 minute rotate.schedule.interval.ms condition tripped before the flush.size=1000 condition was met.

  • "time.interval": Sets how your messages are grouped. Valid entries are DAILY or HOURLY.

Configuration properties that are not listed use the default values. For default values and property definitions, see Google Cloud Dataproc Sink Connector Configuration Properties.

Formatting GCP credentials

The contents of the downloaded credentials file must be converted to string format before it can be used in the connector configuration.

  1. Convert the JSON file contents into string format. You can use an online converter tool to do this. For example: JSON to String Online Converter.

  2. Add the escape character \ before all \n entries in the Private Key section so that each section begins with \\n (see the highlighted lines below). The example below has been formatted so that the \\n entries are easier to see. Most of the credentials key has been omitted.

    Tip

    A script is available that converts the credentials to a string and also adds additional \ escape characters where needed. See Stringify GCP Credentials.

      {
          "connector.class": "DataprocSink",
          "name": "dataproc-sink",
          "kafka.api.key": "<my-kafka-api-key>",
          "kafka.api.secret": "<my-kafka-api-secret>",
          "topics": "<topic-name>",
          "data.format": "AVRO",
          "gcp.dataproc.credentials.json" : "{\"type\":\"service_account\",\"project_id\":\"connect-
          1234567\",\"private_key_id\":\"omitted\",
          \"private_key\":\"-----BEGIN PRIVATE KEY-----
          \\nMIIEvAIBADANBgkqhkiG9w0BA
          \\n6MhBA9TIXB4dPiYYNOYwbfy0Lki8zGn7T6wovGS5pzsIh
          \\nOAQ8oRolFp\rdwc2cC5wyZ2+E+bhwn
          \\nPdCTW+oZoodY\\nOGB18cCKn5mJRzpiYsb5eGv2fN\/J
          \\n...rest of key omitted...
          \\n-----END PRIVATE KEY-----\\n\",
          \"client_email\":\"pub-sub@connect-123456789.iam.gserviceaccount.com\",
          \"client_id\":\"123456789\",\"auth_uri\":\"https:\/\/accounts.google.com\/o\/oauth2\/
          auth\",\"token_uri\":\"https:\/\/oauth2.googleapis.com\/
          token\",\"auth_provider_x509_cert_url\":\"https:\/\/
          www.googleapis.com\/oauth2\/v1\/
          certs\",\"client_x509_cert_url\":\"https:\/\/www.googleapis.com\/
          robot\/v1\/metadata\/x509\/pub-sub%40connect-
          123456789.iam.gserviceaccount.com\"}",
          "gcp.dataproc.projectId": "<my-dataproc-project-ID",
          "gcp.dataproc.region": "<gcp-region>",
          "gcp.dataproc.cluster": "<my-dataproc-cluster-name>",
          "logs.dir": "<HDFS-logs-directory>",
          "flush.size": "1000",
          "time.interval": "HOURLY",
          "tasks.max": "1"
      }
    
  3. Add all the converted string content to the "gcp.dataproc.credentials.json" section of your configuration file as shown in the example above.

Step 4: Load the configuration file and create the connector.

Enter the following command to load the configuration and start the connector:

ccloud connector create --config <file-name>.json

For example:

ccloud connector create --config dataproc-sink-config.json

Example output:

Created connector dataproc-sink lcc-ix4dl

Step 5: Check the connector status.

Enter the following command to check the connector status:

ccloud connector list

Example output:

ID          |       Name      | Status  | Type
+-----------+-----------------+---------+------+
lcc-ix4dl   | dataproc-sink   | RUNNING | sink

Step 6: Check the Dataproc cluster.

Go to your Dataproc cluster and make sure the topic is being populated with records.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See Dead Letter Queue for details.

For additional information about this connector, see Google Cloud Dataproc Sink Connector for Confluent Platform. Note that not all Confluent Platform connector features are provided in the Confluent Cloud connector.

Next Steps

See also

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent Cloud CLI to manage your resources in Confluent Cloud.

../_images/topology.png

Configuring a non-VPC peering environment

When Confluent Cloud is set up with public endpoints in a non-VPC peering environment, connector requests originate from a public IP endpoint at the Confluent Cloud VPC where the Dataproc connector is running. However, the Dataproc cluster VPC does not provide a public IP address endpoint. Even if each Dataproc node has a Public IP address configured, the VPC does not, and the Hadoop daemon returns private IP addresses and private hostnames to the Confluent Cloud connector.

Private IP response to Confluent Cloud

Private IP response to Confluent Cloud

After you complete the following procedure:

  • The Dataproc connector can successfully establish connectivity to the GCP Dataproc cluster master node (HDFS NameNode).
  • The GCP Dataproc cluster can respond over public IP to the Confluent Cloud VPC and Dataproc connector.
  • All Dataproc nodes (HDFS NameNode and DataNodes) in the cluster retain the use of their private IP addresses.

The procedure assumes you are starting a new Dataproc and Confluent Cloud cluster.

Prerequisites
  • Authorization to update GCP instances (Dataproc nodes) and configure DNS record sets for your GCP project account.
  • The gcloud CLI must be installed and configured to manage your GCP Dataproc cluster.
  • Access to a running Dataproc cluster in GCP.
  • The Dataproc cluster must have the Cloud Resource Manager API enabled.
  • The Dataproc cluster VPC must have the following ports open (IP ranges: 0.0.0.0/0) for Confluent Cloud connector ingress:
    • tcp:8020
    • tcp:9000
    • tcp:9083
    • tcp:9864-9867

Step 1: Add or create record sets in Cloud DNS

To create a configuration in a non-VPC peered environment, you first need to add or create record sets in the GCP Cloud DNS service. Create the following zones:

  • public zone: Contains record sets corresponding to the external IP addresses of each Dataproc cluster node.
  • private zone #1: Contains record sets corresponding to the internal IP addresses of each Dataproc cluster node.
  • private zone #2: This is a managed reverse lookup zone. It contains the reverse internal IP addresses (in 10.in-addr.arpa. format) for each Dataproc cluster node.
Public DNS record set example

GCP Cloud DNS console

You can create DNS zones and record sets using the gcloud CLI or by using the GCP Cloud DNS console.

  1. Get the instance names, external IP addresses, and internal IP addresses for each of your Dataproc nodes.

    gcloud compute instances list --project=<my-gcp-project> --zone <region-zone> --filter "<my-cluster-ID>"
    

    For example:

    gcloud compute instances list --project=ccloud-lab-47372 --zones us-west1-c --filter "cluster-fa79"
    
    NAME              ZONE           MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
    cluster-fa79-m    us-central1-c  n1-standard-4               10.128.0.6   34.67.10.174    RUNNING
    cluster-fa79-w-0  us-central1-c  n1-standard-4               10.128.0.2   34.72.119.108   RUNNING
    cluster-fa79-w-1  us-central1-c  n1-standard-4               10.128.0.3   104.154.209.27  RUNNING
    
  2. Create or add each instance name and external IP address to a public cloud DNS zone using the gcloud CLI or the Cloud DNS console. Once you have created the DNS zone and record sets, view the records in the GUI or list them using the following gcloud command.

    gcloud dns record-sets list --zone=<public-dns-zone> --project=<gcp-project-ID>
    

    For example:

    gcloud dns record-sets list --zone=ccloud-dataproc-public --project=ccloud-lab-47372
    NAME                                       TYPE  TTL    DATA
    ccloud.dataproc.lab.net.                   NS    21600  ns-cloud-b1.googledomains.com.,ns-cloud-b2.googledomains.com.,ns-cloud-b3.googledomains.com.,ns-cloud-b4.googledomains.com.
    ccloud.dataproc.lab.net.                   SOA   21600  ns-cloud-b1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
    cluster-fa79-m.ccloud.dataproc.lab.net.    A     300    34.67.10.174
    cluster-fa79-w-0.ccloud.dataproc.lab.net.  A     300    34.72.119.108
    cluster-fa79-w-1.ccloud.dataproc.lab.net.  A     300    104.154.209.27
    
  3. Create or add each instance name and internal IP address to a private cloud DNS zone using the gcloud CLI or the Cloud DNS console. Once you have created the DNS zone and record sets, view the records in the GUI or list them using the following gcloud command.

    gcloud dns record-sets list --zone=<private-dns-zone> --project=<gcp-project-ID>
    

    For example:

    gcloud dns record-sets list --zone=ccloud-dataproc-private --project=ccloud-lab-47372
    NAME                                       TYPE  TTL    DATA
    ccloud.dataproc.lab.net.                   NS    21600  ns-gcp-private.googledomains.com.
    ccloud.dataproc.lab.net.                   SOA   21600  ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
    cluster-fa79-m.ccloud.dataproc.lab.net.    A     300    10.128.0.6
    cluster-fa79-w-0.ccloud.dataproc.lab.net.  A     300    10.128.0.2
    cluster-fa79-w-1.ccloud.dataproc.lab.net.  A     300    10.128.0.3
    
  4. Create or add each instance name and reverse lookup address (10.in-addr.arpa.) to a private cloud DNS zone using the gcloud CLI or the Cloud DNS console. Once you have created the DNS zone and record sets, view the records in the GUI or list them using the following gcloud command.

    gcloud dns record-sets list --zone=<private-reverse-dns-zone> --project=<gcp-project-ID>
    

    For example:

    gcloud dns record-sets list --zone=ccloud-dataproc-private-reverse --project=ccloud-lab-47372
    NAME                                       TYPE  TTL    DATA
    10.in-addr.arpa.          NS    21600  ns-gcp-private.googledomains.com.
    10.in-addr.arpa.          SOA   21600  ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
    6.0.128.10.in-addr.arpa.  PTR   300    cluster-fa79-m.ccloud.dataproc.lab.net.
    2.0.128.10.in-addr.arpa.  PTR   300    cluster-fa79-w-0.ccloud.dataproc.lab.net.
    3.0.128.10.in-addr.arpa.  PTR   300    cluster-fa79-w-1.ccloud.dataproc.lab.net.
    

Step 2: (Optional) Create permanent custom hostnames

Note

GCP creates a default hostname for each Dataproc instance in the cluster. You can use the default GCP hostnames instead of creating custom hostnames. However, you may want to create custom hostnames that correspond to your network plan or specific cloud application.

Complete the following steps to set custom hostnames for each Dataproc cluster node. You store the hostname on the nodes using the gcloud CLI and the GCP metadata service (see Storing and retrieving instance metadata).

  1. Add a hostname to the Dataproc master node.

    gcloud compute instances add-metadata <master-instance-name> \
    --metadata <master-node-hostname> --zone <region-zone>
    

    For example:

    gcloud compute instances add-metadata cluster-fa79-m \
    --metadata hostname=master.cluster1.ccloud.net --zone us-west1-c
    
  2. Verify that the master node hostname is configured.

    gcloud compute instances describe <master-instance-name> --format='value[](metadata.items.hostname)' \
    --project=<my-gcp-project> --zone <region-zone>
    

    For example:

    gcloud compute instances describe cluster-fa79-m --format='value[](metadata.items.hostname)' \
    --project=cloud-lab-47372 --zone us-west1-c
    master.cluster1.ccloud.net
    
  3. Add a hostname for each Dataproc worker node. Complete this step for all worker nodes.

    gcloud compute instances add-metadata <worker-instance-name> --metadata <worker-node-hostname> --zone <region-zone>
    

    For example:

    gcloud compute instances add-metadata cluster-fa79-w-0 \
    --metadata hostname=worker0.cluster1.ccloud.net --zone us-west1-c
    
  4. Verify that the worker hostname is configured.

    gcloud compute instances describe <worker-instance-name> --format='value[](metadata.items.hostname)' \
    --project=<my-gcp-project> --zone <region-zone>
    

    For example:

    gcloud compute instances describe cluster-fa79-w-0 --format='value[](metadata.items.hostname)' \
    --project=ccloud-lab-47372 --zone us-west1-c
    worker0.cluster1.ccloud.net
    
  5. At this point if the nodes restarted, the hostnames would be lost. Make the master hostname persist on restart.

    gcloud compute instances add-metadata <master-instance-name> \
    --metadata startup-script="sudo -s hostnamectl set-hostname <master-node-hostname>" \
    --zone <region-zone>
    

    For example:

    gcloud compute instances add-metadata cluster-fa79-m \
    --metadata startup-script="sudo -s hostnamectl set-hostname master.cluster1.ccloud.net" \
    --zone us-west1-c
    Updated [https://www.googleapis.com/compute/v1/projects/ccloud-lab-47372/zones/us-central1-c/instances/cluster-fa79-m].
    
  6. Verify that the master node startup script is configured.

    gcloud compute instances describe <master-instance-name> --format='value[](metadata.items.startup-script)' \
    --project=<my-gcp-project> --zone <region-zone>
    

    For example:

    gcloud compute instances describe cluster-fa79-m --format='value[](metadata.items.startup-script)' \
    --project=ccloud-lab-47372 --zone us-west1-c
    sudo -s hostnamectl set-hostname master.cluster1.ccloud.net
    
  7. Make the worker hostnames persist on restart. Complete this step for all worker nodes.

    gcloud compute instances add-metadata <worker-instance-name> \
    --metadata startup-script="sudo -s hostnamectl set-hostname <worker-node-hostname>" \
    --zone <region-zone>
    

    For example:

    gcloud compute instances add-metadata cluster-fa79-w-0 \
    --metadata startup-script="sudo -s hostnamectl set-hostname worker0.cluster1.ccloud.net" \
    --zone us-west1-c
    Updated [https://www.googleapis.com/compute/v1/projects/ccloud-lab-47372/zones/us-central1-c/instances/cluster-fa79-w-0].
    
  8. Verify that the worker node startup script is configured. Complete this step for all worker nodes.

    gcloud compute instances describe <worker-instance-name> --format='value[](metadata.items.startup-script)' \
    --project=<my-gcp-project> --zone <region-zone>
    

    For example:

    gcloud compute instances describe cluster-fa79-w-0 --format='value[](metadata.items.startup-script)' \
    --project=ccloud-lab-47372 --zone us-west1-c
    sudo -s hostnamectl set-hostname worker0.cluster1.ccloud.net
    

Step 3: Verify external and internal IP mapping

Complete the following steps to verify that the external and internal IP mappings are configured properly.

  1. Open new terminal session and use nslookup to get the external address mappings. Use the hostname for each node. Complete this step for all worker nodes.

    nslookup <cluster-node-hostname>
    

    For example:

    nslookup master.cluster1.ccloud.net
    Server:     192.168.86.1
    Address:    192.168.86.1#53
    
    Non-authoritative answer:
    Name:    master.cluster1.ccloud.net
    Address: 208.91.197.26
    
  2. (Optional) Use ping to verify reachability to each node. Use the <cluster-node-hostname>.

    For example:

    ping master.cluster1.ccloud.net
    PING master.cluster1.ccloud.net (208.91.197.26): 56 data bytes
    64 bytes from 208.91.197.26: icmp_seq=0 ttl=240 time=58.091 ms
    64 bytes from 208.91.197.26: icmp_seq=1 ttl=240 time=57.666 ms
    64 bytes from 208.91.197.26: icmp_seq=2 ttl=240 time=59.568 ms
    
  3. Launch an SSH terminal session on one of the worker nodes. The example below shows the gcloud CLI command you can use.

    gcloud beta compute ssh --zone "<region-zone>" "<cluster-node-hostname>" --project "<my-gcp-project>"
    

    For example:

    gcloud beta compute ssh --zone "us-west1-c" "worker0.cluster1.ccloud.net" -project "ccloud-lab-47372"
    
    
    Updating project ssh metadata...
    
    Updated [https://www.googleapis.com/compute/beta/projects/ccloud-lab-47372].
    Updating project ssh metadata...done.
    Waiting for SSH key to propagate.
    Warning: Permanently added [] to the list of known hosts.
    
    ... omitted
    
  4. On the Dataproc worker node, use nslookup to get the internal address mappings for the master node. Use the hostname for each node. Complete this step for all worker nodes.

    nslookup master.cluster1.ccloud.net
    Server:     192.168.86.1
    Address:    192.168.86.1#53
    Non-authoritative answer:
    Name: master.cluster1.ccloud.net
    Address: 10.128.0.6
    

Step 4: Make core-site.xml and hdfs-site.xml modifications

Note

If you are using the default GCP hostnames, you do not have to complete all of the steps in this procedure. However, make sure to verify everything is set up properly at each step and make sure to add the public DNS name on each worker node in the step where this is requested.

Complete the following steps to modify core-site.xml and hfds-site.xml configuration files to use the new hostnames.

  1. Edit the /etc/hadoop/conf/core-site.xml on the master node and all worker nodes. Update the configuration to refer to the master hostname. The following uses the example master hostname created earlier.

    ... omitted
    
    <property>
      <name>fs.default.name</name>
      <value>hdfs://master.cluster1.ccloud.net</value>
      <description>The old FileSystem used by FsShell.</description>
    </property>
    <property>
      <name>fs.defaultFS</name>
      <value>hdfs://master.cluster1.ccloud.net</value>
      <description>
        The name of the default file system. A URI whose scheme and authority
        determine the FileSystem implementation. The uri's scheme determines
        the config property (fs.SCHEME.impl) naming the FileSystem
        implementation class. The uri's authority is used to determine the
        host, port, etc. for a filesystem.
      </description>
    </property>
    
    ... omitted
    
  2. Edit the /etc/hadoop/conf/hdfs-site.xml on the master node and all worker nodes. Update the configuration to refer to the master hostname. The following uses the example master hostname created earlier.

    ... omitted
    
    <property>
      <name>dfs.namenode.rpc-address</name>
      <value>master.cluster1.ccloud.net:8020</value>
      <description>
        RPC address that handles all clients requests. If empty then we'll get
        thevalue from fs.default.name.The value of this property will take the
        form of hdfs://nn-host1:rpc-port.
      </description>
    </property>
    
    ... omitted
    
    <property>
      <name>dfs.namenode.servicerpc-address</name>
      <value>master.cluster1.ccloud.net:8051</value>
      <final>false</final>
      <source>Dataproc Cluster Properties</source>
    </property>
    
    ... omitted
    
    <property>
      <name>dfs.namenode.lifeline.rpc-address</name>
      <value>master.cluster1.ccloud.net:8050</value>
      <final>false</final>
      <source>Dataproc Cluster Properties</source>
    </property>
    
    ... omitted
    
  3. At the end of the hdfs-site.xml file on each worker node, add the public DNS name for the node. Create this <property> section for each worker node. This is a required step even if using the default GCP hostnames.

    ... end of file
    
    <property>
      <name>dfs.datanode.hostname</name>
      <value>cluster-fa79-w-0.ccloud.dataproc.lab.net</value>
      <description>
         obscure property
      </description>
    </property>
    

Step 5: Make additional configuration modifications

Note

If you are using the default GCP hostnames, you do not have to complete all of the steps in this procedure. However, make sure to verify everything is set up properly at each step.

Complete the following steps to make additional configuration changes to the nodes_include configuration file and to etc/hosts on each node. You do not have to add these lines if you are using the default GCP hostnames.

  1. Edit the /etc/hadoop/conf/nodes_include on the master node. Add all worker node hostnames. The example below shows the worker hostnames created earlier.

    ... omitted
    
    worker0.cluster1.ccloud.net
    worker1.cluster1.ccloud.net
    
  2. Launch an SSH terminal session on the master node. Add the master hostname and internal IP address to /etc/hosts. The additional line is highlighted in the example below.

    127.0.0.1   localhost
    ::1         localhost ip6-localhost ip6-loopback
    ff02::1     ip6-allnodes
    ff02::2     ip6-allrouters
    10.128.0.6 master.cluster1.ccloud.net  # <-- add this line
    10.128.0.6 cluster-fa79-m.c.ccloud.dataproc.lab.net.internal cluster-fa79-m  # Added by Google
    169.254.169.254 metadata.google.internal  # Added by Google
    
  3. Launch an SSH terminal session on a worker node. Add the worker hostname and internal IP address to /etc/hosts. The additional line is highlighted in each example below. Complete this step for all worker nodes.

    127.0.0.1 localhost
    ::1               localhost ip6-localhost ip6-loopback
    ff02::1           ip6-allnodes
    ff02::2           ip6-allrouters
    10.128.0.2 worker0.cluster1.ccloud.net  # <-- add this line
    10.128.0.2 cluster-fa79-w-0.c.ccloud.dataproc.lab.net.internal cluster-fa79-w-0  # Added by Google
    169.254.169.254 metadata.google.internal  # Added by Google
    
    127.0.0.1 localhost
    ::1               localhost ip6-localhost ip6-loopback
    ff02::1           ip6-allnodes
    ff02::2           ip6-allrouters
    10.128.0.3 worker1.cluster1.ccloud.net  # <-- add this line
    10.128.0.3 cluster-fa79-w-1.c.ccloud.dataproc.lab.net.internal cluster-fa79-w-1  # Added by Google
    169.254.169.254 metadata.google.internal  # Added by Google
    

Step 6: Configure the Dataproc connector

Complete Dataproc connector configuration steps. Configure the Dataproc connector with the gcp.dataproc.use.datanode.hostname configuration property. The example below shows this configuration property added to the configuration. This property defaults to false if not used. Note that for HA deployments, the gcp.dataproc.namenode property supports a comma-separated list of namenodes.

{
  "connector.class": "DataprocSink",
  "name": "dataproc-test",
  "kafka.api.key": "<my-kafka-api-key>",
  "kafka.api.secret": "<my-kafka-api-secret>",
  "topics": "<topic-name>",
  "input.data.format": "AVRO",
  "gcp.dataproc.credentials.json": "<credentials-json-file-contents>",
  "gcp.dataproc.projectId": "<my-dataproc-project-ID",
  "gcp.dataproc.cluster": "<my-dataproc-cluster-name>",
  "gcp.dataproc.namenode": "<public-IP-address or FQDN>",
  "gcp.dataproc.use.datanode.hostname": "true"
  "logs.dir": "<HDFS-logs-directory>",
  "output.data.format": "AVRO",
  "flush.size": "1000",
  "time.interval": "HOURLY",
  "tasks.max": "1"
}

After the configuration settings have been completed, the Dataproc cluster VPC nodes respond over a public IP endpoint to the Confluent Cloud cluster and managed Dataproc connector as shown below.

Public IP address response to Confluent Cloud

Public IP address response to Confluent Cloud