public class DistributedFileSystem extends FileSystem
| 限定符和类型 | 类和说明 |
|---|---|
static class |
DistributedFileSystem.DiskStatus |
FileSystem.StatisticsFS_DEFAULT_NAME_KEY, LOG, statistics| 构造器和说明 |
|---|
DistributedFileSystem() |
DistributedFileSystem(InetSocketAddress namenode,
Configuration conf)
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress)
This optional operation is not yet supported.
|
void |
cancelDelegationToken(Token<DelegationTokenIdentifier> token)
已过时。
Use Token.cancel instead.
|
void |
close()
No more filesystem operations are needed.
|
void |
concat(Path trg,
Path[] psrcs)
Move blocks from srcs to trg and delete srcs afterwards.
|
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Opens an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
FSDataOutputStream |
createNonRecursive(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Same as create(), except fails if parent directory doesn't already exist.
|
boolean |
delete(Path f)
已过时。
|
boolean |
delete(Path f,
boolean recursive)
requires a boolean check to delete a non
empty directory recursively.
|
UpgradeStatusReport |
distributedUpgradeProgress(FSConstants.UpgradeAction action) |
void |
finalizeUpgrade()
Finalize previously upgraded files system state.
|
DFSClient |
getClient() |
ContentSummary |
getContentSummary(Path f)
Return the
ContentSummary of a given Path. |
long |
getCorruptBlocksCount()
Returns count of blocks with at least one replica marked corrupt.
|
DatanodeInfo[] |
getDataNodeStats()
Return statistics for each datanode.
|
long |
getDefaultBlockSize()
Return the number of bytes that large input files should be optimally
be split into to minimize i/o time.
|
protected int |
getDefaultPort()
Get the default port for this file system.
|
short |
getDefaultReplication()
Get the default replication.
|
Token<DelegationTokenIdentifier> |
getDelegationToken(String renewer)
Get a new delegation token for this file system.
|
Token<DelegationTokenIdentifier> |
getDelegationToken(Text renewer)
已过时。
|
DistributedFileSystem.DiskStatus |
getDiskStatus()
Return the disk usage of the filesystem, including total capacity,
used space, and remaining space
|
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len)
Return an array containing hostnames, offset and size of
portions of the given file.
|
MD5MD5CRC32FileChecksum |
getFileChecksum(Path f)
Get the checksum of a file.
|
FileStatus |
getFileStatus(Path f)
Returns the stat information about the file.
|
Path |
getHomeDirectory()
Return the current user's home directory in this filesystem.
|
long |
getMissingBlocksCount()
Returns count of blocks with no good replicas left.
|
String |
getName()
已过时。
|
long |
getRawCapacity()
Return the total raw capacity of the filesystem, disregarding
replication .
|
long |
getRawUsed()
Return the total raw used space in the filesystem, disregarding
replication .
|
long |
getUnderReplicatedBlocksCount()
Returns count of blocks with one of more replica missing.
|
URI |
getUri()
Returns a URI whose scheme and authority identify this FileSystem.
|
Path |
getWorkingDirectory()
Get the current working directory for the given file system
|
void |
initialize(URI uri,
Configuration conf)
Called after a new FileSystem instance is constructed.
|
boolean |
isFileClosed(Path src)
Get the close status of a file
|
static boolean |
isHealthy(URI uri)
Is the HDFS healthy?
|
FileStatus[] |
listStatus(Path p)
List all the entries of a directory
Note that this operation is not atomic for a large directory.
|
void |
metaSave(String pathname) |
boolean |
mkdirs(Path f,
FsPermission permission)
Make the given file and all non-existent parents into
directories.
|
FSDataInputStream |
open(Path f,
int bufferSize)
Opens an FSDataInputStream at the indicated Path.
|
boolean |
recoverLease(Path f)
Start the lease recovery of a file
|
void |
refreshNodes()
Refreshes the list of hosts and excluded hosts from the configured
files.
|
boolean |
rename(Path src,
Path dst)
Rename files/dirs
|
long |
renewDelegationToken(Token<DelegationTokenIdentifier> token)
已过时。
Use Token.renew instead.
|
boolean |
reportChecksumFailure(Path f,
FSDataInputStream in,
long inPos,
FSDataInputStream sums,
long sumsPos)
We need to find the blocks that didn't match.
|
void |
saveNamespace()
Save namespace image.
|
void |
setBalancerBandwidth(long bandwidth)
Requests the namenode to tell all datanodes to use a new, non-persistent
bandwidth value for dfs.balance.bandwidthPerSec.
|
void |
setOwner(Path p,
String username,
String groupname)
Set owner of a path (i.e. a file or a directory).
|
void |
setPermission(Path p,
FsPermission permission)
Set permission of a path.
|
void |
setQuota(Path src,
long namespaceQuota,
long diskspaceQuota)
Set a directory's quotas
|
boolean |
setReplication(Path src,
short replication)
Set replication for an existing file.
|
boolean |
setSafeMode(FSConstants.SafeModeAction action)
Enter, leave or get safe mode.
|
void |
setTimes(Path p,
long mtime,
long atime)
Set access time of a file
|
void |
setVerifyChecksum(boolean verifyChecksum)
Set the verify checksum flag.
|
void |
setWorkingDirectory(Path dir)
Set the current working directory for the given file system.
|
String |
toString() |
addFileSystemForTesting, append, append, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, deleteOnExit, exists, get, get, get, getAllStatistics, getBlockSize, getCacheSize, getCanonicalServiceName, getCanonicalUri, getDefaultBlockSize, getDefaultReplication, getDefaultUri, getLength, getLocal, getNamed, getReplication, getStatistics, getStatistics, getUsed, globStatus, globStatus, isDirectory, isFile, listStatus, listStatus, listStatus, makeQualified, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, open, printStatistics, processDeleteOnExit, setDefaultUri, setDefaultUri, startLocalOutputgetConf, setConfpublic DistributedFileSystem()
public DistributedFileSystem(InetSocketAddress namenode, Configuration conf) throws IOException
IOExceptionpublic String getName()
getName 在类中 FileSystempublic URI getUri()
FileSystemgetUri 在类中 FileSystempublic void initialize(URI uri, Configuration conf) throws IOException
FileSysteminitialize 在类中 FileSystemuri - a uri whose authority section names the host, port, etc.
for this FileSystemconf - the configurationIOExceptionpublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory 在类中 FileSystempublic long getDefaultBlockSize()
FileSystemgetDefaultBlockSize 在类中 FileSystempublic short getDefaultReplication()
FileSystemgetDefaultReplication 在类中 FileSystempublic void setWorkingDirectory(Path dir)
FileSystemsetWorkingDirectory 在类中 FileSystempublic Path getHomeDirectory()
getHomeDirectory 在类中 FileSystempublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException
FileSystemgetFileBlockLocations 在类中 FileSystemIOExceptionpublic void setVerifyChecksum(boolean verifyChecksum)
FileSystemsetVerifyChecksum 在类中 FileSystempublic FSDataInputStream open(Path f, int bufferSize) throws IOException
FileSystemopen 在类中 FileSystemf - the file name to openbufferSize - the size of the buffer to be used.IOExceptionpublic boolean isFileClosed(Path src) throws IOException
src - The path to the fileFileNotFoundException - if the file does not exist.IOException - If an I/O error occurredpublic boolean recoverLease(Path f) throws IOException
f - a fileIOException - if an error occurspublic FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
append 在类中 FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.IOExceptionpublic FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FileSystemcreate 在类中 FileSystemf - the file name to openoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.IOExceptionFileSystem.setPermission(Path, FsPermission)public FSDataOutputStream createNonRecursive(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
createNonRecursive 在类中 FileSystemf - the file name to openoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.IOExceptioncreate(Path, FsPermission, boolean, int, short, long, Progressable)public boolean setReplication(Path src, short replication) throws IOException
FileSystemsetReplication 在类中 FileSystemsrc - file namereplication - new replicationIOExceptionpublic void concat(Path trg, Path[] psrcs) throws IOException
concat 在类中 FileSystemtrg - existing file to append topsrcs - list of files (same block size, same replication)IOExceptionpublic boolean rename(Path src, Path dst) throws IOException
rename 在类中 FileSystemIOException@Deprecated public boolean delete(Path f) throws IOException
delete 在类中 FileSystemIOExceptionpublic boolean delete(Path f, boolean recursive) throws IOException
delete 在类中 FileSystemf - the path to delete.recursive - if path is a directory and set to
true, the directory is deleted else throws an exception. In
case of a file the recursive can be set to either true or false.IOExceptionpublic ContentSummary getContentSummary(Path f) throws IOException
ContentSummary of a given Path.getContentSummary 在类中 FileSystemIOExceptionpublic void setQuota(Path src, long namespaceQuota, long diskspaceQuota) throws IOException
public FileStatus[] listStatus(Path p) throws IOException
listStatus 在类中 FileSystemp - given pathIOExceptionpublic boolean mkdirs(Path f, FsPermission permission) throws IOException
FileSystemmkdirs 在类中 FileSystemIOExceptionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 FileSystemIOExceptionpublic DFSClient getClient()
public DistributedFileSystem.DiskStatus getDiskStatus() throws IOException
IOExceptionpublic long getRawCapacity()
throws IOException
IOExceptionpublic long getRawUsed()
throws IOException
IOExceptionpublic long getMissingBlocksCount()
throws IOException
IOExceptionpublic long getUnderReplicatedBlocksCount()
throws IOException
IOExceptionpublic long getCorruptBlocksCount()
throws IOException
IOExceptionpublic DatanodeInfo[] getDataNodeStats() throws IOException
IOExceptionpublic boolean setSafeMode(FSConstants.SafeModeAction action) throws IOException
public void saveNamespace()
throws AccessControlException,
IOException
public void refreshNodes()
throws IOException
IOExceptionpublic void finalizeUpgrade()
throws IOException
IOExceptionpublic UpgradeStatusReport distributedUpgradeProgress(FSConstants.UpgradeAction action) throws IOException
IOExceptionpublic void metaSave(String pathname) throws IOException
IOExceptionpublic boolean reportChecksumFailure(Path f, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos)
public FileStatus getFileStatus(Path f) throws IOException
getFileStatus 在类中 FileSystemf - The path we want information fromFileNotFoundException - if the file does not exist.IOExceptionpublic MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException
getFileChecksum 在类中 FileSystemf - The file pathIOExceptionpublic void setPermission(Path p, FsPermission permission) throws IOException
setPermission 在类中 FileSystemIOExceptionpublic void setOwner(Path p, String username, String groupname) throws IOException
setOwner 在类中 FileSystemp - The pathusername - If it is null, the original username remains unchanged.groupname - If it is null, the original groupname remains unchanged.IOExceptionpublic void setTimes(Path p, long mtime, long atime) throws IOException
setTimes 在类中 FileSystemp - The pathmtime - Set the modification time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set modification time.atime - Set the access time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set access time.IOExceptionprotected int getDefaultPort()
FileSystemgetDefaultPort 在类中 FileSystempublic Token<DelegationTokenIdentifier> getDelegationToken(String renewer) throws IOException
FileSystemgetDelegationToken 在类中 FileSystemrenewer - the account name that is allowed to renew the token.IOException@Deprecated public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer) throws IOException
renewer - Name of the designated renewer for the tokenIOExceptionpublic long renewDelegationToken(Token<DelegationTokenIdentifier> token) throws SecretManager.InvalidToken, IOException
token - delegation token obtained earlierIOExceptionSecretManager.InvalidTokenpublic void cancelDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException
token - delegation tokenIOExceptionpublic void setBalancerBandwidth(long bandwidth)
throws IOException
bandwidth - Blanacer bandwidth in bytes per second for all datanodes.IOExceptionpublic static boolean isHealthy(URI uri)
uri - the HDFS URI. Note that the URI path is ignored.Copyright © 2009 The Apache Software Foundation