beeswax_server.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_HOME" ]; then
  21. echo "\$HADOOP_HOME must be specified" 1>&2
  22. exit 1
  23. fi
  24. echo \$HADOOP_HOME=$HADOOP_HOME
  25. if [ -z "$HIVE_CONF_DIR" ]; then
  26. echo "\$HIVE_CONF_DIR must be specified" 1>&2
  27. exit 1
  28. fi
  29. echo \$HIVE_CONF_DIR=$HIVE_CONF_DIR
  30. if [ -z "$HIVE_HOME" ]; then
  31. echo "\$HIVE_HOME not specified. Defaulting to $HIVE_CONF_DIR/.." 1>&2
  32. export HIVE_HOME=$HIVE_CONF_DIR/..
  33. exit 1
  34. fi
  35. echo \$HIVE_HOME=$HIVE_HOME
  36. BEESWAX_ROOT=$(dirname $0)
  37. BEESWAX_JAR=$BEESWAX_ROOT/java-lib/BeeswaxServer.jar
  38. HIVE_LIB=$HIVE_HOME/lib
  39. export HADOOP_CLASSPATH=$(find $HIVE_LIB -name "*.jar" | tr "\n" :)
  40. if [ -n "$HADOOP_EXTRA_CLASSPATH_STRING" ]; then
  41. export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HADOOP_EXTRA_CLASSPATH_STRING
  42. fi
  43. export HADOOP_OPTS="-Dlog4j.configuration=log4j.properties"
  44. echo \$HADOOP_CLASSPATH=$HADOOP_CLASSPATH
  45. echo \$HADOOP_OPTS=$HADOOP_OPTS
  46. # Use HADOOP_CONF_DIR to preprend to classpath, to avoid fb303 conflict,
  47. # and to force hive-default to correspond to the Hive version we have.
  48. # Because we are abusing HADOOP_CONF_DIR, we have to emulate its default
  49. # behavior here as well.
  50. if [ -z "$HADOOP_CONF_DIR" ]; then
  51. HADOOP_CONF_DIR="$HADOOP_HOME/conf"
  52. fi
  53. if [ -f $HADOOP_CONF_DIR/hadoop-env.sh ]; then
  54. . $HADOOP_CONF_DIR/hadoop-env.sh
  55. fi
  56. export HADOOP_CONF_DIR=$HIVE_CONF_DIR:$BEESWAX_ROOT/../../desktop/conf:$HADOOP_CONF_DIR
  57. echo \$HADOOP_CONF_DIR=$HADOOP_CONF_DIR
  58. # Note: I've had trouble running this with just "java -jar" with the classpath
  59. # determined with a seemingly appropriate find command.
  60. echo CWD=$(pwd)
  61. echo Executing $HADOOP_HOME/bin/hadoop jar $BEESWAX_JAR "$@"
  62. exec $HADOOP_HOME/bin/hadoop jar $BEESWAX_JAR "$@"