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

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

Why does HDFS throw unexpected EOF error using golang?

问题

以下是翻译好的内容:

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/colinmarc/hdfs"
  5. )
  6. func main() {
  7. client, err := hdfs.New("192.168.0.38:50070")
  8. fs, err := client.ReadDir("/")
  9. fmt.Println(err)
  10. fmt.Println(fs)
  11. }
  12. err is unexpected EOF
  13. And I found that the error occurs in
  14. func (c *NamenodeConnection) readResponse(method string, resp proto.Message) error {
  15. ...
  16. _, err = io.ReadFull(c.conn, packet)
  17. ...
  18. }
  19. I'm using hadoop 2.7.3

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

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

我正在使用hadoop 2.7.3

英文:
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/colinmarc/hdfs"
  5. )
  6. func main() {
  7. client, err := hdfs.New("192.168.0.38:50070")
  8. fs, err := client.ReadDir("/")
  9. fmt.Println(err)
  10. fmt.Println(fs)
  11. }

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

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

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:

确定