Restart hive service on AWS EMR

19,179

Solution 1

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/

Solution 2

 sudo stop hive-metastore
 sudo start hive-metastore

Solution 3

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

hive --service metastore --stop

hive --service metastore --start

Solution 4

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
Share:
19,179
code1234
Author by

code1234

Updated on June 28, 2022

Comments

  • code1234
    code1234 almost 2 years

    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?

  • code1234
    code1234 over 8 years
    I have stored hive-site.xml in AWS s3 but unable to create new cluster. it gets terminated after some seconds. i followed AWS documentation. link.
  • user3294904
    user3294904 almost 8 years
    @hadron sudo stop hive-metastore sudo start hive-metastore