Closed wciq1208 closed 2 years ago
在dfget的入口也添加
_ "d7y.io/dragonfly/v2/pkg/source/hdfsprotocol"
后该错误解决
但是有了新的问题;我们的集群需要通过k8s的keytab认证登陆,看了代码似乎暂时不支持,只能自己魔改一下
在dfget的入口也添加
_ "d7y.io/dragonfly/v2/pkg/source/hdfsprotocol"
后该错误解决
但是有了新的问题;我们的集群需要通过k8s的keytab认证登陆,看了代码似乎暂时不支持,只能自己魔改一下
可以自己添加 keytab 认证的
经过不懈努力,最后终于调通了 我对 https://github.com/dragonflyoss/Dragonfly2/blob/v2.0.1/pkg/source/hdfsprotocol/hdfs_source_client.go#L203 函数作了如下魔改:
主要解决不知道集群地址和有权限验证的情况
hadoopConfDir := os.Getenv("DRAGONFLY_HADOOP_CONF")
if hadoopConfDir == "" {
hadoopConfDir = "/etc/hadoop"
}
hadoopConf, err := hadoopconf.Load(hadoopConfDir)
if err != nil {
return nil, err
}
// create client option
options := hdfs.ClientOptionsFromConf(hadoopConf)
k8sCfg, err := k8s_config.Load("/etc/krb5.conf")
if err != nil {
return nil, err
}
k8sKey, err := keytab.Load("/home/ai/ai.keytab")
if err != nil {
return nil, err
}
var user = "ai"
options.KerberosClient = k8s_client.NewWithKeytab(user, "BILIBILI.CO", k8sKey, k8sCfg)
dialFunc := (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 120 * time.Second,
}).DialContext
options.NamenodeDialFunc = dialFunc
options.DatanodeDialFunc = dialFunc
err = options.KerberosClient.Login()
if err != nil {
return nil, err
}
/*options.Addresses = strings.Split(parse.Host, ",")
u, err := user.Current()
if err != nil {
return nil, err
}
options.User = u.Username*/
这个版本应该不通用吧,所以我觉得可以用 plugin 的方式,实现一遍,参考地址:https://github.com/dragonflyoss/Dragonfly2/blob/main/docs/en/developer-guide/plugin.md,(接口有变更,注意修改,近期会更新一下最新文档)
Bug report:
按照群内指引将 https://github.com/dragonflyoss/Dragonfly2/blob/v2.0.1/cmd/cdn/main.go 代码改为
重新编译后后运行还是拉取失败 运行命令
dfget日志:
daemon日志:
cdn上未看到报错
Expected behavior:
基于v2.0.1修改
How to reproduce it:
Environment:
uname -a
):5.15.0-051500-generic