HdfsEditsViewer.apt.vm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. Offline Edits Viewer Guide
  14. ---
  15. Erik Steffl
  16. ---
  17. ${maven.build.timestamp}
  18. Offline Edits Viewer Guide
  19. %{toc|section=1|fromDepth=0}
  20. * Overview
  21. Offline Edits Viewer is a tool to parse the Edits log file. The current
  22. processors are mostly useful for conversion between different formats,
  23. including XML which is human readable and easier to edit than native
  24. binary format.
  25. The tool can parse the edits formats -18 (roughly Hadoop 0.19) and
  26. later. The tool operates on files only, it does not need Hadoop cluster
  27. to be running.
  28. Input formats supported:
  29. [[1]] <<binary>>: native binary format that Hadoop uses internally
  30. [[2]] <<xml>>: XML format, as produced by xml processor, used if filename
  31. has <<<.xml>>> (case insensitive) extension
  32. The Offline Edits Viewer provides several output processors (unless
  33. stated otherwise the output of the processor can be converted back to
  34. original edits file):
  35. [[1]] <<binary>>: native binary format that Hadoop uses internally
  36. [[2]] <<xml>>: XML format
  37. [[3]] <<stats>>: prints out statistics, this cannot be converted back to
  38. Edits file
  39. * Usage
  40. ----
  41. bash$ bin/hdfs oev -i edits -o edits.xml
  42. ----
  43. *-----------------------:-----------------------------------+
  44. | Flag | Description |
  45. *-----------------------:-----------------------------------+
  46. |[<<<-i>>> ; <<<--inputFile>>>] <input file> | Specify the input edits log file to
  47. | | process. Xml (case insensitive) extension means XML format otherwise
  48. | | binary format is assumed. Required.
  49. *-----------------------:-----------------------------------+
  50. |[<<-o>> ; <<--outputFile>>] <output file> | Specify the output filename, if the
  51. | | specified output processor generates one. If the specified file already
  52. | | exists, it is silently overwritten. Required.
  53. *-----------------------:-----------------------------------+
  54. |[<<-p>> ; <<--processor>>] <processor> | Specify the image processor to apply
  55. | | against the image file. Currently valid options are
  56. | | <<<binary>>>, <<<xml>>> (default) and <<<stats>>>.
  57. *-----------------------:-----------------------------------+
  58. |<<[-v ; --verbose] >> | Print the input and output filenames and pipe output of
  59. | | processor to console as well as specified file. On extremely large
  60. | | files, this may increase processing time by an order of magnitude.
  61. *-----------------------:-----------------------------------+
  62. |<<[-h ; --help] >> | Display the tool usage and help information and exit.
  63. *-----------------------:-----------------------------------+
  64. * Case study: Hadoop cluster recovery
  65. In case there is some problem with hadoop cluster and the edits file is
  66. corrupted it is possible to save at least part of the edits file that
  67. is correct. This can be done by converting the binary edits to XML,
  68. edit it manually and then convert it back to binary. The most common
  69. problem is that the edits file is missing the closing record (record
  70. that has opCode -1). This should be recognized by the tool and the XML
  71. format should be properly closed.
  72. If there is no closing record in the XML file you can add one after
  73. last correct record. Anything after the record with opCode -1 is
  74. ignored.
  75. Example of a closing record (with opCode -1):
  76. +----
  77. <RECORD>
  78. <OPCODE>-1</OPCODE>
  79. <DATA>
  80. </DATA>
  81. </RECORD>
  82. +----