ServerSetup.apt.vm 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.
  12. ---
  13. Hadoop HDFS over HTTP ${project.version} - Server Setup
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. Hadoop HDFS over HTTP ${project.version} - Server Setup
  18. \[ {{{./index.html}Go Back}} \]
  19. This page explains how to quickly setup HttpFS with Pseudo authentication
  20. against a Hadoop cluster with Pseudo authentication.
  21. * Requirements
  22. * Java 6+
  23. * Maven 3+
  24. * Install HttpFS
  25. +---+
  26. ~ $ tar xzf httpfs-${project.version}.tar.gz
  27. +---+
  28. * Configure HttpFS
  29. By default, HttpFS assumes that Hadoop configuration files
  30. (<<<core-site.xml & hdfs-site.xml>>>) are in the HttpFS
  31. configuration directory.
  32. If this is not the case, add to the <<<httpfs-site.xml>>> file the
  33. <<<httpfs.hadoop.config.dir>>> property set to the location
  34. of the Hadoop configuration directory.
  35. * Configure Hadoop
  36. Edit Hadoop <<<core-site.xml>>> and defined the Unix user that will
  37. run the HttpFS server as a proxyuser. For example:
  38. +---+
  39. ...
  40. <property>
  41. <name>hadoop.proxyuser.#HTTPFSUSER#.hosts</name>
  42. <value>httpfs-host.foo.com</value>
  43. </property>
  44. <property>
  45. <name>hadoop.proxyuser.#HTTPFSUSER#.groups</name>
  46. <value>*</value>
  47. </property>
  48. ...
  49. +---+
  50. IMPORTANT: Replace <<<#HTTPFSUSER#>>> with the Unix user that will
  51. start the HttpFS server.
  52. * Restart Hadoop
  53. You need to restart Hadoop for the proxyuser configuration ot become
  54. active.
  55. * Start/Stop HttpFS
  56. To start/stop HttpFS use HttpFS's bin/httpfs.sh script. For example:
  57. +---+
  58. httpfs-${project.version} $ bin/httpfs.sh start
  59. +---+
  60. NOTE: Invoking the script without any parameters list all possible
  61. parameters (start, stop, run, etc.). The <<<httpfs.sh>>> script is a wrapper
  62. for Tomcat's <<<catalina.sh>>> script that sets the environment variables
  63. and Java System properties required to run HttpFS server.
  64. * Test HttpFS is working
  65. +---+
  66. ~ $ curl -i "http://<HTTPFSHOSTNAME>:14000?user.name=babu&op=homedir"
  67. HTTP/1.1 200 OK
  68. Content-Type: application/json
  69. Transfer-Encoding: chunked
  70. {"homeDir":"http:\/\/<HTTPFS_HOST>:14000\/user\/babu"}
  71. +---+
  72. * Embedded Tomcat Configuration
  73. To configure the embedded Tomcat go to the <<<tomcat/conf>>>.
  74. HttpFS preconfigures the HTTP and Admin ports in Tomcat's <<<server.xml>>> to
  75. 14000 and 14001.
  76. Tomcat logs are also preconfigured to go to HttpFS's <<<logs/>>> directory.
  77. The following environment variables (which can be set in HttpFS's
  78. <<<conf/httpfs-env.sh>>> script) can be used to alter those values:
  79. * HTTPFS_HTTP_PORT
  80. * HTTPFS_ADMIN_PORT
  81. * HTTPFS_LOG
  82. * HttpFS Configuration
  83. HttpFS supports the following {{{./httpfs-default.html}configuration properties}}
  84. in the HttpFS's <<<conf/httpfs-site.xml>>> configuration file.
  85. * HttpFS over HTTPS (SSL)
  86. To configure HttpFS to work over SSL edit the {{httpfs-env.sh}} script in the
  87. configuration directory setting the {{HTTPFS_SSL_ENABLED}} to {{true}}.
  88. In addition, the following 2 properties may be defined (shown with default
  89. values):
  90. * HTTPFS_SSL_KEYSTORE_FILE=${HOME}/.keystore
  91. * HTTPFS_SSL_KEYSTORE_PASS=password
  92. In the HttpFS <<<tomcat/conf>>> directory, replace the <<<server.xml>>> file
  93. with the <<<ssl-server.xml>>> file.
  94. You need to create an SSL certificate for the HttpFS server. As the
  95. <<<httpfs>>> Unix user, using the Java <<<keytool>>> command to create the
  96. SSL certificate:
  97. +---+
  98. $ keytool -genkey -alias tomcat -keyalg RSA
  99. +---+
  100. You will be asked a series of questions in an interactive prompt. It will
  101. create the keystore file, which will be named <<.keystore>> and located in the
  102. <<<httpfs>>> user home directory.
  103. The password you enter for "keystore password" must match the value of the
  104. <<<HTTPFS_SSL_KEYSTORE_PASS>>> environment variable set in the
  105. <<<httpfs-env.sh>>> script in the configuration directory.
  106. The answer to "What is your first and last name?" (i.e. "CN") must be the
  107. hostname of the machine where the HttpFS Server will be running.
  108. Start HttpFS. It should work over HTTPS.
  109. Using the Hadoop <<<FileSystem>>> API or the Hadoop FS shell, use the
  110. <<<swebhdfs://>>> scheme. Make sure the JVM is picking up the truststore
  111. containing the public key of the SSL certificate if using a self-signed
  112. certificate.
  113. \[ {{{./index.html}Go Back}} \]