ServerSetup.md.vm 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!---
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License. See accompanying LICENSE file.
  11. -->
  12. Hadoop HDFS over HTTP - Server Setup
  13. ====================================
  14. This page explains how to quickly setup HttpFS with Pseudo authentication against a Hadoop cluster with Pseudo authentication.
  15. Install HttpFS
  16. --------------
  17. ~ $ tar xzf httpfs-${project.version}.tar.gz
  18. Configure HttpFS
  19. ----------------
  20. By default, HttpFS assumes that Hadoop configuration files (`core-site.xml & hdfs-site.xml`) are in the HttpFS configuration directory.
  21. If this is not the case, add to the `httpfs-site.xml` file the `httpfs.hadoop.config.dir` property set to the location of the Hadoop configuration directory.
  22. Configure Hadoop
  23. ----------------
  24. Edit Hadoop `core-site.xml` and defined the Unix user that will run the HttpFS server as a proxyuser. For example:
  25. ```xml
  26. <property>
  27. <name>hadoop.proxyuser.#HTTPFSUSER#.hosts</name>
  28. <value>httpfs-host.foo.com</value>
  29. </property>
  30. <property>
  31. <name>hadoop.proxyuser.#HTTPFSUSER#.groups</name>
  32. <value>*</value>
  33. </property>
  34. ```
  35. IMPORTANT: Replace `#HTTPFSUSER#` with the Unix user that will start the HttpFS server.
  36. Restart Hadoop
  37. --------------
  38. You need to restart Hadoop for the proxyuser configuration to become active.
  39. Start/Stop HttpFS
  40. -----------------
  41. To start/stop HttpFS use HttpFS's sbin/httpfs.sh script. For example:
  42. $ sbin/httpfs.sh start
  43. NOTE: Invoking the script without any parameters list all possible parameters (start, stop, run, etc.). The `httpfs.sh` script is a wrapper for Tomcat's `catalina.sh` script that sets the environment variables and Java System properties required to run HttpFS server.
  44. Test HttpFS is working
  45. ----------------------
  46. $ curl -sS 'http://<HTTPFSHOSTNAME>:14000/webhdfs/v1?op=gethomedirectory&user.name=hdfs'
  47. {"Path":"\/user\/hdfs"}
  48. Embedded Tomcat Configuration
  49. -----------------------------
  50. To configure the embedded Tomcat go to the `tomcat/conf`.
  51. HttpFS preconfigures the HTTP and Admin ports in Tomcat's `server.xml` to 14000 and 14001.
  52. Tomcat logs are also preconfigured to go to HttpFS's `logs/` directory.
  53. HttpFS default value for the maxHttpHeaderSize parameter in Tomcat's `server.xml` is set to 65536 by default.
  54. The following environment variables (which can be set in HttpFS's `etc/hadoop/httpfs-env.sh` script) can be used to alter those values:
  55. * HTTPFS\_HTTP\_PORT
  56. * HTTPFS\_ADMIN\_PORT
  57. * HADOOP\_LOG\_DIR
  58. * HTTPFS\_MAX\_HTTP\_HEADER\_SIZE
  59. HttpFS Configuration
  60. --------------------
  61. HttpFS supports the following [configuration properties](./httpfs-default.html) in the HttpFS's `etc/hadoop/httpfs-site.xml` configuration file.
  62. HttpFS over HTTPS (SSL)
  63. -----------------------
  64. To configure HttpFS to work over SSL edit the [httpfs-env.sh](#httpfs-env.sh) script in the configuration directory setting the [HTTPFS\_SSL\_ENABLED](#HTTPFS_SSL_ENABLED) to [true](#true).
  65. In addition, the following 2 properties may be defined (shown with default values):
  66. * HTTPFS\_SSL\_KEYSTORE\_FILE=$HOME/.keystore
  67. * HTTPFS\_SSL\_KEYSTORE\_PASS=password
  68. In the HttpFS `tomcat/conf` directory, replace the `server.xml` file with the `ssl-server.xml` file.
  69. You need to create an SSL certificate for the HttpFS server. As the `httpfs` Unix user, using the Java `keytool` command to create the SSL certificate:
  70. $ keytool -genkey -alias tomcat -keyalg RSA
  71. You will be asked a series of questions in an interactive prompt. It will create the keystore file, which will be named **.keystore** and located in the `httpfs` user home directory.
  72. The password you enter for "keystore password" must match the value of the `HTTPFS_SSL_KEYSTORE_PASS` environment variable set in the `httpfs-env.sh` script in the configuration directory.
  73. The answer to "What is your first and last name?" (i.e. "CN") must be the hostname of the machine where the HttpFS Server will be running.
  74. Start HttpFS. It should work over HTTPS.
  75. Using the Hadoop `FileSystem` API or the Hadoop FS shell, use the `swebhdfs://` scheme. Make sure the JVM is picking up the truststore containing the public key of the SSL certificate if using a self-signed certificate.
  76. Set environment variable `HTTPFS_SSL_CLIENT_AUTH` to change client
  77. authentication. The default is `false`. See `clientAuth` in
  78. [Tomcat 6.0 SSL Support](https://tomcat.apache.org/tomcat-6.0-doc/config/http.html#SSL_Support).
  79. Set environment variable `HTTPFS_SSL_ENABLED_PROTOCOLS` to specify a list of
  80. enabled SSL protocols. The default list includes `TLSv1`, `TLSv1.1`,
  81. `TLSv1.2`, and `SSLv2Hello`. See `sslEnabledProtocols` in
  82. [Tomcat 6.0 SSL Support](https://tomcat.apache.org/tomcat-6.0-doc/config/http.html#SSL_Support).
  83. In order to support some old SSL clients, the default encryption ciphers
  84. include a few relatively weaker ciphers. Set environment variable
  85. `HTTPFS_SSL_CIPHERS` to override. The value is a comma separated list of
  86. ciphers in [Tomcat Wiki](https://wiki.apache.org/tomcat/Security/Ciphers).