hdfs: added support for list of namenodes in hdfs remote config

Users can now input a comma separated list of namenodes when writing
config for hdfs remotes.

This is required when you have multiple namenodes in your hdfs cluster
and cannot be certain which namenodes will be in 'standby' or 'active'
states.

This was available before but wasn't documented and didn't use the
correct rclone interfaces.
This commit is contained in:
Tayo-pasedaRJ 2023-11-13 15:55:52 +00:00 committed by GitHub
parent ad83ff769b
commit 0548e61910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -93,7 +93,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
} }
options := hdfs.ClientOptions{ options := hdfs.ClientOptions{
Addresses: []string{opt.Namenode}, Addresses: opt.Namenode,
UseDatanodeHostname: false, UseDatanodeHostname: false,
} }

View File

@ -20,9 +20,10 @@ func init() {
NewFs: NewFs, NewFs: NewFs,
Options: []fs.Option{{ Options: []fs.Option{{
Name: "namenode", Name: "namenode",
Help: "Hadoop name node and port.\n\nE.g. \"namenode:8020\" to connect to host namenode at port 8020.", Help: "Hadoop name nodes and ports.\n\nE.g. \"namenode-1:8020,namenode-2:8020,...\" to connect to host namenodes at port 8020.",
Required: true, Required: true,
Sensitive: true, Sensitive: true,
Default: fs.CommaSepList{},
}, { }, {
Name: "username", Name: "username",
Help: "Hadoop user name.", Help: "Hadoop user name.",
@ -65,7 +66,7 @@ and 'privacy'. Used only with KERBEROS enabled.`,
// Options for this backend // Options for this backend
type Options struct { type Options struct {
Namenode string `config:"namenode"` Namenode fs.CommaSepList `config:"namenode"`
Username string `config:"username"` Username string `config:"username"`
ServicePrincipalName string `config:"service_principal_name"` ServicePrincipalName string `config:"service_principal_name"`
DataTransferProtection string `config:"data_transfer_protection"` DataTransferProtection string `config:"data_transfer_protection"`