org.apache.hadoop.hdfs.tools
Class DFSAdmin

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.fs.FsShell
          extended by org.apache.hadoop.hdfs.tools.DFSAdmin
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

@InterfaceAudience.Private
public class DFSAdmin
extends org.apache.hadoop.fs.FsShell

This class provides some DFS administrative access.


Field Summary
 
Fields inherited from class org.apache.hadoop.fs.FsShell
dateForm, fs, modifFmt
 
Constructor Summary
DFSAdmin()
          Construct a DFSAdmin object.
DFSAdmin(org.apache.hadoop.conf.Configuration conf)
          Construct a DFSAdmin object.
 
Method Summary
 int finalizeUpgrade()
          Command to ask the namenode to finalize previously performed upgrade.
static void main(String[] argv)
          main() has some simple utility methods.
 int metaSave(String[] argv, int idx)
          Dumps DFS data structures into specified file.
 int printTopology()
          Display each rack and the nodes assigned to that rack, as determined by the NameNode, in a hierarchical manner.
 int refreshNodes()
          Command to ask the namenode to reread the hosts and excluded hosts file.
 int refreshServiceAcl()
          Refresh the authorization policy on the NameNode.
 int refreshUserToGroupsMappings()
          Refresh the user-to-groups mappings on the NameNode.
 void report()
          Gives a report on how the FileSystem is doing.
 int restoreFaileStorage(String arg)
          Command to enable/disable/check restoring of failed storage replicas in the namenode.
 int run(String[] argv)
           
 int saveNamespace()
          Command to ask the namenode to save the namespace.
 void setSafeMode(String[] argv, int idx)
          Safe mode maintenance command.
 int upgradeProgress(String[] argv, int idx)
          Command to request current distributed upgrade status, a detailed status, or to force the upgrade to proceed.
 
Methods inherited from class org.apache.hadoop.fs.FsShell
byteDesc, close, getCurrentTrashDir, init, limitDecimalTo2
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
 

Constructor Detail

DFSAdmin

public DFSAdmin()
Construct a DFSAdmin object.


DFSAdmin

public DFSAdmin(org.apache.hadoop.conf.Configuration conf)
Construct a DFSAdmin object.

Method Detail

report

public void report()
            throws IOException
Gives a report on how the FileSystem is doing.

Throws:
IOException - if the filesystem does not exist.

setSafeMode

public void setSafeMode(String[] argv,
                        int idx)
                 throws IOException
Safe mode maintenance command. Usage: java DFSAdmin -safemode [enter | leave | get]

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.

saveNamespace

public int saveNamespace()
                  throws IOException
Command to ask the namenode to save the namespace. Usage: java DFSAdmin -saveNamespace

Throws:
IOException
See Also:
ClientProtocol.saveNamespace()

restoreFaileStorage

public int restoreFaileStorage(String arg)
                        throws IOException
Command to enable/disable/check restoring of failed storage replicas in the namenode. Usage: java DFSAdmin -restoreFailedStorage true|false|check

Throws:
IOException
See Also:
ClientProtocol.restoreFailedStorage(String arg)

refreshNodes

public int refreshNodes()
                 throws IOException
Command to ask the namenode to reread the hosts and excluded hosts file. Usage: java DFSAdmin -refreshNodes

Throws:
IOException

finalizeUpgrade

public int finalizeUpgrade()
                    throws IOException
Command to ask the namenode to finalize previously performed upgrade. Usage: java DFSAdmin -finalizeUpgrade

Throws:
IOException

upgradeProgress

public int upgradeProgress(String[] argv,
                           int idx)
                    throws IOException
Command to request current distributed upgrade status, a detailed status, or to force the upgrade to proceed. Usage: java DFSAdmin -upgradeProgress [status | details | force]

Throws:
IOException

metaSave

public int metaSave(String[] argv,
                    int idx)
             throws IOException
Dumps DFS data structures into specified file. Usage: java 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 accoured wile accessing the file or path.

printTopology

public int printTopology()
                  throws IOException
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

public int refreshServiceAcl()
                      throws IOException
Refresh the authorization policy on the NameNode.

Returns:
exitcode 0 on success, non-zero on failure
Throws:
IOException

refreshUserToGroupsMappings

public int refreshUserToGroupsMappings()
                                throws IOException
Refresh the user-to-groups mappings on the NameNode.

Returns:
exitcode 0 on success, non-zero on failure
Throws:
IOException

run

public int run(String[] argv)
        throws Exception
Specified by:
run in interface org.apache.hadoop.util.Tool
Overrides:
run in class org.apache.hadoop.fs.FsShell
Parameters:
argv - The parameters passed to this program.
Returns:
0 on success, non zero on error.
Throws:
Exception - if the filesystem does not exist.

main

public static void main(String[] argv)
                 throws Exception
main() has some simple utility methods.

Parameters:
argv - Command line parameters.
Throws:
Exception - if the filesystem does not exist.


Copyright © 2009 The Apache Software Foundation