Haven
Haven

Reputation: 7966

What is the exactly use of defaultFs

I am new to Hadoop, I find the defaultFs in core-site.xml, according to official definition:

the default path prefix used by the Hadoop FS client when none is given

Could anybody explain a little bit more about it?

For example I use a hdfs Java API in local, I guess I am the client, so does it only used in setting the connect address like "hdfs://defaultFsAddress:8020/, any other usage of it?

Upvotes: 1

Views: 2215

Answers (2)

Sharan
Sharan

Reputation: 114

fs.defaultFS in core-site.xml - gives the datanode address of namenode.

Datanode looks for the address here for the namenode and tries to contact it using RPC.

Upvotes: 1

OneCricketeer
OneCricketeer

Reputation: 191983

The name of the default file system. A URI whose scheme and authority determine the FileSystem implementation.

Default value: file:///


Its default value is the local filesystem, so changing it to hdfs://<address>:<port>/ will specify that you are connecting to HDFS instead.

For example,

hdfs dfs -ls /

would initially show the local root filesystem without changing the value. HDFS is a file abstraction over a cluster, so its root is not the same as the local system's. You need to change the value in order to create the distributed file system.

You can see all other core-site defaults here.

Upvotes: 3

Related Questions