Skip to content

Instantly share code, notes, and snippets.

@jkordish
Last active August 29, 2015 14:21
Show Gist options
  • Save jkordish/7c042c54e99058cabb87 to your computer and use it in GitHub Desktop.
Save jkordish/7c042c54e99058cabb87 to your computer and use it in GitHub Desktop.
AWS EMR -- Add this as a bootstrap script to set all nodes to use the master hive.
#!/bin/bash -ex
# Upload script to S3 bucket you are using for your cluster.
# Add the following after the Spark install bootstrap action
# --bootstrap-actions Name="Fix Hive",Path="s3://<s3_bucket>/hive-fix.sh"
export MASTER=$(hdfs getconf -namenodes)
if [ -f "/home/hadoop/hive/conf/hive-default.xml" ]; then
sed -i "s/jdbc:mysql:\/\/localhost:3306/jdbc:mysql:\/\/$MASTER:3306/g" /home/hadoop/hive/conf/hive-default.xml
fi
sudo mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' IDENTIFIED BY 'hive'; FLUSH PRIVILEGES;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment