Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restart hive service on AWS EMR

I am very new to HIVE as well AWS-EMR. As per my requirement, i need to create Hive Metastore Outside the Cluster (from AWS EMR to AWS RDS). I followed the instruction given in

http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-dev-create-metastore-outside.html

I made changes in hive-site.xml and able to setup hive metaStore to Amazon RDS mysql server. To bring the changes in action, currently i am rebooting the complete cluster so hive start storing metastore to AWS-RDS. This way it is working.

But i want to avoid rebooting the cluster, is there any way i can restart the service?

like image 481
code1234 Avatar asked Aug 11 '15 10:08

code1234


4 Answers

Just for those who are gonna come from Google

To restart any EMR service

In order to restart a service in EMR, perform the following actions:

  1. Find the name of the service by running the following command:

    initctl list

For example, the YARN Resource Manager service is named “hadoop-yarn-resourcemanager”.

  1. Stop the service by running the following command:

    sudo stop hadoop-yarn-resourcemanager

  2. Wait a few seconds, then start the service by running the following command:

    sudo start hadoop-yarn-resourcemanager

Note: Stop/start is required; do not use the restart command.

  1. Verify that the process is running by running the following command:

    sudo status hadoop-yarn-resourcemanager

Check for the process using ps, and then check the log file for any errors in the log directory /var/log/.

Source : https://aws.amazon.com/premiumsupport/knowledge-center/restart-service-emr/

like image 113
Ahmed Kamal Avatar answered Sep 19 '22 02:09

Ahmed Kamal


 sudo stop hive-metastore
 sudo start hive-metastore
like image 26
user3294904 Avatar answered Sep 21 '22 02:09

user3294904


On EMR 5.x I have found this to work:

hive --service metastore --stop

hive --service metastore --start

like image 38
apeletz Avatar answered Sep 21 '22 02:09

apeletz


For me this approach worked:

  1. Get the pid
  2. Kill the process
  3. Process restarts by itself

Commands for 1 & 2:

ps aux | grep MetaStore
sudo -u hive kill <pid from above>

Here if you are not familiar with ps you can use the following command which will show the headers for PID and only one line of the hive Metastore command:

ps aux | egrep "MetaStore|PID" | grep -v grep

Hive Server restarted by itself. Validate again by ps the pig would have changed.

ps aux | grep MetaStore
like image 35
user 923227 Avatar answered Sep 21 '22 02:09

user 923227