Creating and Reading Files
Let's understand how clients can create files and read data from files in a distributed file system.
We'll cover the following
The clients can create and read files from the distributed file system using a GFS client library linked to the application that abstracts some implementation details.
For example, the applications can operate based on byte offsets of files. The client library can translate these byte offsets to the associated chunk index and communicates with the manager to retrieve the chunk handle for the provided chunk index and the location of associated chunk servers. Finally, It contacts the appropriate chunkserver (most likely the closest one) to retrieve the data.
Create operation
The manager node maintains the metadata about the filesystem. As a result, an operation that creates a file needs only to contact the manager node, which creates the file locally.
The manager node uses locking while creating new files to handle the concurrent requests safely. More specifically, a read lock is acquired on the directory name, and a write lock is acquired on the file name.
Read operation
The following illustration displays the workflow for a read operation:
Get hands-on with 1400+ tech skills courses.