<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anand Tirthgirikar on Medium]]></title>
        <description><![CDATA[Stories by Anand Tirthgirikar on Medium]]></description>
        <link>https://medium.com/@anandt8?source=rss-37726fa6d3b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*7-Kdt5V6mCKcC3GNlkulLQ.jpeg</url>
            <title>Stories by Anand Tirthgirikar on Medium</title>
            <link>https://medium.com/@anandt8?source=rss-37726fa6d3b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:32:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anandt8/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Apache Druid Migration: AWS to GCP — Part 2]]></title>
            <link>https://medium.com/zeotap-customer-intelligence-unleashed/apache-druid-migration-aws-to-gcp-part-2-8238157a8d97?source=rss-37726fa6d3b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8238157a8d97</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[druid]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Anand Tirthgirikar]]></dc:creator>
            <pubDate>Fri, 08 May 2020 10:01:21 GMT</pubDate>
            <atom:updated>2020-05-08T10:01:21.894Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Apache Druid Migration: AWS to GCP — Part 2</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHtNPM3eADWR1eLHaEZIig.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jakehills?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jake Hills</a> on <a href="https://unsplash.com/s/photos/move?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In this article, we will discuss how to migrate Druid from AWS to GCP cloud platform. For details on how to set up Druid in GCP, please refer to <a href="https://medium.com/zeotap-customer-intelligence-unleashed/apache-druid-production-setup-in-google-cloud-platform-with-dataproc-cluster-part-1-958297374403">Part 1</a> of this series.</p><p>Once Druid GCP setup is complete, we want to load it with the data which is already ingested in Druid AWS. Reason being,</p><ul><li>re-ingestion of the same data is time consuming</li><li>will cost us computing resources</li><li>data consistency assurance</li></ul><p>Migration involves migrating <strong>deep storage</strong> and <strong>metadata</strong> store data.</p><p>Druid documentation talks about migration from local storage to AWS S3 storage or to HDFS storage or maybe from S3 to new S3 storage. When it comes to migration from AWS to GCP, we need to incorporate some additional steps.</p><p>At a high level we will follow below steps,</p><ol><li>Copying segments from AWS S3 deep storage to GCS deep storage</li><li>Rewriting the loadSpec in GCS deep storage segments</li><li>Exporting druid_segment table from AWS metadata</li><li>Importing in GCP metadata store</li><li>Rewriting the loadSpec in GCP druid_segment metadata table</li></ol><blockquote><strong>Note:</strong></blockquote><blockquote>In Druid 0.14.x and earlier, Druid wrote segment metadata at two places: the metadata store’s druid_segments table, and descriptor.json files in deep storage. This practice was stopped in Druid 0.15.0, as mentioned <a href="https://druid.apache.org/docs/latest/operations/insert-segment-to-db.html">here</a>. Hence, if you are using Druid 0.15.x or higher version, skip 2nd step from above mentioned.</blockquote><h3>0. Shut down services</h3><p>To ensure a clean migration, shut down services of AWS Druid cluster to ensure that metadata and deep storage state will not change as you do the migration.</p><p>For GCP Druid cluster, bring down coordinator service alone, as only the coordinator interacts with metadata and triggers data load from deep storage.</p><h3><strong>1. Copy segments from AWS S3 to GCS Deep storage</strong></h3><p>Copy the deep storage folders from S3 to GCS and update the path in <em>common.runtime.properties </em>(Located at: conf/druid/_common)</p><pre>druid.storage.type=google<br>druid.google.bucket=gcs-bucket-name<br>druid.google.prefix=druid/segments</pre><h3>2. Rewriting loadSpec in GCS deep storage</h3><p>loadSpec present in descriptor.json file has segment information like type of storage, bucket name, file path, etc. Each segment has its own descriptor.json file which has to be updated as shown below,</p><p>Example loadSpec from AWS descriptor.json,</p><pre>“loadSpec”:{“type”:”s3_zip”,”bucket”:”s3.bucket.name”,”key”:”druid/segments/&lt;datasource&gt;/&lt;segment&gt;/index.zip”,”S3Schema”:”s3n”}</pre><p>To be updated as,</p><pre>“loadSpec”:<br>{“type”:”google”,”bucket”:”gcs-bucket-name”, ”path”:”druid/segments/&lt;datasource&gt;/&lt;segment&gt;/index.zip”}</pre><p>Python script which does this for all segments in deep storage,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0f7309ab64e0d842754d93c619c2e75/href">https://medium.com/media/e0f7309ab64e0d842754d93c619c2e75/href</a></iframe><h3>3. Export AWS Druid metadata</h3><p>We need to export table druid_segments from the AWS Druid metadata store.</p><p>For example in PostgreSQL, we can take dump of table records using,</p><pre>\COPY (select * from druid_segments) TO ‘segments_dump.sql’;</pre><h3>4. Import in GCP Druid metadata store</h3><p>Import table druid_segments and ensure with few checks like record count.</p><p>For example in PostgreSQL,</p><pre>\COPY druid_segments FROM ‘segments_dump.sql’;</pre><h3>5. Rewriting loadSpec in GCP Druid metadata store</h3><p>In the metadata store, loadSpec is in the payload column. It has to be updated in the same way as we did it for descriptor.json files.</p><p>Python script to update all records of druid_segments table in PostgreSQL,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5ba8f3805fa288bff721766836b0da1/href">https://medium.com/media/b5ba8f3805fa288bff721766836b0da1/href</a></iframe><p>Now, start GCP Druid coordinator service. In a few minutes on the coordinator console, you would see segments loading in historical nodes.</p><h3>Common Issues</h3><ul><li><strong>Segment metadata not updated<br></strong>If any segment’s metadata is not updated, historical nodes will throw errors indicating the path does not exist as it would be referring to S3 storage. In the same error, you will see segment id.</li></ul><pre>ERROR [ZkCoordinator] org.apache.druid.server.coordination.SegmentLoadDropHandler — Failed to load segment for dataSource: &lt;datasource&gt;<br>…<br>Caused by: java.lang.IllegalArgumentException: [&lt;s3path&gt;/index.zip] does not exist</pre><p>Update loadSpec for corresponding segment in metadata and historical will then load missed out segment.</p><ul><li><strong>Segment miss<br></strong>If any segment is missed from deep storage, historical nodes will throw error indicating segment not found with missing segment id. Copy the given segment from deep storage and if error persists, restart coordinator service.</li></ul><blockquote><strong>Note:</strong></blockquote><blockquote>If segment is missed in metadata then Druid will not throw any error, even if deep storage data exists, it will not be loaded in historical nodes.</blockquote><h3>Reference Links</h3><p>Apache Druid docs<br><a href="https://druid.apache.org/docs/latest/operations/deep-storage-migration.html">https://druid.apache.org/docs/latest/operations/deep-storage-migration.html</a><br><a href="https://druid.apache.org/docs/latest/operations/metadata-migration.html">https://druid.apache.org/docs/latest/operations/metadata-migration.html</a><br><a href="https://druid.apache.org/docs/latest/operations/export-metadata.html">https://druid.apache.org/docs/latest/operations/export-metadata.html</a><br><a href="https://druid.apache.org/docs/latest/operations/insert-segment-to-db.html">https://druid.apache.org/docs/latest/operations/insert-segment-to-db.html</a></p><p>Python on Google Cloud<br><a href="https://cloud.google.com/python/docs">https://cloud.google.com/python/docs</a><br><a href="https://cloud.google.com/storage/docs/how-to">https://cloud.google.com/storage/docs/how-to</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8238157a8d97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zeotap-customer-intelligence-unleashed/apache-druid-migration-aws-to-gcp-part-2-8238157a8d97">Apache Druid Migration: AWS to GCP — Part 2</a> was originally published in <a href="https://medium.com/zeotap-customer-intelligence-unleashed">Zeotap — Customer Intelligence Unleashed</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>