Skip to content

Commit

Permalink
auto configure heapsize on ECS (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoluri authored Feb 14, 2019
1 parent da94b77 commit ca500ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

### Added
- Auto configure Hive metastore heapsize when running on ECS.

### Changed
- Replace EMRFS with hadoop-aws S3A libraries
- Replace EMRFS with hadoop-aws S3A libraries.

## [1.0.0] - 2018-10-31

Expand Down
9 changes: 8 additions & 1 deletion files/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,12 @@ export AUX_CLASSPATH="/usr/share/java/mariadb-connector-java.jar"
[[ ! -z $RANGER_POLICY_MANAGER_URL ]] && export AUX_CLASSPATH="$AUX_CLASSPATH:/usr/lib/apiary/apiary-ranger-metastore-plugin-${APIARY_RANGER_PLUGIN_VERSION}-all.jar"
[[ ! -z $ENABLE_METRICS ]] && export AUX_CLASSPATH="$AUX_CLASSPATH:/usr/lib/apiary/apiary-metastore-metrics-${APIARY_METASTORE_METRICS_VERSION}-all.jar"

export HADOOP_OPTS="-XshowSettings:vm"
#auto configure heapsize
if [ ! -z ${ECS_CONTAINER_METADATA_URI} ]; then
export MEM_LIMIT=$(wget -q -O - ${ECS_CONTAINER_METADATA_URI}/task|jq -r .Limits.Memory)
export HADOOP_HEAPSIZE=$(expr $MEM_LIMIT \* 90 / 100)
fi
[[ -z $HADOOP_HEAPSIZE ]] && export HADOOP_HEAPSIZE=1024

export HADOOP_OPTS="-XshowSettings:vm -Xms${HADOOP_HEAPSIZE}m"
su hive -s/bin/bash -c "/usr/lib/hive/bin/hive --service metastore --hiveconf javax.jdo.option.ConnectionURL=jdbc:mysql://${MYSQL_DB_HOST}:3306/${MYSQL_DB_NAME} --hiveconf javax.jdo.option.ConnectionUserName='${MYSQL_DB_USERNAME}' --hiveconf javax.jdo.option.ConnectionPassword='${MYSQL_DB_PASSWORD}'"

0 comments on commit ca500ad

Please sign in to comment.