<li><ahref="#Server_failed_to_authenticate_the_request">Server failed to authenticate the request</a></li>
<li><ahref="#Configuration_property__something_.dfs.core.windows.net_not_found">Configuration property _something_.dfs.core.windows.net not found</a></li>
<li><ahref="#No_such_file_or_directory_when_trying_to_list_a_container">No such file or directory when trying to list a container</a></li>
<li><ahref="#a.E2.80.9CHTTP_connection_to_https:.2F.2Flogin.microsoftonline.com.2Fsomething_failed_for_getting_token_from_AzureAD._Http_response:_200_OK.E2.80.9D">“HTTP connection to https://login.microsoftonline.com/something failed for getting token from AzureAD. Http response: 200 OK”</a></li>
<li><ahref="#java.io.IOException:_The_ownership_on_the_staging_directory_.2Ftmp.2Fhadoop-yarn.2Fstaging.2Fuser1.2F.staging_is_not_as_expected._It_is_owned_by_.3Cprincipal_id.3E._The_directory_must_be_owned_by_the_submitter_user1_or_user1">java.io.IOException: The ownership on the staging directory /tmp/hadoop-yarn/staging/user1/.staging is not as expected. It is owned by <principal_id>. The directory must be owned by the submitter user1 or user1</a></li></ul></li>
<p>The <code>hadoop-azure</code> module provides support for the Azure Data Lake Storage Gen2 storage layer through the “abfs” connector</p>
<p>To make it part of Apache Hadoop’s default classpath, make sure that <code>HADOOP_OPTIONAL_TOOLS</code> environment variable has <code>hadoop-azure</code> in the list, <i>on every machine in the cluster</i></p>
<divclass="source">
<divclass="source">
<pre>export HADOOP_OPTIONAL_TOOLS=hadoop-azure
</pre></div></div>
<p>You can set this locally in your <code>.profile</code>/<code>.bashrc</code>, but note it won’t propagate to jobs running in-cluster.</p></section><section>
<h2><aname="Features_of_the_ABFS_connector."></a><aname="features"></a> Features of the ABFS connector.</h2>
<ul>
<li>Supports reading and writing data stored in an Azure Blob Storage account.</li>
<li><i>Fully Consistent</i> view of the storage across all clients.</li>
<li>Can read data written through the <code>wasb:</code> connector.</li>
<li>Presents a hierarchical file system view by implementing the standard Hadoop <ahref="../api/org/apache/hadoop/fs/FileSystem.html"><code>FileSystem</code></a> interface.</li>
<li>Supports configuration of multiple Azure Blob Storage accounts.</li>
<li>Can act as a source or destination of data in Hadoop MapReduce, Apache Hive, Apache Spark.</li>
<li>Tested at scale on both Linux and Windows by Microsoft themselves.</li>
<li>Can be used as a replacement for HDFS on Hadoop clusters deployed in Azure infrastructure.</li>
</ul>
<p>For details on ABFS, consult the following documents:</p>
<ul>
<li><aclass="externalLink"href="https://azure.microsoft.com/en-gb/blog/a-closer-look-at-azure-data-lake-storage-gen2/">A closer look at Azure Data Lake Storage Gen2</a>; MSDN Article from June 28, 2018.</li>
<p>The Azure Storage data model presents 3 core concepts:</p>
<ul>
<li><b>Storage Account</b>: All access is done through a storage account.</li>
<li><b>Container</b>: A container is a grouping of multiple blobs. A storage account may have multiple containers. In Hadoop, an entire file system hierarchy is stored in a single container.</li>
<li><b>Blob</b>: A file of any type and size stored with the existing wasb connector</li>
</ul>
<p>The ABFS connector connects to classic containers, or those created with Hierarchical Namespaces.</p></section></section><section>
<p>A key aspect of ADLS Gen 2 is its support for <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-namespace">hierachical namespaces</a> These are effectively directories and offer high performance rename and delete operations —something which makes a significant improvement in performance in query engines writing data to, including MapReduce, Spark, Hive, as well as DistCp.</p>
<p>This feature is only available if the container was created with “namespace” support.</p>
<p>You enable namespace support when creating a new Storage Account, by checking the “Hierarchical Namespace” option in the Portal UI, or, when creating through the command line, using the option <code>--hierarchical-namespace true</code></p>
<p><i>You cannot enable Hierarchical Namespaces on an existing storage account</i></p>
<p>Containers in a storage account with Hierarchical Namespaces are not (currently) readable through the <code>wasb:</code> connector.</p>
<p>Some of the <code>az storage</code> command line commands fail too, for example:</p>
<divclass="source">
<divclass="source">
<pre>$ az storage container list --account-name abfswales1
Blob API is not yet supported for hierarchical namespace accounts. ErrorCode: BlobApiNotYetSupportedForHierarchicalNamespaceAccounts
</pre></div></div>
<section>
<h3><aname="Creating_an_Azure_Storage_Account"></a><aname="creating"></a> Creating an Azure Storage Account</h3>
<p>The best documentation on getting started with Azure Datalake Gen2 with the abfs connector is <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-use-hdi-cluster">Using Azure Data Lake Storage Gen2 with Azure HDInsight clusters</a></p>
<p>It includes instructions to create it from <aclass="externalLink"href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest">the Azure command line tool</a>, which can be installed on Windows, MacOS (via Homebrew) and Linux (apt or yum).</p>
<p>The <aclass="externalLink"href="https://docs.microsoft.com/en-us/cli/azure/storage?view=azure-cli-latest">az storage</a> subcommand handles all storage commands, <aclass="externalLink"href="https://docs.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-create"><code>az storage account create</code></a> does the creation.</p>
<p>Until the ADLS gen2 API support is finalized, you need to add an extension to the ADLS command.</p>
<divclass="source">
<divclass="source">
<pre>az extension add --name storage-preview
</pre></div></div>
<p>Check that all is well by verifying that the usage command includes <code>--hierarchical-namespace</code>:</p>
<divclass="source">
<divclass="source">
<pre>$ az storage account
usage: az storage account create [-h] [--verbose] [--debug]
<p>You then need to add the access key to your <code>core-site.xml</code>, JCEKs file or use your cluster management tool to set it the option <code>fs.azure.account.key.STORAGE-ACCOUNT</code> to this value.</p>
<h4><aname="Creation_through_the_Azure_Portal"></a>Creation through the Azure Portal</h4>
<p>Creation through the portal is covered in <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-quickstart-create-account">Quickstart: Create an Azure Data Lake Storage Gen2 storage account</a></p>
<p>Key Steps</p>
<olstyle="list-style-type: decimal">
<li>Create a new Storage Account in a location which suits you.</li>
<p>You have now created your storage account. Next, get the key for authentication for using the default “Shared Key” authentication.</p>
<olstyle="list-style-type: decimal">
<li>Go to the Azure Portal.</li>
<li>Select “Storage Accounts”</li>
<li>Select the newly created storage account.</li>
<li>In the list of settings, locate “Access Keys” and select that.</li>
<li>Copy one of the access keys to the clipboard, add to the XML option, set in cluster management tools, Hadoop JCEKS file or KMS store.</li>
</ol></section></section><section>
<h3><aname="Creating_a_new_container"></a><aname="new_container"></a> Creating a new container</h3>
<p>An Azure storage account can have multiple containers, each with the container name as the userinfo field of the URI used to reference it.</p>
<p>For example, the container “container1” in the storage account just created will have the URL <code>abfs://container1@abfswales1.dfs.core.windows.net/</code></p>
<p>You can create a new container through the ABFS connector, by setting the option <code>fs.azure.createRemoteFileSystemDuringInitialization</code> to <code>true</code>. Though the same is not supported when AuthType is SAS.</p>
<p>If the container does not exist, an attempt to list it with <code>hadoop fs -ls</code> will fail</p>
<p>This is useful for creating accounts on the command line, especially before the <code>az storage</code> command supports hierarchical namespaces completely.</p></section><section>
<h3><aname="Listing_and_examining_containers_of_a_Storage_Account."></a>Listing and examining containers of a Storage Account.</h3>
<p>You can use the <aclass="externalLink"href="https://azure.microsoft.com/en-us/features/storage-explorer/">Azure Storage Explorer</a></p></section></section><section>
<p>Any configuration can be specified generally (or as the default when accessing all accounts) or can be tied to a specific account. For example, an OAuth identity can be configured for use regardless of which account is accessed with the property <code>fs.azure.account.oauth2.client.id</code> or you can configure an identity to be used only for a specific storage account with <code>fs.azure.account.oauth2.client.id.<account_name>.dfs.core.windows.net</code>.</p>
<p>This is shown in the Authentication section.</p></section><section>
<p>Authentication for ABFS is ultimately granted by <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios">Azure Active Directory</a>.</p>
<p>The concepts covered there are beyond the scope of this document to cover; developers are expected to have read and understood the concepts therein to take advantage of the different authentication mechanisms.</p>
<p>What is covered here, briefly, is how to configure the ABFS client to authenticate in different deployment situations.</p>
<p>The ABFS client can be deployed in different ways, with its authentication needs driven by them.</p>
<olstyle="list-style-type: decimal">
<li>With the storage account’s authentication secret in the configuration: “Shared Key”.</li>
<li>Using OAuth 2.0 tokens of one form or another.</li>
<li>Deployed in-Azure with the Azure VMs providing OAuth 2.0 tokens to the application, “Managed Instance”.</li>
<li>Using Shared Access Signature (SAS) tokens provided by a custom implementation of the SASTokenProvider interface.</li>
</ol>
<p>What can be changed is what secrets/credentials are used to authenticate the caller.</p>
<p>The authentication mechanism is set in <code>fs.azure.account.auth.type</code> (or the account specific variant). The possible values are SharedKey, OAuth, Custom and SAS. For the various OAuth options use the config <code>fs.azure.account .oauth.provider.type</code>. Following are the implementations supported ClientCredsTokenProvider, UserPasswordTokenProvider, MsiTokenProvider and RefreshTokenBasedTokenProvider. An IllegalArgumentException is thrown if the specified provider type is not one of the supported.</p>
<p>All secrets can be stored in JCEKS files. These are encrypted and password protected —use them or a compatible Hadoop Key Management Store wherever possible</p><section>
<p>The exponential retry policy used for the AAD token fetch retries can be tuned with the following configurations. * <code>fs.azure.oauth.token.fetch.retry.max.retries</code>: Sets the maximum number of retries. Default value is 5. * <code>fs.azure.oauth.token.fetch.retry.min.backoff.interval</code>: Minimum back-off interval. Added to the retry interval computed from delta backoff. By default this is set as 0. Set the interval in milli seconds. * <code>fs.azure.oauth.token.fetch.retry.max.backoff.interval</code>: Maximum back-off interval. Default value is 60000 (sixty seconds). Set the interval in milli seconds. * <code>fs.azure.oauth.token.fetch.retry.delta.backoff</code>: Back-off interval between retries. Multiples of this timespan are used for subsequent retry attempts . The default value is 2.</p></section><section>
<p><i>Note</i>: The source of the account key can be changed through a custom key provider; one exists to execute a shell script to retrieve it.</p>
<p>A custom key provider class can be provided with the config <code>fs.azure.account.keyprovider</code>. If a key provider class is specified the same will be used to get account key. Otherwise the Simple key provider will be used which will use the key specified for the config <code>fs.azure.account.key</code>.</p>
<p>To retrieve using shell script, specify the path to the script for the config <code>fs.azure.shellkeyprovider.script</code>. ShellDecryptionKeyProvider class use the script specified to retrieve the key.</p></section><section>
<p>OAuth 2.0 credentials of (client id, client secret, endpoint) are provided in the configuration/JCEKS file.</p>
<p>The specifics of this process is covered in <ahref="../hadoop-azure-datalake/index.html#Configuring_Credentials_and_FileSystem">hadoop-azure-datalake</a>; the key names are slightly different here.</p>
<p>With an existing Oauth 2.0 token, make a request of the Active Directory endpoint <code>https://login.microsoftonline.com/Common/oauth2/token</code> for this token to be refreshed.</p>
<p><aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview">Azure Managed Identities</a>, formerly “Managed Service Identities”.</p>
<p>OAuth 2.0 tokens are issued by a special endpoint only accessible from the executing VM (<code>http://169.254.169.254/metadata/identity/oauth2/token</code>). The issued credentials can be used to authenticate.</p>
<p>The Azure Portal/CLI is used to create the service identity.</p>
<p>The declared class must implement <code>org.apache.hadoop.fs.azurebfs.extensions.CustomTokenProviderAdaptee</code> and optionally <code>org.apache.hadoop.fs.azurebfs.extensions.BoundDTExtension</code>.</p>
<p>The declared class also holds responsibility to implement retry logic while fetching access tokens.</p></section><section>
<p>A delegation token provider supplies the ABFS connector with delegation tokens, helps renew and cancel the tokens by implementing the CustomDelegationTokenManager interface.</p>
<p>In case delegation token is enabled, and the config <code>fs.azure.delegation.token .provider.type</code> is not provided then an IlleagalArgumentException is thrown.</p></section><section>
<p>The connector uses the JVM proxy settings to control its proxy setup.</p>
<p>See The <aclass="externalLink"href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html">Oracle Java documentation</a> for the options to set.</p>
<p>As the connector uses HTTPS by default, the <code>https.proxyHost</code> and <code>https.proxyPort</code> options are those which must be configured.</p>
<p>In MapReduce jobs, including distcp, the proxy options must be set in both the <code>mapreduce.map.java.opts</code> and <code>mapreduce.reduce.java.opts</code>.</p>
<divclass="source">
<divclass="source">
<pre># this variable is only here to avoid typing the same values twice.
<p>Without these settings, even though access to ADLS may work from the command line, <code>distcp</code> access can fail with network errors.</p></section><section>
<p>As with other object stores, login secrets are valuable pieces of information. Organizations should have a process for safely sharing them.</p></section><section>
<h3><aname="Limitations_of_the_ABFS_connector"></a><aname="limitations"></a> Limitations of the ABFS connector</h3>
<ul>
<li>File last access time is not tracked.</li>
<li>Extended attributes are not supported.</li>
<li>File Checksums are not supported.</li>
<li>The <code>Syncable</code> interfaces <code>hsync()</code> and <code>hflush()</code> operations are supported if <code>fs.azure.enable.flush</code> is set to true (default=true). With the Wasb connector, this limited the number of times either call could be made to 50,000 <aclass="externalLink"href="https://issues.apache.org/jira/browse/HADOOP-15478">HADOOP-15478</a>. If abfs has the a similar limit, then excessive use of sync/flush may cause problems.</li>
</ul></section><section>
<h3><aname="Consistency_and_Concurrency"></a><aname="consistency"></a> Consistency and Concurrency</h3>
<p>As with all Azure storage services, the Azure Datalake Gen 2 store offers a fully consistent view of the store, with complete Create, Read, Update, and Delete consistency for data and metadata.</p></section><section>
<h3><aname="Performance_and_Scalability"></a><aname="performance"></a> Performance and Scalability</h3>
<p>For containers with hierarchical namespaces, the scalability numbers are, in Big-O-notation, as follows:</p>
<tableborder="0"class="bodyTable">
<thead>
<trclass="a">
<th> Operation </th>
<th> Scalability </th></tr>
</thead><tbody>
<trclass="b">
<td> File Rename </td>
<td><code>O(1)</code></td></tr>
<trclass="a">
<td> File Delete </td>
<td><code>O(1)</code></td></tr>
<trclass="b">
<td> Directory Rename:</td>
<td><code>O(1)</code></td></tr>
<trclass="a">
<td> Directory Delete </td>
<td><code>O(1)</code></td></tr>
</tbody>
</table>
<p>For non-namespace stores, the scalability becomes:</p>
<tableborder="0"class="bodyTable">
<thead>
<trclass="a">
<th> Operation </th>
<th> Scalability </th></tr>
</thead><tbody>
<trclass="b">
<td> File Rename </td>
<td><code>O(1)</code></td></tr>
<trclass="a">
<td> File Delete </td>
<td><code>O(1)</code></td></tr>
<trclass="b">
<td> Directory Rename:</td>
<td><code>O(files)</code></td></tr>
<trclass="a">
<td> Directory Delete </td>
<td><code>O(files)</code></td></tr>
</tbody>
</table>
<p>That is: the more files there are, the slower directory operations get.</p>
<p>The ABFS connector supports a number of limited-private/unstable extension points for third-parties to integrate their authentication and authorization services into the ABFS client.</p>
<ul>
<li><code>CustomDelegationTokenManager</code> : adds ability to issue Hadoop Delegation Tokens.</li>
<li><code>SASTokenProvider</code>: allows for custom provision of Azure Storage Shared Access Signature (SAS) tokens.</li>
<li><code>CustomTokenProviderAdaptee</code>: allows for custom provision of Azure OAuth tokens.</li>
<li><code>KeyProvider</code>.</li>
</ul>
<p>Consult the source in <code>org.apache.hadoop.fs.azurebfs.extensions</code> and all associated tests to see how to make use of these extension points.</p>
<p><i>Warning</i> These extension points are unstable.</p></section></section><section>
<h2><aname="Other_configuration_options"></a><ahref="options"></a> Other configuration options</h2>
<p>Consult the javadocs for <code>org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys</code>, <code>org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations</code> and <code>org.apache.hadoop.fs.azurebfs.AbfsConfiguration</code> for the full list of configuration options and their default values.</p><section>
<p>Config <code>fs.azure.client.correlationid</code> provides an option to correlate client requests using this client-provided identifier. This Id will be visible in Azure Storage Analytics logs in the <code>request-id-header</code> field. Reference: <aclass="externalLink"href="https://docs.microsoft.com/en-us/rest/api/storageservices/storage-analytics-log-format">Storage Analytics log format</a></p>
<p>This config accepts a string which can be maximum of 72 characters and should contain alphanumeric characters and/or hyphens only. Defaults to empty string if input is invalid.</p></section><section>
<p>Config <code>fs.azure.tracingcontext.format</code> provides an option to select the format of IDs included in the <code>request-id-header</code>. This config accepts a String value corresponding to the following enum options. <code>SINGLE_ID_FORMAT</code> : clientRequestId <code>ALL_ID_FORMAT</code> : all IDs (default) <code>TWO_ID_FORMAT</code> : clientCorrelationId:clientRequestId</p></section></section><section>
<h4><aname="a1._Azure_Blob_File_System_Flush_Options"></a><aname="abfsflushconfigoptions"></a> 1. Azure Blob File System Flush Options</h4>
<p>Config <code>fs.azure.enable.flush</code> provides an option to render ABFS flush APIs - HFlush() and HSync() to be no-op. By default, this config will be set to true.</p>
<p>Both the APIs will ensure that data is persisted.</p></section><section>
<p>Config <code>fs.azure.disable.outputstream.flush</code> provides an option to render OutputStream Flush() API to be a no-op in AbfsOutputStream. By default, this config will be set to true.</p>
<p>Hflush() being the only documented API that can provide persistent data transfer, Flush() also attempting to persist buffered data will lead to performance issues.</p></section></section><section>
<p><code>fs.azure.account.operation.idle.timeout</code>: This value specifies the time after which the timer for the analyzer (read or write) should be paused until no new request is made again. The default value for the same is 60 seconds.</p></section><section>
<p>Config <code>fs.azure.account.hns.enabled</code> provides an option to specify whether the storage account is HNS enabled or not. In case the config is not provided, a server call is made to check the same.</p></section><section>
<p>Requests failing due to server timeouts and network failures will be retried. PUT/POST operations are idempotent and need no specific handling except for Rename and Delete operations.</p>
<p>Rename idempotency checks are made by ensuring the LastModifiedTime on destination is recent if source path is found to be non-existent on retry.</p>
<p>Delete is considered to be idempotent by default if the target does not exist on retry.</p></section><section>
<h3><aname="Primary_User_Group_Options"></a><aname="featureconfigoptions"></a> Primary User Group Options</h3>
<p>The group name which is part of FileStatus and AclStatus will be set the same as the username if the following config is set to true <code>fs.azure.skipUserGroupMetadataDuringInitialization</code>.</p></section><section>
<p>The following configs are related to read and write operations.</p>
<p><code>fs.azure.io.retry.max.retries</code>: Sets the number of retries for IO operations. Currently this is used only for the server call retry logic. Used within <code>AbfsClient</code> class as part of the ExponentialRetryPolicy. The value should be greater than or equal to 0.</p>
<p><code>fs.azure.io.retry.min.backoff.interval</code>: Sets the minimum backoff interval for retries of IO operations. Currently this is used only for the server call retry logic. Used within <code>AbfsClient</code> class as part of the ExponentialRetryPolicy. This value indicates the smallest interval (in milliseconds) to wait before retrying an IO operation. The default value is 3000 (3 seconds).</p>
<p><code>fs.azure.io.retry.max.backoff.interval</code>: Sets the maximum backoff interval for retries of IO operations. Currently this is used only for the server call retry logic. Used within <code>AbfsClient</code> class as part of the ExponentialRetryPolicy. This value indicates the largest interval (in milliseconds) to wait before retrying an IO operation. The default value is 30000 (30 seconds).</p>
<p><code>fs.azure.io.retry.backoff.interval</code>: Sets the default backoff interval for retries of IO operations. Currently this is used only for the server call retry logic. Used within <code>AbfsClient</code> class as part of the ExponentialRetryPolicy. This value is used to compute a random delta between 80% and 120% of the specified value. This random delta is then multiplied by an exponent of the current IO retry number (i.e., the default is multiplied by <code>2^(retryNum - 1)</code>) and then contstrained within the range of [<code>fs.azure.io.retry.min.backoff.interval</code>, <code>fs.azure.io.retry.max.backoff.interval</code>] to determine the amount of time to wait before the next IO retry attempt. The default value is 3000 (3 seconds).</p>
<p><code>fs.azure.write.request.size</code>: To set the write buffer size. Specify the value in bytes. The value should be between 16384 to 104857600 both inclusive (16 KB to 100 MB). The default value will be 8388608 (8 MB).</p>
<p><code>fs.azure.read.request.size</code>: To set the read buffer size.Specify the value in bytes. The value should be between 16384 to 104857600 both inclusive (16 KB to 100 MB). The default value will be 4194304 (4 MB).</p>
<p><code>fs.azure.read.alwaysReadBufferSize</code>: Read request size configured by <code>fs.azure.read.request.size</code> will be honoured only when the reads done are in sequential pattern. When the read pattern is detected to be random, read size will be same as the buffer length provided by the calling process. This config when set to true will force random reads to also read in same request sizes as sequential reads. This is a means to have same read patterns as of ADLS Gen1, as it does not differentiate read patterns and always reads by the configured read request size. The default value for this config will be false, where reads for the provided buffer length is done when random read pattern is detected.</p>
<p><code>fs.azure.readaheadqueue.depth</code>: Sets the readahead queue depth in AbfsInputStream. In case the set value is negative the read ahead queue depth will be set as Runtime.getRuntime().availableProcessors(). By default the value will be 2. To disable readaheads, set this value to 0. If your workload is doing only random reads (non-sequential) or you are seeing throttling, you may try setting this value to 0.</p>
<p><code>fs.azure.read.readahead.blocksize</code>: To set the read buffer size for the read aheads. Specify the value in bytes. The value should be between 16384 to 104857600 both inclusive (16 KB to 100 MB). The default value will be 4194304 (4 MB).</p>
<p><code>fs.azure.buffered.pread.disable</code>: By default the positional read API will do a seek and read on input stream. This read will fill the buffer cache in AbfsInputStream and update the cursor positions. If this optimization is true it will skip usage of buffer and do a lock free REST call for reading from blob. This optimization is very much helpful for HBase kind of short random read over a shared AbfsInputStream instance. Note: This is not a config which can be set at cluster level. It can be used as an option on FutureDataInputStreamBuilder. See FileSystem#openFile(Path path)</p>
<p>To run under limited memory situations configure the following. Especially when there are too many writes from the same process.</p>
<p><code>fs.azure.write.max.concurrent.requests</code>: To set the maximum concurrent write requests from an AbfsOutputStream instance to server at any point of time. Effectively this will be the threadpool size within the AbfsOutputStream instance. Set the value in between 1 to 8 both inclusive.</p>
<p><code>fs.azure.write.max.requests.to.queue</code>: To set the maximum write requests that can be queued. Memory consumption of AbfsOutputStream instance can be tuned with this config considering each queued request holds a buffer. Set the value 3 or 4 times the value set for s.azure.write.max.concurrent.requests.</p>
<p><code>fs.azure.analysis.period</code>: The time after which sleep duration is recomputed after analyzing metrics. The default value for the same is 10 seconds.</p></section><section>
<p><code>fs.azure.always.use.https</code>: Enforces to use HTTPS instead of HTTP when the flag is made true. Irrespective of the flag, <code>AbfsClient</code> will use HTTPS if the secure scheme (ABFSS) is used or OAuth is used for authentication. By default this will be set to true.</p>
<p><code>fs.azure.ssl.channel.mode</code>: Initializing DelegatingSSLSocketFactory with the specified SSL channel mode. Value should be of the enum DelegatingSSLSocketFactory.SSLChannelMode. The default value will be DelegatingSSLSocketFactory.SSLChannelMode.Default.</p></section><section>
<h3><aname="Server_Options"></a><aname="serverconfigoptions"></a> Server Options</h3>
<p>When the config <code>fs.azure.io.read.tolerate.concurrent.append</code> is made true, the If-Match header sent to the server for read calls will be set as * otherwise the same will be set with ETag. This is basically a mechanism in place to handle the reads with optimistic concurrency. Please refer the following links for further information. 1. <aclass="externalLink"href="https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/read">https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/read</a> 2. <aclass="externalLink"href="https://azure.microsoft.com/de-de/blog/managing-concurrency-in-microsoft-azure-storage-2/">https://azure.microsoft.com/de-de/blog/managing-concurrency-in-microsoft-azure-storage-2/</a></p>
<p>listStatus API fetches the FileStatus information from server in a page by page manner. The config <code>fs.azure.list.max.results</code> used to set the maxResults URI param which sets the pagesize(maximum results per call). The value should be > 0. By default this will be 5000. Server has a maximum value for this parameter as 5000. So even if the config is above 5000 the response will only contain 5000 entries. Please refer the following link for further information. <aclass="externalLink"href="https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/list">https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/list</a></p></section><section>
<p>ABFS driver has the capability to throttle read and write operations to achieve maximum throughput by minimizing errors. The errors occur when the account ingress or egress limits are exceeded and, the server-side throttles requests. Server-side throttling causes the retry policy to be used, but the retry policy sleeps for long periods of time causing the total ingress or egress throughput to be as much as 35% lower than optimal. The retry policy is also after the fact, in that it applies after a request fails. On the other hand, the client-side throttling implemented here happens before requests are made and sleeps just enough to minimize errors, allowing optimal ingress and/or egress throughput. By default the throttling mechanism is enabled in the driver. The same can be disabled by setting the config <code>fs.azure.enable.autothrottling</code> to false.</p></section><section>
<p><code>fs.azure.atomic.rename.key</code>: Directories for atomic rename support can be specified comma separated in this config. The driver prints the following warning log if the source of the rename belongs to one of the configured directories. “The atomic rename feature is not supported by the ABFS scheme ; however, rename, create and delete operations are atomic if Namespace is enabled for your Azure Storage account.” The directories can be specified as comma separated values. By default the value is “/hbase”</p></section><section>
<p><code>fs.azure.infinite-lease.directories</code>: Directories for infinite lease support can be specified comma separated in this config. By default, multiple clients will be able to write to the same file simultaneously. When writing to files contained within the directories specified in this config, the client will obtain a lease on the file that will prevent any other clients from writing to the file. When the output stream is closed, the lease will be released. To revoke a client’s write access for a file, the AzureBlobFilesystem breakLease method may be called. If the client dies before the file can be closed and the lease released, breakLease will need to be called before another client will be able to write to the file.</p>
<p><code>fs.azure.lease.threads</code>: This is the size of the thread pool that will be used for lease operations for infinite lease directories. By default the value is 0, so it must be set to at least 1 to support infinite lease directories.</p></section><section>
<p>If you set <code>fs.azure.abfs.latency.track</code> to <code>true</code>, the module starts tracking the performance metrics of ABFS HTTP traffic. To obtain these numbers on your machine or cluster, you will also need to enable debug logging for the <code>AbfsPerfTracker</code> class in your <code>log4j</code> config. A typical perf log line appears like:</p>
<p><code>h</code>: host name <code>t</code>: time when this request was logged <code>a</code>: Azure storage account name <code>c</code>: container name <code>cr</code>: name of the caller method <code>ce</code>: name of the callee method <code>r</code>: result (Succeeded/Failed) <code>l</code>: latency (time spent in callee) <code>ls</code>: latency sum (aggregate time spent in caller; logged when there are multiple callees; logged with the last callee) <code>lc</code>: latency count (number of callees; logged when there are multiple callees; logged with the last callee) <code>s</code>: HTTP Status code <code>e</code>: Error code <code>ci</code>: client request ID <code>ri</code>: server request ID <code>ct</code>: connection time in milliseconds <code>st</code>: sending time in milliseconds <code>rt</code>: receiving time in milliseconds <code>bs</code>: bytes sent <code>br</code>: bytes received <code>m</code>: HTTP method (GET, PUT etc) <code>u</code>: Encoded HTTP URL</p>
<p>Note that these performance numbers are also sent back to the ADLS Gen 2 API endpoints in the <code>x-ms-abfs-client-latency</code> HTTP headers in subsequent requests. Azure uses these settings to track their end-to-end latency.</p></section></section></section><section>
<p>The problems associated with the connector usually come down to, in order</p>
<olstyle="list-style-type: decimal">
<li>Classpath.</li>
<li>Network setup (proxy etc.).</li>
<li>Authentication and Authorization.</li>
<li>Anything else.</li>
</ol>
<p>If you log <code>org.apache.hadoop.fs.azurebfs.services</code> at <code>DEBUG</code> then you will see more details about any request which is failing.</p>
<p>One useful tool for debugging connectivity is the <aclass="externalLink"href="https://github.com/steveloughran/cloudstore/releases">cloudstore storediag utility</a>.</p>
<p>This validates the classpath, the settings, then tries to work with the filesystem.</p>
<divclass="source">
<divclass="source">
<pre>bin/hadoop jar cloudstore-0.1-SNAPSHOT.jar storediag abfs://container@account.dfs.core.windows.net/
</pre></div></div>
<olstyle="list-style-type: decimal">
<li>If the <code>storediag</code> command cannot work with an abfs store, nothing else is likely to.</li>
<li>If the <code>storediag</code> store does successfully work, that does not guarantee that the classpath or configuration on the rest of the cluster is also going to work, especially in distributed applications. But it is at least a start.</li>
Class org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2625)
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:3290)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3322)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:136)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3373)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3341)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:491)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:361)
Caused by: java.lang.ClassNotFoundException:
Class org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2529)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2623)
... 16 more
</pre></div></div>
<p>Tip: if this is happening on the command line, you can turn on debug logging of the hadoop scripts:</p>
<divclass="source">
<divclass="source">
<pre>export HADOOP_SHELL_SCRIPT_DEBUG=true
</pre></div></div>
<p>If this is happening on an application running within the cluster, it means the cluster (somehow) needs to be configured so that the <code>hadoop-azure</code> module and dependencies are on the classpath of deployed applications.</p></section><section>
at org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.execute(AbfsRestOperation.java:135)
at org.apache.hadoop.fs.azurebfs.services.AbfsClient.getFilesystemProperties(AbfsClient.java:209)
at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystemStore.getFilesystemProperties(AzureBlobFileSystemStore.java:259)
at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.fileSystemExists(AzureBlobFileSystem.java:859)
at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.initialize(AzureBlobFileSystem.java:110)
</pre></div></div>
<p>Causes include:</p>
<ul>
<li>Your credentials are incorrect.</li>
<li>Your shared secret has expired. in Azure, this happens automatically</li>
<li>Your shared secret has been revoked.</li>
<li>host/VM clock drift means that your client’s clock is out of sync with the Azure servers —the call is being rejected as it is either out of date (considered a replay) or from the future. Fix: Check your clocks, etc.</li>
</ul></section><section>
<h3><aname="Configuration_property__something_.dfs.core.windows.net_not_found"></a><code>Configuration property _something_.dfs.core.windows.net not found</code></h3>
<p>There’s no <code>fs.azure.account.key.</code> entry in your cluster configuration declaring the access key for the specific account, or you are using the wrong URL</p>
ls: `abfs://container@abfswales1.dfs.core.windows.net/': No such file or directory
</pre></div></div>
<ul>
<li>Make sure that the URL is correct</li>
<li>Create the container if needed</li>
</ul></section><section>
<h3><aname="a.E2.80.9CHTTP_connection_to_https:.2F.2Flogin.microsoftonline.com.2Fsomething_failed_for_getting_token_from_AzureAD._Http_response:_200_OK.E2.80.9D"></a>“HTTP connection to <aclass="externalLink"href="https://login.microsoftonline.com/">https://login.microsoftonline.com/</a><i>something</i> failed for getting token from AzureAD. Http response: 200 OK”</h3>
<ul>
<li>it has a content-type <code>text/html</code>, <code>text/plain</code>, <code>application/xml</code></li>
</ul>
<p>The OAuth authentication page didn’t fail with an HTTP error code, but it didn’t return JSON either</p>
<p>Likely causes are configuration and networking:</p>
<olstyle="list-style-type: decimal">
<li>Authentication is failing, the caller is being served up the Azure Active Directory signon page for humans, even though it is a machine calling.</li>
<li>The URL is wrong —it is pointing at a web page unrelated to OAuth2.0</li>
<li>There’s a proxy server in the way trying to return helpful instructions.</li>
</ol></section><section>
<h3><aname="java.io.IOException:_The_ownership_on_the_staging_directory_.2Ftmp.2Fhadoop-yarn.2Fstaging.2Fuser1.2F.staging_is_not_as_expected._It_is_owned_by_.3Cprincipal_id.3E._The_directory_must_be_owned_by_the_submitter_user1_or_user1"></a><code>java.io.IOException: The ownership on the staging directory /tmp/hadoop-yarn/staging/user1/.staging is not as expected. It is owned by <principal_id>. The directory must be owned by the submitter user1 or user1</code></h3>
<p>When using <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview">Azure Managed Identities</a>, the files/directories in ADLS Gen2 by default will be owned by the service principal object id i.e. principal ID & submitting jobs as the local OS user ‘user1’ results in the above exception.</p>
<p>The fix is to mimic the ownership to the local OS user, by adding the below properties to<code>core-site.xml</code>.</p>
A comma separated list of names to be replaced with the service principal ID specified by
“fs.azure.identity.transformer.service.principal.id”. This substitution occurs
when setOwner, setAcl, modifyAclEntries, or removeAclEntries are invoked with identities
contained in the substitution list. Notice that when in non-secure cluster, asterisk symbol *
can be used to match all user/group.
</description>
</property>
</pre></div></div>
<p>Once the above properties are configured, <code>hdfs dfs -ls abfs://container1@abfswales1.dfs.core.windows.net/</code> shows the ADLS Gen2 files/directories are now owned by ‘user1’.</p></section></section><section>