Package org.apache.hadoop.hdfs.tools
Class DFSAdmin
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FsShell
org.apache.hadoop.hdfs.tools.DFSAdmin
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
@Private
public class DFSAdmin
extends org.apache.hadoop.fs.FsShell
This class provides some DFS administrative access shell commands.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.fs.FsShell
org.apache.hadoop.fs.FsShell.Help, org.apache.hadoop.fs.FsShell.Usage -
Field Summary
FieldsFields inherited from class org.apache.hadoop.fs.FsShell
commandFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallowSnapshot(String[] argv) Allow snapshot on a directory.voiddisallowSnapshot(String[] argv) Disallow snapshot on a directory.intfetchImage(String[] argv, int idx) Download the most recent fsimage from the name node, and save it to a local file in the given directory.intCommand to ask the namenode to finalize previously performed upgrade.intgenericRefresh(String[] argv, int i) intgetBalancerBandwidth(String[] argv, int idx) Command to get balancer bandwidth for the given datanode.protected org.apache.hadoop.hdfs.DistributedFileSystemgetDFS()intCommand to get the upgrade status of each namenode in the nameservice.intlistOpenFiles(String[] argv) Command to list all the open files currently managed by NameNode.static voidmain() has some simple utility methods.intDumps DFS data structures into specified file.intDisplay each rack and the nodes assigned to that rack, as determined by the NameNode, in a hierarchical manner.voidprovisionSnapshotTrash(String[] argv) Provision trash root in a snapshottable directory.intintintCommand to ask the namenode to reread the hosts and excluded hosts file.intRefresh the authorization policy on theNameNode.intrefreshSuperUserGroupsConfigurationNameNode.intRefresh the user-to-groups mappings on theNameNode.voidGives a report on how the FileSystem is doing.intCommand to enable/disable/check restoring of failed storage replicas in the namenode.intintintsaveNamespace(String[] argv) Command to ask the namenode to save the namespace.intsetBalancerBandwidth(String[] argv, int idx) Command to ask the active namenode to set the balancer bandwidth.voidsetSafeMode(String[] argv, int idx) Safe mode maintenance command.inttriggerBlockReport(String[] argv) intUpgrade command to get the status of upgrade or ask NameNode to finalize the previously performed upgrade.Methods inherited from class org.apache.hadoop.fs.FsShell
close, getCurrentTrashDir, getCurrentTrashDir, getFS, getHelp, getTrash, getUsagePrefix, init, newShellInstance, registerCommandsMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
DFS_REPORT_ARGS
-
-
Constructor Details
-
DFSAdmin
public DFSAdmin()Construct a DFSAdmin object. -
DFSAdmin
public DFSAdmin(org.apache.hadoop.conf.Configuration conf) Construct a DFSAdmin object.
-
-
Method Details
-
getDFS
- Throws:
IOException
-
report
Gives a report on how the FileSystem is doing.- Throws:
IOException- if the filesystem does not exist.
-
setSafeMode
Safe mode maintenance command. Usage: hdfs dfsadmin -safemode [enter | leave | get | wait | forceExit]- Parameters:
argv- List of of command line parameters.idx- The index of the command that is being processed.- Throws:
IOException- if the filesystem does not exist.
-
triggerBlockReport
- Throws:
IOException
-
allowSnapshot
Allow snapshot on a directory. Usage: hdfs dfsadmin -allowSnapshot snapshotDir- Parameters:
argv- List of of command line parameters.- Throws:
IOException
-
disallowSnapshot
Disallow snapshot on a directory. Usage: hdfs dfsadmin -disallowSnapshot snapshotDir- Parameters:
argv- List of of command line parameters.- Throws:
IOException
-
provisionSnapshotTrash
Provision trash root in a snapshottable directory. Usage: hdfs dfsadmin -provisionSnapshotTrash snapshotDir hdfs dfsadmin -provisionSnapshotTrash -all- Parameters:
argv- List of of command line parameters.- Throws:
IOException
-
saveNamespace
Command to ask the namenode to save the namespace. Usage: hdfs dfsadmin -saveNamespace- Throws:
IOException- See Also:
-
ClientProtocol.saveNamespace(long, long)
-
rollEdits
- Throws:
IOException
-
restoreFailedStorage
Command to enable/disable/check restoring of failed storage replicas in the namenode. Usage: hdfs dfsadmin -restoreFailedStorage true|false|check- Throws:
IOException- See Also:
-
ClientProtocol.restoreFailedStorage(String arg)
-
refreshNodes
Command to ask the namenode to reread the hosts and excluded hosts file. Usage: hdfs dfsadmin -refreshNodes- Throws:
IOException
-
listOpenFiles
Command to list all the open files currently managed by NameNode. Usage: hdfs dfsadmin -listOpenFiles- Parameters:
argv-- Throws:
IOException
-
setBalancerBandwidth
Command to ask the active namenode to set the balancer bandwidth. Usage: hdfs dfsadmin -setBalancerBandwidth bandwidth- Parameters:
argv- List of of command line parameters.idx- The index of the command that is being processed.- Throws:
IOException
-
getBalancerBandwidth
Command to get balancer bandwidth for the given datanode. Usage: hdfs dfsadmin -getBalancerBandwidth <datanode_host:ipc_port>- Parameters:
argv- List of of command line parameters.idx- The index of the command that is being processed.- Throws:
IOException
-
fetchImage
Download the most recent fsimage from the name node, and save it to a local file in the given directory.- Parameters:
argv- List of of command line parameters.idx- The index of the command that is being processed.- Returns:
- an exit code indicating success or failure.
- Throws:
IOException
-
finalizeUpgrade
Command to ask the namenode to finalize previously performed upgrade. Usage: hdfs dfsadmin -finalizeUpgrade- Throws:
IOException
-
getUpgradeStatus
Command to get the upgrade status of each namenode in the nameservice. Usage: hdfs dfsadmin -upgrade query- Throws:
IOException
-
upgrade
Upgrade command to get the status of upgrade or ask NameNode to finalize the previously performed upgrade. Usage: hdfs dfsadmin -upgrade [query | finalize]- Throws:
IOException
-
metaSave
Dumps DFS data structures into specified file. Usage: hdfs dfsadmin -metasave filename- Parameters:
argv- List of of command line parameters.idx- The index of the command that is being processed.- Throws:
IOException- if an error occurred while accessing the file or path.
-
printTopology
Display each rack and the nodes assigned to that rack, as determined by the NameNode, in a hierarchical manner. The nodes and racks are sorted alphabetically.- Throws:
IOException- If an error while getting datanode report
-
refreshServiceAcl
Refresh the authorization policy on theNameNode.- Returns:
- exitcode 0 on success, non-zero on failure
- Throws:
IOException
-
refreshUserToGroupsMappings
Refresh the user-to-groups mappings on theNameNode.- Returns:
- exitcode 0 on success, non-zero on failure
- Throws:
IOException
-
refreshSuperUserGroupsConfiguration
refreshSuperUserGroupsConfigurationNameNode.- Returns:
- exitcode 0 on success, non-zero on failure
- Throws:
IOException
-
refreshCallQueue
- Throws:
IOException
-
reconfig
- Throws:
IOExceptionInterruptedException
-
genericRefresh
- Throws:
IOException
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Overrides:
runin classorg.apache.hadoop.fs.FsShell- Parameters:
argv- The parameters passed to this program.- Returns:
- 0 on success, non zero on error.
-
main
main() has some simple utility methods.- Parameters:
argv- Command line parameters.- Throws:
Exception- if the filesystem does not exist.
-