HDFS为什么在使用golang时会抛出意外的EOF错误?

huangapple go评论74阅读模式
英文:

Why does HDFS throw unexpected EOF error using golang?

问题

以下是翻译好的内容:

package main
import (
    "fmt"
    "github.com/colinmarc/hdfs"
)
func main() { 
    client, err := hdfs.New("192.168.0.38:50070")
    fs, err := client.ReadDir("/")
    fmt.Println(err)
    fmt.Println(fs)
}

err is unexpected EOF
And I found that the error occurs in 

func (c *NamenodeConnection) readResponse(method string, resp proto.Message) error {
...
    _, err = io.ReadFull(c.conn, packet)
...
}

I'm using hadoop 2.7.3

错误是意外的EOF
我发现错误发生在

func (c *NamenodeConnection) readResponse(method string, resp proto.Message) error {
...
    _, err = io.ReadFull(c.conn, packet)
...
}

我正在使用hadoop 2.7.3

英文:
package main
import (
    "fmt"
    "github.com/colinmarc/hdfs"
)
func main() { 
    client, err := hdfs.New("192.168.0.38:50070")
    fs, err := client.ReadDir("/")
    fmt.Println(err)
    fmt.Println(fs)
}

err is unexpected EOF
And I found that the error occurs in

func (c *NamenodeConnection) readResponse(method string, resp proto.Message) error {
...
    _, err = io.ReadFull(c.conn, packet)
...
}

I'm using hadoop 2.7.3

答案1

得分: 2

我找到了原因。我使用的是WEBHDFS端口(50070),而不是Hadoop IPC端口(9000)。

英文:

I've found the reason. I was using the WEBHDFS Port (50070) instead of the Hadoop IPC Port (9000).

huangapple
  • 本文由 发表于 2017年8月7日 19:51:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/45546246.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定