This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 6054c5fba8 feat(services/hdfs-native): expose config_dir, user, and
Kerberos client options (#9358)
6054c5fba8 is described below
commit 6054c5fba83003d53f863baeca04cbfb1511153e
Author: Chitral Verma <[email protected]>
AuthorDate: Sun Nov 29 15:47:43 2026 +0530
feat(services/hdfs-native): expose config_dir, user, and Kerberos client
options (#9358)
* feat(services/hdfs-native): expose config_dir, user, and Kerberos client
options
Expose the hdfs-native ClientBuilder settings that can be expressed as
service configuration: config_dir, user, kerberos_principal,
kerberos_keytab and kerberos_cache.
Building the service rejects a keytab or credential cache without a
principal, a config_dir that is not a directory, and Kerberos settings
when the effective Hadoop configuration does not enable Kerberos.
Signed-off-by: Chitral Verma <[email protected]>
* chore(bindings): regenerate HDFS Native config for the new client options
Signed-off-by: Chitral Verma <[email protected]>
* fix(services/hdfs-native): map AccessControlException to PermissionDenied
The NameNode reports every permission denial as an RPC error with class
org.apache.hadoop.security.AccessControlException. Map it to
ErrorKind::PermissionDenied instead of Unexpected and keep the message.
Signed-off-by: Chitral Verma <[email protected]>
* docs(services/hdfs-native): clarify when Kerberos settings fail the build
Signed-off-by: Chitral Verma <[email protected]>
---------
Signed-off-by: Chitral Verma <[email protected]>
---
.../ServiceConfig/HdfsNativeServiceConfig.cs | 42 ++-
.../java/org/apache/opendal/ServiceConfig.java | 72 +++-
bindings/python/python/opendal/config.py | 12 +-
core/Cargo.lock | 1 +
core/services/hdfs-native/Cargo.toml | 3 +
core/services/hdfs-native/src/backend.rs | 361 ++++++++++++++++++++-
core/services/hdfs-native/src/config.rs | 131 +++++++-
core/services/hdfs-native/src/core.rs | 23 ++
core/services/hdfs-native/src/docs.md | 62 ++++
website/data/services.json | 54 ++-
10 files changed, 748 insertions(+), 13 deletions(-)
diff --git a/bindings/dotnet/OpenDAL/ServiceConfig/HdfsNativeServiceConfig.cs
b/bindings/dotnet/OpenDAL/ServiceConfig/HdfsNativeServiceConfig.cs
index 6074a1094c..1ffec06927 100644
--- a/bindings/dotnet/OpenDAL/ServiceConfig/HdfsNativeServiceConfig.cs
+++ b/bindings/dotnet/OpenDAL/ServiceConfig/HdfsNativeServiceConfig.cs
@@ -28,35 +28,71 @@ namespace OpenDAL.ServiceConfig
/// </summary>
public sealed class HdfsNativeServiceConfig : IServiceConfig
{
+ /// <summary>
+ /// Directory that contains the Hadoop configuration files. The client
reads `core-site.xml`, `hdfs-site.xml`, `yarn-site.xml`, and `mapred-site.xml`
from one directory: `config_dir` when it is set, otherwise `HADOOP_CONF_DIR`,
otherwise `$HADOOP_HOME/etc/hadoop`. Setting `config_dir` stops the client from
reading the files in `HADOOP_CONF_DIR` and `HADOOP_HOME`. Properties in
`options` override the values from these files. Building the service fails with
`ConfigInvalid` when `co [...]
+ /// </summary>
+ public string? ConfigDir { get; init; }
/// <summary>
/// Deprecated: HDFS Native append capability is enabled by default.
/// </summary>
[System.Obsolete("HDFS Native append capability is enabled by default
and this option is no longer needed.")]
public bool? EnableAppend { get; init; }
/// <summary>
+ /// Kerberos credential cache that the client reads tickets from.
Requires `kerberos_principal`. With `kerberos_keytab`, the client also stores
the tickets it obtains from the keytab in this cache.
+ /// </summary>
+ public string? KerberosCache { get; init; }
+ /// <summary>
+ /// Path to the keytab that the client obtains Kerberos tickets from.
Requires `kerberos_principal`. The client keeps the tickets in an in-memory
credential cache that belongs to this service, unless `kerberos_cache` is set.
+ /// </summary>
+ public string? KerberosKeytab { get; init; }
+ /// <summary>
+ /// Kerberos principal that the client authenticates as. Set
`hadoop.security.authentication` to `kerberos` in `options` or in the Hadoop
configuration files. With any `kerberos_*` option, building the service, for
example through `Operator::new`, fails with `ConfigInvalid` when the effective
value is unset or exactly `simple`, because the client would ignore the
Kerberos settings and connect with simple authentication. Other values pass
this check, and building does not connect [...]
+ /// </summary>
+ public string? KerberosPrincipal { get; init; }
+ /// <summary>
/// name_node of this backend
/// </summary>
public string? NameNode { get; init; }
/// <summary>
- /// other options for hdfs client
+ /// Hadoop configuration properties for the client, such as
`dfs.client.socket-timeout`. These properties override the values from the
Hadoop configuration files. See `config_dir` for the files the client reads.
/// </summary>
public IReadOnlyDictionary<string, string>? Options { get; init; }
/// <summary>
/// work dir of this backend
/// </summary>
public string? Root { get; init; }
+ /// <summary>
+ /// HDFS user that the client acts as. Without Kerberos, the NameNode
accepts this name as the caller. When `user` is unset, the client uses
`HADOOP_USER_NAME`, then the operating system user. With Kerberos, the
authenticated principal impersonates this user. The cluster must allow the
impersonation through its `hadoop.proxyuser.*` settings. When `user` is unset,
the client uses `HADOOP_PROXY_USER`; when that is also unset, it acts as the
principal.
+ /// </summary>
+ public string? User { get; init; }
public string Scheme => "hdfs-native";
public IReadOnlyDictionary<string, string> ToOptions()
{
var map = new Dictionary<string, string>();
+ if (ConfigDir is not null)
+ {
+ map["config_dir"] = Utilities.ToOptionString(ConfigDir);
+ }
#pragma warning disable CS0618
if (EnableAppend is not null)
{
map["enable_append"] = Utilities.ToOptionString(EnableAppend);
}
#pragma warning restore CS0618
+ if (KerberosCache is not null)
+ {
+ map["kerberos_cache"] =
Utilities.ToOptionString(KerberosCache);
+ }
+ if (KerberosKeytab is not null)
+ {
+ map["kerberos_keytab"] =
Utilities.ToOptionString(KerberosKeytab);
+ }
+ if (KerberosPrincipal is not null)
+ {
+ map["kerberos_principal"] =
Utilities.ToOptionString(KerberosPrincipal);
+ }
if (NameNode is not null)
{
map["name_node"] = Utilities.ToOptionString(NameNode);
@@ -69,6 +105,10 @@ namespace OpenDAL.ServiceConfig
{
map["root"] = Utilities.ToOptionString(Root);
}
+ if (User is not null)
+ {
+ map["user"] = Utilities.ToOptionString(User);
+ }
return map;
}
}
diff --git a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
index 0407ff9d56..da66e72166 100644
--- a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
+++ b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
@@ -2203,24 +2203,79 @@ public interface ServiceConfig {
@Data
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
class HdfsNative implements ServiceConfig {
+ /**
+ * <p>Directory that contains the Hadoop configuration files.</p>
+ * <p>The client reads <code>core-site.xml</code>,
<code>hdfs-site.xml</code>, <code>yarn-site.xml</code>, and
+ * <code>mapred-site.xml</code> from one directory:
<code>config_dir</code> when it is set,
+ * otherwise <code>HADOOP_CONF_DIR</code>, otherwise
<code>$HADOOP_HOME/etc/hadoop</code>. Setting
+ * <code>config_dir</code> stops the client from reading the files in
+ * <code>HADOOP_CONF_DIR</code> and <code>HADOOP_HOME</code>.
Properties in <code>options</code> override
+ * the values from these files.</p>
+ * <p>Building the service fails with <code>ConfigInvalid</code> when
<code>config_dir</code> is
+ * not a directory.</p>
+ */
+ public final String configDir;
/**
* <p>Deprecated: HDFS Native append capability is enabled by
default.</p>
*
* @deprecated HDFS Native append capability is enabled by default and
this option is no longer needed.
*/
public final Boolean enableAppend;
+ /**
+ * <p>Kerberos credential cache that the client reads tickets from.</p>
+ * <p>Requires <code>kerberos_principal</code>. With
<code>kerberos_keytab</code>, the client also
+ * stores the tickets it obtains from the keytab in this cache.</p>
+ */
+ public final String kerberosCache;
+ /**
+ * <p>Path to the keytab that the client obtains Kerberos tickets
from.</p>
+ * <p>Requires <code>kerberos_principal</code>. The client keeps the
tickets in an
+ * in-memory credential cache that belongs to this service, unless
+ * <code>kerberos_cache</code> is set.</p>
+ */
+ public final String kerberosKeytab;
+ /**
+ * <p>Kerberos principal that the client authenticates as.</p>
+ * <p>Set <code>hadoop.security.authentication</code> to
<code>kerberos</code> in <code>options</code> or in
+ * the Hadoop configuration files. With any <code>kerberos_*</code>
option, building
+ * the service, for example through <code>Operator::new</code>, fails
with
+ * <code>ConfigInvalid</code> when the effective value is unset or
exactly <code>simple</code>,
+ * because the client would ignore the Kerberos settings and connect
with
+ * simple authentication. Other values pass this check, and building
does
+ * not connect to the cluster, so other authentication problems
surface on
+ * the first operation.</p>
+ * <p>Without <code>kerberos_keytab</code> or
<code>kerberos_cache</code>, the client looks up this
+ * principal's tickets in the default credential cache. When no
+ * <code>kerberos_*</code> option is set, a client with Kerberos
authentication uses
+ * the default principal of the default credential cache.</p>
+ */
+ public final String kerberosPrincipal;
/**
* <p>name_node of this backend</p>
*/
public final String nameNode;
/**
- * <p>other options for hdfs client</p>
+ * <p>Hadoop configuration properties for the client, such as
+ * <code>dfs.client.socket-timeout</code>.</p>
+ * <p>These properties override the values from the Hadoop
configuration
+ * files. See <code>config_dir</code> for the files the client
reads.</p>
*/
public final Map<String, String> options;
/**
* <p>work dir of this backend</p>
*/
public final String root;
+ /**
+ * <p>HDFS user that the client acts as.</p>
+ * <p>Without Kerberos, the NameNode accepts this name as the caller.
When
+ * <code>user</code> is unset, the client uses
<code>HADOOP_USER_NAME</code>, then the operating
+ * system user.</p>
+ * <p>With Kerberos, the authenticated principal impersonates this
user. The
+ * cluster must allow the impersonation through its
<code>hadoop.proxyuser.*</code>
+ * settings. When <code>user</code> is unset, the client uses
<code>HADOOP_PROXY_USER</code>;
+ * when that is also unset, it acts as the principal.</p>
+ */
+ public final String user;
@Override
public String scheme() {
@@ -2230,9 +2285,21 @@ public interface ServiceConfig {
@Override
public Map<String, String> configMap() {
final HashMap<String, String> map = new HashMap<>();
+ if (configDir != null) {
+ map.put("config_dir", configDir);
+ }
if (enableAppend != null) {
map.put("enable_append", String.valueOf(enableAppend));
}
+ if (kerberosCache != null) {
+ map.put("kerberos_cache", kerberosCache);
+ }
+ if (kerberosKeytab != null) {
+ map.put("kerberos_keytab", kerberosKeytab);
+ }
+ if (kerberosPrincipal != null) {
+ map.put("kerberos_principal", kerberosPrincipal);
+ }
if (nameNode != null) {
map.put("name_node", nameNode);
}
@@ -2242,6 +2309,9 @@ public interface ServiceConfig {
if (root != null) {
map.put("root", root);
}
+ if (user != null) {
+ map.put("user", user);
+ }
return map;
}
}
diff --git a/bindings/python/python/opendal/config.py
b/bindings/python/python/opendal/config.py
index d11e4c3380..f7cd0c67b6 100644
--- a/bindings/python/python/opendal/config.py
+++ b/bindings/python/python/opendal/config.py
@@ -685,14 +685,24 @@ class HdfsNativeConfig(TypedDict):
scheme: Required[Literal["hdfs-native"]]
"""The service scheme; fixed to `"hdfs-native"`."""
+ config_dir: NotRequired[str]
+ """Directory that contains the Hadoop configuration files. The client
reads `core-site.xml`, `hdfs-site.xml`, `yarn-site.xml`, and `mapred-site.xml`
from one directory: `config_dir` when it is set, otherwise `HADOOP_CONF_DIR`,
otherwise `$HADOOP_HOME/etc/hadoop`. Setting `config_dir` stops the client from
reading the files in `HADOOP_CONF_DIR` and `HADOOP_HOME`. Properties in
`options` override the values from these files. Building the service fails
with `ConfigInvalid` when `confi [...]
enable_append: NotRequired[bool]
"""Deprecated: HDFS Native append capability is enabled by default.
[Deprecated since 0.57.0] HDFS Native append capability is enabled by default
and this option is no longer needed."""
+ kerberos_cache: NotRequired[str]
+ """Kerberos credential cache that the client reads tickets from. Requires
`kerberos_principal`. With `kerberos_keytab`, the client also stores the
tickets it obtains from the keytab in this cache."""
+ kerberos_keytab: NotRequired[str]
+ """Path to the keytab that the client obtains Kerberos tickets from.
Requires `kerberos_principal`. The client keeps the tickets in an in-memory
credential cache that belongs to this service, unless `kerberos_cache` is
set."""
+ kerberos_principal: NotRequired[str]
+ """Kerberos principal that the client authenticates as. Set
`hadoop.security.authentication` to `kerberos` in `options` or in the Hadoop
configuration files. With any `kerberos_*` option, building the service, for
example through `Operator::new`, fails with `ConfigInvalid` when the effective
value is unset or exactly `simple`, because the client would ignore the
Kerberos settings and connect with simple authentication. Other values pass
this check, and building does not connect to t [...]
name_node: NotRequired[str]
"""name_node of this backend"""
options: NotRequired[dict[str, str]]
- """other options for hdfs client"""
+ """Hadoop configuration properties for the client, such as
`dfs.client.socket-timeout`. These properties override the values from the
Hadoop configuration files. See `config_dir` for the files the client reads."""
root: NotRequired[str | os.PathLike[str]]
"""work dir of this backend"""
+ user: NotRequired[str]
+ """HDFS user that the client acts as. Without Kerberos, the NameNode
accepts this name as the caller. When `user` is unset, the client uses
`HADOOP_USER_NAME`, then the operating system user. With Kerberos, the
authenticated principal impersonates this user. The cluster must allow the
impersonation through its `hadoop.proxyuser.*` settings. When `user` is unset,
the client uses `HADOOP_PROXY_USER`; when that is also unset, it acts as the
principal."""
class HetznerConfig(TypedDict):
diff --git a/core/Cargo.lock b/core/Cargo.lock
index 11008d1696..85d2b2e05c 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -8119,6 +8119,7 @@ dependencies = [
"asyncband 0.8.0",
"bytes",
"futures",
+ "hadoop-native",
"hdfs-native",
"log",
"opendal-core",
diff --git a/core/services/hdfs-native/Cargo.toml
b/core/services/hdfs-native/Cargo.toml
index 2ffbd02dd6..0db74fd604 100644
--- a/core/services/hdfs-native/Cargo.toml
+++ b/core/services/hdfs-native/Cargo.toml
@@ -42,6 +42,9 @@ kms-rustls-tls = ["hdfs-native/kms-rustls-tls"]
asyncband = { workspace = true, features = ["once-cell"] }
bytes = { workspace = true }
futures = { workspace = true }
+# Keep `hadoop-native` on the version that `hdfs-native` uses. The service
+# reads the effective Hadoop configuration with it to validate Kerberos
settings.
+hadoop-native = { version = "0.1.0" }
hdfs-native = { version = "0.15.1" }
log = { workspace = true }
opendal-core = { path = "../../core", version = "0.59.5", default-features =
false }
diff --git a/core/services/hdfs-native/src/backend.rs
b/core/services/hdfs-native/src/backend.rs
index 434506975b..23033970f6 100644
--- a/core/services/hdfs-native/src/backend.rs
+++ b/core/services/hdfs-native/src/backend.rs
@@ -16,6 +16,7 @@
// under the License.
use std::collections::HashMap;
+use std::path::Path;
use std::sync::Arc;
use log::debug;
@@ -80,14 +81,97 @@ impl HdfsNativeBuilder {
self
}
- /// Set other hdfs-native client options of this backend.
+ /// Set Hadoop configuration properties for the client.
///
- /// See the [hdfs-native
documentation](https://github.com/Kimahriman/hdfs-native)
- /// for the supported options.
+ /// These properties override the values from the Hadoop configuration
+ /// files. See [`Self::config_dir`] for the files the client reads, and the
+ /// [hdfs-native documentation](https://github.com/Kimahriman/hdfs-native)
+ /// for the supported properties.
pub fn options(mut self, options: HashMap<String, String>) -> Self {
self.config.options = Some(options);
self
}
+
+ /// Set the directory that contains the Hadoop configuration files.
+ ///
+ /// The client reads `core-site.xml`, `hdfs-site.xml`, `yarn-site.xml`, and
+ /// `mapred-site.xml` from this directory instead of `HADOOP_CONF_DIR` or
+ /// `$HADOOP_HOME/etc/hadoop`. Properties set through [`Self::options`]
+ /// override the values from these files. Building the service fails with
+ /// [`ErrorKind::ConfigInvalid`] when the path is not a directory.
+ ///
+ /// An empty value leaves the setting unchanged.
+ pub fn config_dir(mut self, config_dir: &str) -> Self {
+ if !config_dir.is_empty() {
+ self.config.config_dir = Some(config_dir.to_string());
+ }
+ self
+ }
+
+ /// Set the HDFS user that the client acts as.
+ ///
+ /// Without Kerberos, the NameNode accepts this name as the caller. When
+ /// unset, the client uses `HADOOP_USER_NAME`, then the operating system
+ /// user. With Kerberos, the authenticated principal impersonates this
user,
+ /// which the cluster must allow through its `hadoop.proxyuser.*` settings.
+ /// When unset, the client uses `HADOOP_PROXY_USER`, if set.
+ ///
+ /// An empty value leaves the setting unchanged.
+ pub fn user(mut self, user: &str) -> Self {
+ if !user.is_empty() {
+ self.config.user = Some(user.to_string());
+ }
+ self
+ }
+
+ /// Set the Kerberos principal that the client authenticates as.
+ ///
+ /// Set `hadoop.security.authentication` to `kerberos` in
+ /// [`Self::options`] or in the Hadoop configuration files. With any
+ /// `kerberos_*` setting, building the service, for example through
+ /// `Operator::new`, fails with [`ErrorKind::ConfigInvalid`] when the
+ /// effective value is unset or exactly `simple`. Other values pass this
+ /// check, and building does not connect to the cluster, so other
+ /// authentication problems surface on the first operation. Without a
+ /// keytab or credential cache, the client looks up this principal's
+ /// tickets in the default credential cache.
+ ///
+ /// An empty value leaves the setting unchanged.
+ pub fn kerberos_principal(mut self, principal: &str) -> Self {
+ if !principal.is_empty() {
+ self.config.kerberos_principal = Some(principal.to_string());
+ }
+ self
+ }
+
+ /// Set the keytab that the client obtains Kerberos tickets from.
+ ///
+ /// Requires [`Self::kerberos_principal`]. The client keeps the tickets in
+ /// an in-memory credential cache that belongs to this service, unless
+ /// [`Self::kerberos_cache`] is set.
+ ///
+ /// An empty value leaves the setting unchanged.
+ pub fn kerberos_keytab(mut self, keytab: &str) -> Self {
+ if !keytab.is_empty() {
+ self.config.kerberos_keytab = Some(keytab.to_string());
+ }
+ self
+ }
+
+ /// Set the Kerberos credential cache that the client reads tickets from,
+ /// such as `FILE:/tmp/krb5cc_alice`.
+ ///
+ /// Requires [`Self::kerberos_principal`]. With [`Self::kerberos_keytab`],
+ /// the client also stores the tickets it obtains from the keytab in this
+ /// cache.
+ ///
+ /// An empty value leaves the setting unchanged.
+ pub fn kerberos_cache(mut self, cache: &str) -> Self {
+ if !cache.is_empty() {
+ self.config.kerberos_cache = Some(cache.to_string());
+ }
+ self
+ }
}
impl Builder for HdfsNativeBuilder {
@@ -107,6 +191,29 @@ impl Builder for HdfsNativeBuilder {
let root = normalize_root(&self.config.root.unwrap_or_default());
debug!("backend use root {root}");
+ let config_dir = self.config.config_dir;
+ let kerberos_principal = self.config.kerberos_principal;
+ let kerberos_keytab = self.config.kerberos_keytab;
+ let kerberos_cache = self.config.kerberos_cache;
+
+ if kerberos_principal.is_none() && (kerberos_keytab.is_some() ||
kerberos_cache.is_some()) {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ "kerberos_keytab and kerberos_cache require
kerberos_principal",
+ )
+ .with_context("service", HDFS_NATIVE_SCHEME));
+ }
+ // hdfs-native skips every file of a missing directory without an
error.
+ if let Some(dir) = &config_dir
+ && !Path::new(dir).is_dir()
+ {
+ return Err(
+ Error::new(ErrorKind::ConfigInvalid, "config_dir is not a
directory")
+ .with_context("service", HDFS_NATIVE_SCHEME)
+ .with_context("config_dir", dir),
+ );
+ }
+
let mut hdfs_config = self.config.options.unwrap_or_default();
let mut client_builder = hdfs_native::ClientBuilder::new();
if name_node != "default" {
@@ -127,6 +234,41 @@ impl Builder for HdfsNativeBuilder {
client_builder = client_builder.with_url(url);
}
+ if kerberos_principal.is_some() {
+ // hdfs-native ignores Kerberos credentials and connects with
simple
+ // authentication unless the effective Hadoop configuration enables
+ // Kerberos. Loading the files a second time costs one XML parse
per
+ // build, and only when Kerberos settings are present.
+ let effective = hadoop_native::config::Configuration::new(
+ config_dir.clone(),
+ Some(hdfs_config.clone()),
+ )
+ .map_err(|err| parse_hdfs_error(err.into()))?;
+ if !effective.security_enabled() {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ "kerberos_principal, kerberos_keytab and kerberos_cache
require hadoop.security.authentication=kerberos in options or the Hadoop
configuration files",
+ )
+ .with_context("service", HDFS_NATIVE_SCHEME));
+ }
+ }
+
+ if let Some(v) = config_dir {
+ client_builder = client_builder.with_config_dir(v);
+ }
+ if let Some(v) = self.config.user {
+ client_builder = client_builder.with_user(v);
+ }
+ if let Some(v) = kerberos_principal {
+ client_builder = client_builder.with_kerberos_principal(v);
+ }
+ if let Some(v) = kerberos_keytab {
+ client_builder = client_builder.with_kerberos_keytab(v);
+ }
+ if let Some(v) = kerberos_cache {
+ client_builder = client_builder.with_kerberos_cache(v);
+ }
+
let client = client_builder
.with_config(hdfs_config)
.build()
@@ -269,3 +411,216 @@ impl Service for HdfsNativeBackend {
))
}
}
+
+#[cfg(test)]
+mod tests {
+ use std::path::PathBuf;
+
+ use super::*;
+
+ /// Writes `core-site.xml` with `properties` into a new temporary
directory.
+ fn hadoop_conf_dir(name: &str, properties: &[(&str, &str)]) -> PathBuf {
+ let dir =
+ std::env::temp_dir().join(format!("opendal-hdfs-native-{name}-{}",
std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let properties: String = properties
+ .iter()
+ .map(|(k, v)|
format!("<property><name>{k}</name><value>{v}</value></property>"))
+ .collect();
+ std::fs::write(
+ dir.join("core-site.xml"),
+ format!("<?xml
version=\"1.0\"?><configuration>{properties}</configuration>"),
+ )
+ .unwrap();
+ dir
+ }
+
+ fn build_error(builder: HdfsNativeBuilder) -> Error {
+ builder.build().expect_err("build must fail")
+ }
+
+ fn build_ok(builder: HdfsNativeBuilder) {
+ builder.build().expect("build must succeed");
+ }
+
+ #[test]
+ fn setters_set_client_options() {
+ let builder = HdfsNativeBuilder::default()
+ .config_dir("/etc/hadoop/conf")
+ .user("alice")
+ .kerberos_principal("[email protected]")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab")
+ .kerberos_cache("FILE:/tmp/krb5cc_alice");
+
+ assert_eq!(
+ builder.config.config_dir.as_deref(),
+ Some("/etc/hadoop/conf")
+ );
+ assert_eq!(builder.config.user.as_deref(), Some("alice"));
+ assert_eq!(
+ builder.config.kerberos_principal.as_deref(),
+ Some("[email protected]")
+ );
+ assert_eq!(
+ builder.config.kerberos_keytab.as_deref(),
+ Some("/etc/security/keytabs/alice.keytab")
+ );
+ assert_eq!(
+ builder.config.kerberos_cache.as_deref(),
+ Some("FILE:/tmp/krb5cc_alice")
+ );
+ }
+
+ #[test]
+ fn setters_ignore_empty_values() {
+ let builder = HdfsNativeBuilder::default()
+ .config_dir("/etc/hadoop/conf")
+ .user("alice")
+ .kerberos_principal("[email protected]")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab")
+ .kerberos_cache("FILE:/tmp/krb5cc_alice")
+ .config_dir("")
+ .user("")
+ .kerberos_principal("")
+ .kerberos_keytab("")
+ .kerberos_cache("");
+
+ assert_eq!(
+ builder.config.config_dir.as_deref(),
+ Some("/etc/hadoop/conf")
+ );
+ assert_eq!(builder.config.user.as_deref(), Some("alice"));
+ assert_eq!(
+ builder.config.kerberos_principal.as_deref(),
+ Some("[email protected]")
+ );
+ assert_eq!(
+ builder.config.kerberos_keytab.as_deref(),
+ Some("/etc/security/keytabs/alice.keytab")
+ );
+ assert_eq!(
+ builder.config.kerberos_cache.as_deref(),
+ Some("FILE:/tmp/krb5cc_alice")
+ );
+ }
+
+ #[test]
+ fn build_reads_default_name_node_from_config_dir() {
+ let dir = hadoop_conf_dir("default-fs", &[("fs.defaultFS",
"hdfs://127.0.0.1:9000")]);
+
+ build_ok(
+ HdfsNativeBuilder::default()
+ .name_node("default")
+ .config_dir(dir.to_str().unwrap()),
+ );
+ }
+
+ #[test]
+ fn build_rejects_keytab_without_principal() {
+ let err = build_error(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab"),
+ );
+
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid);
+ assert_eq!(
+ err.message(),
+ "kerberos_keytab and kerberos_cache require kerberos_principal"
+ );
+ }
+
+ #[test]
+ fn build_rejects_cache_without_principal() {
+ let err = build_error(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .kerberos_cache("FILE:/tmp/krb5cc_alice"),
+ );
+
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid);
+ assert_eq!(
+ err.message(),
+ "kerberos_keytab and kerberos_cache require kerberos_principal"
+ );
+ }
+
+ #[test]
+ fn build_rejects_missing_config_dir() {
+ let dir = std::env::temp_dir().join(format!(
+ "opendal-hdfs-native-missing-{}",
+ std::process::id()
+ ));
+
+ let err = build_error(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .config_dir(dir.to_str().unwrap()),
+ );
+
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid);
+ assert_eq!(err.message(), "config_dir is not a directory");
+ }
+
+ #[test]
+ fn build_rejects_kerberos_principal_without_kerberos_authentication() {
+ let err = build_error(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .options(HashMap::from([(
+ "hadoop.security.authentication".to_string(),
+ "simple".to_string(),
+ )]))
+ .kerberos_principal("[email protected]")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab"),
+ );
+
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid);
+ assert_eq!(
+ err.message(),
+ "kerberos_principal, kerberos_keytab and kerberos_cache require
hadoop.security.authentication=kerberos in options or the Hadoop configuration
files"
+ );
+ }
+
+ #[test]
+ fn build_accepts_kerberos_authentication_from_config_dir() {
+ let dir = hadoop_conf_dir(
+ "kerberos",
+ &[("hadoop.security.authentication", "kerberos")],
+ );
+
+ build_ok(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .config_dir(dir.to_str().unwrap())
+ .kerberos_principal("[email protected]")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab"),
+ );
+ }
+
+ #[test]
+ fn build_lets_options_override_config_dir_authentication() {
+ let dir = hadoop_conf_dir(
+ "kerberos-overridden",
+ &[("hadoop.security.authentication", "kerberos")],
+ );
+
+ let err = build_error(
+ HdfsNativeBuilder::default()
+ .name_node("hdfs://127.0.0.1:9000")
+ .config_dir(dir.to_str().unwrap())
+ .options(HashMap::from([(
+ "hadoop.security.authentication".to_string(),
+ "simple".to_string(),
+ )]))
+ .kerberos_principal("[email protected]"),
+ );
+
+ assert_eq!(err.kind(), ErrorKind::ConfigInvalid);
+ assert!(
+ err.message()
+ .starts_with("kerberos_principal, kerberos_keytab and
kerberos_cache require"),
+ "{err}"
+ );
+ }
+}
diff --git a/core/services/hdfs-native/src/config.rs
b/core/services/hdfs-native/src/config.rs
index f3dbdb958c..97da8dd5a8 100644
--- a/core/services/hdfs-native/src/config.rs
+++ b/core/services/hdfs-native/src/config.rs
@@ -34,17 +34,94 @@ pub const HA_NAMENODE_RPC_ADDRESS_PREFIX: &str =
"dfs.namenode.rpc-address";
#[non_exhaustive]
pub struct HdfsNativeConfig {
/// work dir of this backend
+ ///
+ /// <!-- @group General -->
pub root: Option<String>,
/// name_node of this backend
+ ///
+ /// <!-- @group General -->
pub name_node: Option<String>,
/// Deprecated: HDFS Native append capability is enabled by default.
+ ///
+ /// <!-- @group Deprecated -->
#[deprecated(
since = "0.57.0",
note = "HDFS Native append capability is enabled by default and this
option is no longer needed."
)]
pub enable_append: bool,
- /// other options for hdfs client
+ /// Hadoop configuration properties for the client, such as
+ /// `dfs.client.socket-timeout`.
+ ///
+ /// These properties override the values from the Hadoop configuration
+ /// files. See `config_dir` for the files the client reads.
+ ///
+ /// <!-- @group General -->
pub options: Option<HashMap<String, String>>,
+ /// Directory that contains the Hadoop configuration files.
+ ///
+ /// The client reads `core-site.xml`, `hdfs-site.xml`, `yarn-site.xml`, and
+ /// `mapred-site.xml` from one directory: `config_dir` when it is set,
+ /// otherwise `HADOOP_CONF_DIR`, otherwise `$HADOOP_HOME/etc/hadoop`.
Setting
+ /// `config_dir` stops the client from reading the files in
+ /// `HADOOP_CONF_DIR` and `HADOOP_HOME`. Properties in `options` override
+ /// the values from these files.
+ ///
+ /// Building the service fails with `ConfigInvalid` when `config_dir` is
+ /// not a directory.
+ ///
+ /// <!-- @group General -->
+ /// <!-- @example /etc/hadoop/conf -->
+ pub config_dir: Option<String>,
+ /// HDFS user that the client acts as.
+ ///
+ /// Without Kerberos, the NameNode accepts this name as the caller. When
+ /// `user` is unset, the client uses `HADOOP_USER_NAME`, then the operating
+ /// system user.
+ ///
+ /// With Kerberos, the authenticated principal impersonates this user. The
+ /// cluster must allow the impersonation through its `hadoop.proxyuser.*`
+ /// settings. When `user` is unset, the client uses `HADOOP_PROXY_USER`;
+ /// when that is also unset, it acts as the principal.
+ ///
+ /// <!-- @group Credentials -->
+ /// <!-- @example alice -->
+ pub user: Option<String>,
+ /// Kerberos principal that the client authenticates as.
+ ///
+ /// Set `hadoop.security.authentication` to `kerberos` in `options` or in
+ /// the Hadoop configuration files. With any `kerberos_*` option, building
+ /// the service, for example through `Operator::new`, fails with
+ /// `ConfigInvalid` when the effective value is unset or exactly `simple`,
+ /// because the client would ignore the Kerberos settings and connect with
+ /// simple authentication. Other values pass this check, and building does
+ /// not connect to the cluster, so other authentication problems surface on
+ /// the first operation.
+ ///
+ /// Without `kerberos_keytab` or `kerberos_cache`, the client looks up this
+ /// principal's tickets in the default credential cache. When no
+ /// `kerberos_*` option is set, a client with Kerberos authentication uses
+ /// the default principal of the default credential cache.
+ ///
+ /// <!-- @group Credentials -->
+ /// <!-- @example [email protected] -->
+ pub kerberos_principal: Option<String>,
+ /// Path to the keytab that the client obtains Kerberos tickets from.
+ ///
+ /// Requires `kerberos_principal`. The client keeps the tickets in an
+ /// in-memory credential cache that belongs to this service, unless
+ /// `kerberos_cache` is set.
+ ///
+ /// <!-- @group Credentials -->
+ /// <!-- @example /etc/security/keytabs/alice.keytab -->
+ pub kerberos_keytab: Option<String>,
+ /// Kerberos credential cache that the client reads tickets from.
+ ///
+ /// Requires `kerberos_principal`. With `kerberos_keytab`, the client also
+ /// stores the tickets it obtains from the keytab in this cache.
+ ///
+ /// <!-- @group Credentials -->
+ /// <!-- @example FILE:/tmp/krb5cc_alice -->
+ pub kerberos_cache: Option<String>,
}
impl Debug for HdfsNativeConfig {
@@ -53,6 +130,9 @@ impl Debug for HdfsNativeConfig {
.field("root", &self.root)
.field("name_node", &self.name_node)
.field("options", &self.options)
+ .field("config_dir", &self.config_dir)
+ .field("user", &self.user)
+ .field("kerberos_principal", &self.kerberos_principal)
.finish_non_exhaustive()
}
}
@@ -130,6 +210,55 @@ mod tests {
assert_eq!(cfg.root.as_deref(), Some("user/project"));
}
+ #[test]
+ fn from_iter_reads_client_options() {
+ let cfg = HdfsNativeConfig::from_iter([
+ ("config_dir".to_string(), "/etc/hadoop/conf".to_string()),
+ ("user".to_string(), "alice".to_string()),
+ (
+ "kerberos_principal".to_string(),
+ "[email protected]".to_string(),
+ ),
+ (
+ "kerberos_keytab".to_string(),
+ "/etc/security/keytabs/alice.keytab".to_string(),
+ ),
+ (
+ "kerberos_cache".to_string(),
+ "FILE:/tmp/krb5cc_alice".to_string(),
+ ),
+ ])
+ .unwrap();
+
+ assert_eq!(cfg.config_dir.as_deref(), Some("/etc/hadoop/conf"));
+ assert_eq!(cfg.user.as_deref(), Some("alice"));
+ assert_eq!(cfg.kerberos_principal.as_deref(),
Some("[email protected]"));
+ assert_eq!(
+ cfg.kerberos_keytab.as_deref(),
+ Some("/etc/security/keytabs/alice.keytab")
+ );
+ assert_eq!(
+ cfg.kerberos_cache.as_deref(),
+ Some("FILE:/tmp/krb5cc_alice")
+ );
+ }
+
+ #[test]
+ fn debug_omits_kerberos_keytab_and_cache() {
+ let cfg = HdfsNativeConfig {
+ user: Some("alice".to_string()),
+ kerberos_principal: Some("[email protected]".to_string()),
+ kerberos_keytab:
Some("/etc/security/keytabs/alice.keytab".to_string()),
+ kerberos_cache: Some("FILE:/tmp/krb5cc_alice".to_string()),
+ ..Default::default()
+ };
+
+ let debug = format!("{cfg:?}");
+ assert!(debug.contains("[email protected]"), "{debug}");
+ assert!(!debug.contains("alice.keytab"), "{debug}");
+ assert!(!debug.contains("krb5cc_alice"), "{debug}");
+ }
+
#[test]
fn from_uri_allows_missing_authority() {
let uri = OperatorUri::new("hdfs-native", Vec::<(String,
String)>::new()).unwrap();
diff --git a/core/services/hdfs-native/src/core.rs
b/core/services/hdfs-native/src/core.rs
index cab3b3f53a..d6c9383eef 100644
--- a/core/services/hdfs-native/src/core.rs
+++ b/core/services/hdfs-native/src/core.rs
@@ -281,6 +281,8 @@ pub fn parse_hdfs_error(hdfs_error: HdfsError) -> Error {
HdfsError::RPCError(msg0, msg1) => {
if msg0.contains("java.io.FileNotFoundException") {
(ErrorKind::NotFound, false, msg1.clone())
+ } else if
msg0.contains("org.apache.hadoop.security.AccessControlException") {
+ (ErrorKind::PermissionDenied, false, msg1.clone())
} else {
(ErrorKind::Unexpected, false, msg1.clone())
}
@@ -303,3 +305,24 @@ pub fn parse_hdfs_error(hdfs_error: HdfsError) -> Error {
err
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn parse_hdfs_error_maps_access_control_exception_to_permission_denied() {
+ // Class and message as a MiniDFS NameNode returns them for a denied
read.
+ let err = parse_hdfs_error(HdfsError::RPCError(
+ "org.apache.hadoop.security.AccessControlException".to_string(),
+ "Permission denied: user=bob, access=READ,
inode=\"/od9038/alice-secret.txt\":alice:supergroup:-rw-------".to_string(),
+ ));
+
+ assert_eq!(err.kind(), ErrorKind::PermissionDenied);
+ assert_eq!(
+ err.message(),
+ "Permission denied: user=bob, access=READ,
inode=\"/od9038/alice-secret.txt\":alice:supergroup:-rw-------"
+ );
+ assert!(!err.is_temporary());
+ }
+}
diff --git a/core/services/hdfs-native/src/docs.md
b/core/services/hdfs-native/src/docs.md
index 52ad4e20c7..f2a3d6d16c 100644
--- a/core/services/hdfs-native/src/docs.md
+++ b/core/services/hdfs-native/src/docs.md
@@ -31,6 +31,68 @@ Use [`crate::HdfsNativeConfig`] for serializable
configuration and this builder'
methods for direct construction. The field and method documentation defines
accepted values, defaults, and environment interaction.
+Each built service owns one `hdfs-native` client. The service creates the
+client when it is built and reuses it for every operation. The client opens
+NameNode connections, and authenticates them, on first use.
+
+### Hadoop configuration
+
+The client resolves each Hadoop property from the first of these sources that
+sets it:
+
+1. `options`.
+2. The Hadoop configuration files in `config_dir`.
+3. The Hadoop configuration files in `HADOOP_CONF_DIR`, when `config_dir` is
+ unset.
+4. The Hadoop configuration files in `$HADOOP_HOME/etc/hadoop`, when
+ `config_dir` and `HADOOP_CONF_DIR` are unset.
+
+The client reads files from only one directory, so `config_dir` replaces
+`HADOOP_CONF_DIR` rather than adding to it.
+
+### Identity
+
+`hadoop.security.authentication` selects how the client authenticates.
+
+| Authentication | NameNode caller |
+| --- | --- |
+| `simple` or unset | `user`, then `HADOOP_USER_NAME`, then the operating
system user. |
+| `kerberos` | The principal from `kerberos_principal`, or the default
principal of the default credential cache. With `user`, or else
`HADOOP_PROXY_USER`, the principal impersonates that user. |
+
+To use Kerberos, set `hadoop.security.authentication` to `kerberos`.
+`kerberos_keytab` and `kerberos_cache` require `kerberos_principal`. With any
+`kerberos_*` setting, building the service, for example through
+`Operator::new`, fails with [`ErrorKind::ConfigInvalid`] when the effective
+`hadoop.security.authentication` is unset or exactly `simple`. Other values
+pass this check, and building does not connect to the cluster, so other
+authentication problems surface on the first operation. To check the
+authentication setting, building a service with `kerberos_*` settings reads the
+Hadoop configuration files a second time.
+
+With `kerberos_keytab`, the client requests tickets from the KDC when it first
+connects. Without `kerberos_cache`, it keeps them in an in-memory credential
+cache that belongs to this service, so services with different principals in
+one process do not share tickets.
+
+The Kerberos library reads `KRB5_CONFIG` and `KRB5CCNAME` for the whole
+process. Services without `kerberos_*` settings can also authenticate with the
+delegation tokens in `HADOOP_TOKEN_FILE_LOCATION`.
+
+```rust,no_run
+use opendal_core::Operator;
+use opendal_service_hdfs_native::HdfsNative;
+
+# fn main() -> opendal_core::Result<()> {
+let builder = HdfsNative::default()
+ .name_node("hdfs://namenode.example.com:8020")
+ .config_dir("/etc/hadoop/conf")
+ .kerberos_principal("[email protected]")
+ .kerberos_keytab("/etc/security/keytabs/alice.keytab");
+let op = Operator::new(builder)?;
+# Ok(())
+# }
+```
+
## Encryption zones
Reading and writing files in HDFS encryption zones requires a Hadoop KMS
client.
diff --git a/website/data/services.json b/website/data/services.json
index 29a790e24d..8aaca44057 100644
--- a/website/data/services.json
+++ b/website/data/services.json
@@ -3014,7 +3014,9 @@
"name": "hdfs-native",
"scheme": "hdfs-native",
"groups": [
- "General"
+ "General",
+ "Credentials",
+ "Deprecated"
],
"configs": [
{
@@ -3035,7 +3037,7 @@
"name": "enable_append",
"type": "bool",
"required": false,
- "group": "General",
+ "group": "Deprecated",
"deprecated": {
"since": "0.57.0",
"note": "HDFS Native append capability is enabled by default and
this option is no longer needed."
@@ -3047,7 +3049,47 @@
"type": "map",
"required": false,
"group": "General",
- "comments": "other options for hdfs client"
+ "comments": "Hadoop configuration properties for the client, such
as\n`dfs.client.socket-timeout`.\n\nThese properties override the values from
the Hadoop configuration\nfiles. See `config_dir` for the files the client
reads."
+ },
+ {
+ "name": "config_dir",
+ "type": "string",
+ "required": false,
+ "group": "General",
+ "example": "/etc/hadoop/conf",
+ "comments": "Directory that contains the Hadoop configuration
files.\n\nThe client reads `core-site.xml`, `hdfs-site.xml`, `yarn-site.xml`,
and\n`mapred-site.xml` from one directory: `config_dir` when it is
set,\notherwise `HADOOP_CONF_DIR`, otherwise `$HADOOP_HOME/etc/hadoop`.
Setting\n`config_dir` stops the client from reading the files
in\n`HADOOP_CONF_DIR` and `HADOOP_HOME`. Properties in `options` override\nthe
values from these files.\n\nBuilding the service fails with `C [...]
+ },
+ {
+ "name": "user",
+ "type": "string",
+ "required": false,
+ "group": "Credentials",
+ "example": "alice",
+ "comments": "HDFS user that the client acts as.\n\nWithout Kerberos,
the NameNode accepts this name as the caller. When\n`user` is unset, the client
uses `HADOOP_USER_NAME`, then the operating\nsystem user.\n\nWith Kerberos, the
authenticated principal impersonates this user. The\ncluster must allow the
impersonation through its `hadoop.proxyuser.*`\nsettings. When `user` is unset,
the client uses `HADOOP_PROXY_USER`;\nwhen that is also unset, it acts as the
principal."
+ },
+ {
+ "name": "kerberos_principal",
+ "type": "string",
+ "required": false,
+ "group": "Credentials",
+ "example": "[email protected]",
+ "comments": "Kerberos principal that the client authenticates
as.\n\nSet `hadoop.security.authentication` to `kerberos` in `options` or
in\nthe Hadoop configuration files. With any `kerberos_*` option, building\nthe
service, for example through `Operator::new`, fails with\n`ConfigInvalid` when
the effective value is unset or exactly `simple`,\nbecause the client would
ignore the Kerberos settings and connect with\nsimple authentication. Other
values pass this check, and buildin [...]
+ },
+ {
+ "name": "kerberos_keytab",
+ "type": "string",
+ "required": false,
+ "group": "Credentials",
+ "example": "/etc/security/keytabs/alice.keytab",
+ "comments": "Path to the keytab that the client obtains Kerberos
tickets from.\n\nRequires `kerberos_principal`. The client keeps the tickets in
an\nin-memory credential cache that belongs to this service,
unless\n`kerberos_cache` is set."
+ },
+ {
+ "name": "kerberos_cache",
+ "type": "string",
+ "required": false,
+ "group": "Credentials",
+ "example": "FILE:/tmp/krb5cc_alice",
+ "comments": "Kerberos credential cache that the client reads tickets
from.\n\nRequires `kerberos_principal`. With `kerberos_keytab`, the client
also\nstores the tickets it obtains from the keytab in this cache."
}
],
"examples": [
@@ -3055,19 +3097,19 @@
"binding": "rust",
"language": "rust",
"minimal": "use opendal::Operator;\n\nlet operator =
Operator::via_iter(\"hdfs-native\", [\n])?;",
- "full": "use opendal::Operator;\n\nlet operator =
Operator::via_iter(\"hdfs-native\", [\n // work dir of this backend\n //
(\"root\".to_string(), \"...\".to_string()),\n\n // name_node of this
backend\n // (\"name_node\".to_string(), \"...\".to_string()),\n\n //
other options for hdfs client\n // (\"options\".to_string(),
\"{\\\"key\\\":\\\"value\\\"}\".to_string()),\n])?;"
+ "full": "use opendal::Operator;\n\nlet operator =
Operator::via_iter(\"hdfs-native\", [\n // --- General ---\n // work dir
of this backend\n // (\"root\".to_string(), \"...\".to_string()),\n\n //
name_node of this backend\n // (\"name_node\".to_string(),
\"...\".to_string()),\n\n // Hadoop configuration properties for the client,
such as\n // `dfs.client.socket-timeout`.\n //\n // These properties
override the values from the Hadoop configuration\n [...]
},
{
"binding": "python",
"language": "python",
"minimal": "import opendal\n\noperator = opendal.Operator(\n
\"hdfs-native\",\n)",
- "full": "import opendal\n\noperator = opendal.Operator(\n
\"hdfs-native\",\n # work dir of this backend\n # root=\"...\",\n\n #
name_node of this backend\n # name_node=\"...\",\n\n # other options for
hdfs client\n # options=\"{\\\"key\\\":\\\"value\\\"}\",\n)"
+ "full": "import opendal\n\noperator = opendal.Operator(\n
\"hdfs-native\",\n # --- General ---\n # work dir of this backend\n #
root=\"...\",\n\n # name_node of this backend\n # name_node=\"...\",\n\n
# Hadoop configuration properties for the client, such as\n #
`dfs.client.socket-timeout`.\n #\n # These properties override the values
from the Hadoop configuration\n # files. See `config_dir` for the files the
client reads.\n # options=\"{\\\" [...]
},
{
"binding": "nodejs",
"language": "javascript",
"minimal": "import { Operator } from \"opendal\";\n\nconst operator
= new Operator(\"hdfs-native\", {\n});",
- "full": "import { Operator } from \"opendal\";\n\nconst operator =
new Operator(\"hdfs-native\", {\n // work dir of this backend\n // root:
\"...\",\n\n // name_node of this backend\n // name_node: \"...\",\n\n //
other options for hdfs client\n // options:
\"{\\\"key\\\":\\\"value\\\"}\",\n});"
+ "full": "import { Operator } from \"opendal\";\n\nconst operator =
new Operator(\"hdfs-native\", {\n // --- General ---\n // work dir of this
backend\n // root: \"...\",\n\n // name_node of this backend\n // name_node:
\"...\",\n\n // Hadoop configuration properties for the client, such as\n //
`dfs.client.socket-timeout`.\n //\n // These properties override the values
from the Hadoop configuration\n // files. See `config_dir` for the files the
client reads.\n // opt [...]
}
]
},