We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89f1d88 commit fa54478Copy full SHA for fa54478
cmd/hdfs/main.go
@@ -3,7 +3,9 @@ package main
3
import (
4
"errors"
5
"fmt"
6
+ "net"
7
"os"
8
+ "time"
9
10
"github.com/colinmarc/hdfs"
11
"github.com/pborman/getopt"
@@ -199,6 +201,16 @@ func getClient(namenode string) (*hdfs.Client, error) {
199
201
}
200
202
203
204
+ // Set some basic defaults.
205
+ dialFunc := (&net.Dialer{
206
+ Timeout: 5 * time.Second,
207
+ KeepAlive: 5 * time.Second,
208
+ DualStack: true,
209
+ }).DialContext
210
+
211
+ options.NamenodeDialFunc = dialFunc
212
+ options.DatanodeDialFunc = dialFunc
213
214
c, err := hdfs.NewClient(options)
215
if err != nil {
216
return nil, fmt.Errorf("Couldn't connect to namenode: %s", err)
0 commit comments