HdfsEditsViewer.apt.vm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. \[ {{{./index.html}Go Back}} \]
  20. %{toc|section=1|fromDepth=0}
  21. * Overview
  22. Offline Edits Viewer is a tool to parse the Edits log file. The current
  23. processors are mostly useful for conversion between different formats,
  24. including XML which is human readable and easier to edit than native
  25. binary format.
  26. The tool can parse the edits formats -18 (roughly Hadoop 0.19) and
  27. later. The tool operates on files only, it does not need Hadoop cluster
  28. to be running.
  29. Input formats supported:
  30. [[1]] <<binary>>: native binary format that Hadoop uses internally
  31. [[2]] <<xml>>: XML format, as produced by xml processor, used if filename
  32. has <<<.xml>>> (case insensitive) extension
  33. The Offline Edits Viewer provides several output processors (unless
  34. stated otherwise the output of the processor can be converted back to
  35. original edits file):
  36. [[1]] <<binary>>: native binary format that Hadoop uses internally
  37. [[2]] <<xml>>: XML format
  38. [[3]] <<stats>>: prints out statistics, this cannot be converted back to
  39. Edits file
  40. * Usage
  41. ----
  42. bash$ bin/hdfs oev -i edits -o edits.xml
  43. ----
  44. *-----------------------:-----------------------------------+
  45. | Flag | Description |
  46. *-----------------------:-----------------------------------+
  47. |[<<<-i>>> ; <<<--inputFile>>>] <input file> | Specify the input edits log file to
  48. | | process. Xml (case insensitive) extension means XML format otherwise
  49. | | binary format is assumed. Required.
  50. *-----------------------:-----------------------------------+
  51. |[<<-o>> ; <<--outputFile>>] <output file> | Specify the output filename, if the
  52. | | specified output processor generates one. If the specified file already
  53. | | exists, it is silently overwritten. Required.
  54. *-----------------------:-----------------------------------+
  55. |[<<-p>> ; <<--processor>>] <processor> | Specify the image processor to apply
  56. | | against the image file. Currently valid options are
  57. | | <<<binary>>>, <<<xml>>> (default) and <<<stats>>>.
  58. *-----------------------:-----------------------------------+
  59. |<<[-v ; --verbose] >> | Print the input and output filenames and pipe output of
  60. | | processor to console as well as specified file. On extremely large
  61. | | files, this may increase processing time by an order of magnitude.
  62. *-----------------------:-----------------------------------+
  63. |<<[-h ; --help] >> | Display the tool usage and help information and exit.
  64. *-----------------------:-----------------------------------+
  65. * Case study: Hadoop cluster recovery
  66. In case there is some problem with hadoop cluster and the edits file is
  67. corrupted it is possible to save at least part of the edits file that
  68. is correct. This can be done by converting the binary edits to XML,
  69. edit it manually and then convert it back to binary. The most common
  70. problem is that the edits file is missing the closing record (record
  71. that has opCode -1). This should be recognized by the tool and the XML
  72. format should be properly closed.
  73. If there is no closing record in the XML file you can add one after
  74. last correct record. Anything after the record with opCode -1 is
  75. ignored.
  76. Example of a closing record (with opCode -1):
  77. +----
  78. <RECORD>
  79. <OPCODE>-1</OPCODE>
  80. <DATA>
  81. </DATA>
  82. </RECORD>
  83. +----