beeswax_server.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. # Runs Beeswax server.
  19. set -o errexit
  20. if [ -z "$HADOOP_CONF_DIR" ]; then
  21. echo "\$HADOOP_CONF_DIR must be specified" 1>&2
  22. exit 1
  23. fi
  24. echo \$HADOOP_HOME=$HADOOP_HOME
  25. if [ -z "$HADOOP_BIN" ]; then
  26. echo "\$HADOOP_BIN must be specified" 1>&2
  27. exit 1
  28. fi
  29. echo \$HADOOP_BIN=$HADOOP_BIN
  30. if [ -z "$HIVE_CONF_DIR" ]; then
  31. echo "\$HIVE_CONF_DIR must be specified" 1>&2
  32. exit 1
  33. fi
  34. echo \$HIVE_CONF_DIR=$HIVE_CONF_DIR
  35. if [ -z "$HIVE_HOME" ]; then
  36. echo "\$HIVE_HOME not specified. Defaulting to $HIVE_CONF_DIR/.." 1>&2
  37. export HIVE_HOME=$HIVE_CONF_DIR/..
  38. exit 1
  39. fi
  40. echo \$HIVE_HOME=$HIVE_HOME
  41. BEESWAX_ROOT=$(dirname $0)
  42. BEESWAX_JAR=$BEESWAX_ROOT/java-lib/BeeswaxServer.jar
  43. HIVE_LIB=$HIVE_HOME/lib
  44. export HADOOP_CLASSPATH=$(find $HADOOP_HOME -name hue-plugins*.jar | tr "\n" :):$(find $HIVE_LIB -name "*.jar" | tr "\n" :)
  45. if [ -n "$HADOOP_EXTRA_CLASSPATH_STRING" ]; then
  46. export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HADOOP_EXTRA_CLASSPATH_STRING
  47. fi
  48. export HADOOP_OPTS="-Dlog4j.configuration=log4j.properties"
  49. echo \$HADOOP_CLASSPATH=$HADOOP_CLASSPATH
  50. echo \$HADOOP_OPTS=$HADOOP_OPTS
  51. # Use HADOOP_CONF_DIR to preprend to classpath, to avoid fb303 conflict,
  52. # and to force hive-default to correspond to the Hive version we have.
  53. # Because we are abusing HADOOP_CONF_DIR, we have to emulate its default
  54. # behavior here as well.
  55. if [ -f $HADOOP_CONF_DIR/hadoop-env.sh ]; then
  56. . $HADOOP_CONF_DIR/hadoop-env.sh
  57. fi
  58. export HADOOP_CONF_DIR=$HIVE_CONF_DIR:$HADOOP_CONF_DIR
  59. echo \$HADOOP_CONF_DIR=$HADOOP_CONF_DIR
  60. echo \$HADOOP_MAPRED_HOME=$HADOOP_MAPRED_HOME
  61. # Note: I've had trouble running this with just "java -jar" with the classpath
  62. # determined with a seemingly appropriate find command.
  63. echo CWD=$(pwd)
  64. echo Executing $HADOOP_BIN jar $BEESWAX_JAR "$@"
  65. exec $HADOOP_BIN jar $BEESWAX_JAR "$@"