How do I restart a service in Amazon EMR?

3 minute read
1

I need to restart an Amazon EMR service, such as YARN ResourceManager.

Short description

The process for restarting a service differs depending on which Amazon EMR release version you're using:

  • Amazon EMR 5.30.0 and later release versions: Use the sudo systemctl stop and sudo systemctl start commands.
  • Amazon EMR 4.x-5.29.0 release versions: Use the sudo stop and sudo start commands.
  • Amazon EMR 2.x-3.x release versions: Use the sudo restart command.

Resolution

Amazon EMR 5.30.0 and later release versions

1.    Connect to the master node using SSH.

2.    List all running services:

systemctl --type=service

3.    To list a specific service, run a command similar to the following. For example, to list the Zeppelin service:

systemctl --type=service | grep -i zeppelin

Example output:

zeppelin.service  loaded active running Zeppelin

4.    To see a detailed status report for a specific service:

sudo systemctl status zeppelin

Example output:

zeppelin.service - Zeppelin
   Loaded: loaded (/etc/systemd/system/zeppelin.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-04-21 18:26:53 UTC; 4min 59s ago
  Process: 25719 ExecStart=/usr/bin/su -s /bin/bash zeppelin -c cd /var/lib/zeppelin && /usr/lib/zeppelin/bin/zeppelin-daemon.sh --config '/etc/zeppelin/conf' start (code=exited, status=0/SUCCESS)
 Main PID: 25749 (java)
    Tasks: 0
   Memory: 4.0K
   CGroup: /system.slice/zeppelin.service
           25749 /etc/alternatives/jre/bin/java -Dfile.encoding=UTF-8 -Xms1024m -Xmx1024m -XX:MaxPermSize=512m -Dlog4j.configuration=file:///etc/zeppelin/con...

5.    Stop the service:

Note: You must use the stop and start commands in the following steps. Don't use the restart command.

sudo systemctl stop zeppelin

6.    Verify that the service is stopped:

sudo systemctl status zeppelin

7.    Start the service:

sudo systemctl start zeppelin

8.    Verify that the service is running:

sudo systemctl status zeppelin

Amazon EMR 4.x-5.29.0 release versions

1.    Connect to the master node using SSH.

2.    List all running services:

initctl list

3.    Run the following command to stop the service. Replace "hadoop-yarn-resourcemanager" with the service that you want to restart.

Note: You must use the stop and start commands in the following steps. Don't use the restart command.

sudo stop hadoop-yarn-resourcemanager

4.    Wait a few seconds, and then start the service:

sudo start hadoop-yarn-resourcemanager

5.    Verify that the process is running:

sudo status hadoop-yarn-resourcemanager

Amazon EMR 2.x-3.x release versions

1.    Connect to the master node using SSH.

2.    List all running services:

ls /etc/init.d/

3.    Run the following command to restart the service. Replace "hadoop-hdfs-namenode" with the service that you want to restart.

sudo /etc/init.d/hadoop-hdfs-namenode restart

4.    Verify that the process is running:

sudo /etc/init.d/hadoop-hdfs-namenode status

Related information

About Amazon EMR releases

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago