beeswax_server.sh 2.3 KB

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