<?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 pwd_command on Medium]]></title>
        <description><![CDATA[Stories by pwd_command on Medium]]></description>
        <link>https://medium.com/@rt.slowth?source=rss-13c2c3081f6d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Zn-wmA43xVEXBWx3</url>
            <title>Stories by pwd_command on Medium</title>
            <link>https://medium.com/@rt.slowth?source=rss-13c2c3081f6d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:03:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rt.slowth/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[Autoloader File Notification Mode 설정시 주의점]]></title>
            <link>https://medium.com/@rt.slowth/autoloader-file-notification-mode-%EC%84%A4%EC%A0%95%EC%8B%9C-%EC%A3%BC%EC%9D%98%EC%A0%90-6ca1b7c5e7b0?source=rss-13c2c3081f6d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ca1b7c5e7b0</guid>
            <category><![CDATA[autoloader]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[pwd_command]]></dc:creator>
            <pubDate>Wed, 14 Feb 2024 02:16:20 GMT</pubDate>
            <atom:updated>2024-02-15T09:34:52.847Z</atom:updated>
            <content:encoded><![CDATA[<p>이번 포스팅에서는 File Notification Mode 설정 방법을 넘어 제가 직접 경험한 에러와 그 해결 과정을 공유하고자 합니다. <br>그에 앞서 File Notification Mode 에 대해서 간략하게 설명합니다.</p><h4>Autoloader 의 File Notification Mode 란?</h4><p>Autoloader는 기본적으로 Directory Listing Mode를 사용하여 작동합니다. 하지만, 클라우드 환경에 따라 몇 가지 설정을 조정함으로써 File Notification Mode로 전환할 수 있습니다.</p><p>이 모드는 매시간 수백만 개의 파일을 처리할 수 있는 능력을 가지고 있어, 대량의 데이터를 효율적으로 관리할 수 있는 방식입니다.</p><p>AWS 환경에서 File Notification Mode를 사용할 경우, SQS와 SNS를 통해 데이터를 처리하게 됩니다.</p><p>중요한 점은 cloudFiles.useNotifications 옵션이 true로 설정되어 있을 때, 이는 Autoloader가 File Notification Mode를 사용하고 있다는 것을 의미합니다. 이 설정을 활성화하면, 대규모 파일 처리 요구사항에 더 잘 대응할 수 있게 되어 데이터 처리 효율성이 크게 향상될 수 있습니다.</p><p>클라우드 환경별로 File Notification Mode 를 설정하는 방법은 아래 링크를 참고하시길 바랍니다.</p><p><strong>참고 자료 : </strong><a href="https://learn.microsoft.com/ko-kr/azure/databricks/ingestion/auto-loader/file-notification-mode"><strong>클라우드 환경별 설정 가이드</strong></a></p><ul><li>[별첨] File Notification Mode 를 이용한 readStream 예시코드</li></ul><pre>S3_PATH = &#39;&lt;S3 경로&gt;&#39;<br><br>spark.readStream<br>      .format(&quot;cloudFiles&quot;)<br>      .option(&quot;cloudFiles.format&quot;, &quot;parquet&quot;)<br>      .option(&quot;cloudFiles.useNotifications&quot;, &quot;true&quot;)<br>      .option(&quot;cloudFiles.includeExistingFiles&quot;, &quot;true&quot;)<br>      .load(f&quot;{S3_PATH}/{테이블명}&quot;)</pre><ul><li>예제 코드는 데이터브릭스의 Autoloader를 활용하여 스트리밍 방식으로 특정 경로에 저장된 parquet 파일을 읽어오는 과정 중 일부입니다.</li><li>위 코드로 설정하면 데이터브릭스가 SQS 와 SNS 를 자동으로 설정합니다.</li></ul><h4>마주친 에러 및 해결 과정</h4><p>File Notification Mode 설정 시, 저는 S3에서 ‘Access Denied’ 에러를 겪었습니다. 이를 해결하기 위해 다음 절차를 따랐습니다.</p><ol><li>데이터브릭스의 Autoloader를 사용해 AWS에서 어떤 과정으로 readStream이 진행되는지 CloudTrail 로그로 확인합니다.</li><li>데이터브릭스의 클러스터 접근 모드에 따라 접근 가능한 데이터가 달라질 수 있으므로, 클러스터의 접근 모드를 변경하며 테스트해봅니다.</li></ol><h4>CloudTrail 로그 결과</h4><ul><li><strong>Access Mode 가 Single User 일 때</strong></li></ul><pre>{<br>    &quot;eventVersion&quot;: &quot;1.09&quot;,<br>    &quot;userIdentity&quot;: {<br>        &quot;type&quot;: &quot;AWSAccount&quot;,<br>        &quot;principalId&quot;: &quot;&lt;ID 정보&gt;&quot;,<br>        &quot;accountId&quot;: &quot;&lt;Account 정보&gt;&quot;<br>    },<br>    &quot;eventTime&quot;: &quot;2024-01-25T07:21:58Z&quot;,<br>    &quot;eventSource&quot;: &quot;s3.amazonaws.com&quot;,<br>    &quot;eventName&quot;: &quot;GetBucketNotification&quot;,<br>    ...<br>}</pre><ul><li>userIdentity가 anonymous로 표시되며, Access Denied 에러가 발생했습니다.</li><li><strong>Access Mode 가 Shared 일 때</strong></li></ul><pre>{<br>    &quot;eventVersion&quot;: &quot;1.09&quot;,<br>    &quot;userIdentity&quot;: {<br>        &quot;type&quot;: &quot;AWSAccount&quot;,<br>        &quot;principalId&quot;: &quot;&quot;,<br>        &quot;accountId&quot;: &quot;anonymous&quot;<br>    },<br>    &quot;eventTime&quot;: &quot;2024-01-25T07:21:58Z&quot;,<br>    &quot;eventSource&quot;: &quot;s3.amazonaws.com&quot;,<br>    &quot;eventName&quot;: &quot;GetBucketNotification&quot;,<br>    ....<br>    &quot;errorCode&quot;: &quot;AccessDenied&quot;,<br>    &quot;errorMessage&quot;: &quot;Access Denied&quot;,<br>    ...<br>}</pre><ul><li>정상적인 userIdentity 정보가 표시되며, 에러가 발생하지 않았습니다.</li></ul><p>이로 인해, Access Mode가 Shared일 때에는 userIdentity가 anonymous로 나타나며 접근이 제한된다는 것을 알 수 있었습니다.</p><p>데이터브릭스의 기술지원 팀과의 상담 결과, <a href="https://docs.databricks.com/en/ingestion/auto-loader/unity-catalog.html#:~:text=File%20notification%20mode%20is%20only%20supported%20on%20single%20user%20clusters.">공식 문서</a>에서 언급된 바와 같이 Shared Cluster에서는 Autoloader의 Notification Mode를 지원하지 않는다는 답변을 받았습니다. DLT(Delta Live Tables) 역시 내부적으로 Shared Cluster를 사용하기 때문에, 이 문제는 DLT 환경에서도 동일하게 적용됩니다.</p><h4>결론</h4><p>DLT는 Shared Cluster를 사용하며, File Notification Mode는 Shared Cluster에서 지원되지 않습니다.</p><p>이 경험을 통해, File Notification Mode를 활용할 계획이라면 Cluster의 Access Mode 설정에 주의해야 함을 알게 되었습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ca1b7c5e7b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>