This topic describes how to log on to the nodes of an E-MapReduce (EMR) cluster in SSH mode or by connecting to an Elastic Compute Service (ECS) instance based on specific tools, such as Workbench. After you log on to a node of an EMR cluster, you can manage the cluster or perform operations on the cluster.
Prerequisites
Your on-premises machine is connected to the master node of the cluster. You can turn on Assign Public IP Address during cluster creation to associate an elastic IP address (EIP) with your cluster. You can also assign a fixed public IP address or an EIP address to the master node of your cluster in the ECS console after the cluster is created. For more information, see How do I assign a public IP address or an EIP address to a node of a cluster after the cluster is created? in the FAQ section in this topic.
Port 22 is enabled for the security group to which your cluster belongs. For more information, see the Add a security group rule section in the "Manage security groups" topic.
Obtain the public IP address and the name of a node
You can perform the following operations to obtain the public IP address and the name of a node.
Go to the Nodes tab.
Log on to the EMR console.
In the top navigation bar, select a region and a resource group based on your business requirements.
On the EMR on ECS page, find the desired cluster and click Nodes in the Actions column.
On the Nodes tab, find the desired node group and click the
icon.
Public IP Address: You can view the public IP address of a node in the Public IP Address column.
NoteIf no public IP address is available in the Public IP Address column, the Assign Public IP Address switch was not turned on when you created the cluster. For information about how to assign a public IP address or an EIP address to a node of your cluster, see How do I assign a public IP address or an EIP address to a node of a cluster after the cluster is created? in the FAQ section in this topic.
Node Name/ID: You can view the name of the master node in the Node Name/ID column. Examples: master-1-1, core-1-1, and task-1-1.
Log on to the master node of a cluster
Log on to the master node of a cluster by using an SSH key pair
After you create a key pair, a private key file in the .pem format is automatically downloaded.
The operations for logging on to the master node of a cluster vary based on the operating system of your on-premises machine.
Linux
In this example, the private key file ecs.pem is used.
Run the following command to modify the attribute of the private key file:
chmod 400 ~/.ssh/ecs.pem
~/.ssh/ecs.pem
is the path where the ecs.pem file is stored on your on-premises machine.Run the following command to log on to the master node:
ssh -i ~/.ssh/ecs.pem emr-user@<Public IP address of the master node>
For more information about how to obtain the public IP address of the master node, see the Obtain the public IP address and the name of a node section in this topic.
Windows
In Windows, you can use Command Prompt or PuTTY to log on to the master node a cluster.
Log on to the master node of a cluster by using Command Prompt
Open Command Prompt and run the following command to log on to the master node of a cluster:
ssh -i <Storage path of the .pem file on your on-premises machine> emr-user@<Public IP address of the master node>
For more information about how to obtain the public IP address of the master node, see the Obtain the public IP address and the name of a node section in this topic.
Log on to the master node of a cluster by using PuTTY
Download PuTTY and PuTTYgen.
Use PuTTYgen to convert the format of the private key file from .pem to .ppk.
Run PuTTYgen. In this example, PuTTYgen 0.82 is used.
In the Actions section, click Load to import the private key file that is saved when you create a cluster.
Make sure that the format of the file that you want to import is All files (*.*).
Select the specific .pem file and click Open.
Click Save private key.
In the dialog box that appears, click Yes. Specify a name for the .ppk file and click Save.
Save the .ppk file to your on-premises machine. In this example, kp-123.ppk is used.
Log on to the master node of the cluster by using PuTTY.
Run PuTTY.
In the left-side navigation pane, choose
. Click Browse below Private key file for authentication and select the .ppk file.Click Session. Enter the logon account and the public IP address of the master node in the Host Name (or IP address) field.
The format is emr-user@<Public IP address of the master node>, such as emr-user@10.10.**.**. For more information about how to obtain the public IP address of the master node, see the Obtain the public IP address and the name of a node section in this topic.
Click Open. In the dialog box that appears, select Accept.
Log on to the master node of a cluster by using an SSH password
The username and password used in the following operations are the root user and password you specified when you created a cluster.
The operations for logging on to the master node of a cluster vary based on the operating system of your on-premises machine.
Linux
Run the following command in the CLI of your on-premises machine to log on to the master node of a cluster:
ssh root@<Public IP address of the master node>
For more information about how to obtain the public IP address of the master node, see the Obtain the public IP address and the name of a node section in this topic.
Windows
Download and install PuTTY. Download link: PuTTY.
Start PuTTY.
Configure the parameters for logging on to the master node of a cluster.
Host Name (or IP address): Specify the fixed public IP address of the master node or the EIP address associated with the master node. For more information about how to obtain the public IP address of the master node, see the Obtain the public IP address and the name of a node section in this topic.
Port: Enter the port number 22.
Connection type: Select SSH.
Saved Sessions: optional. Enter a session name that is easy to identify and click Save. This way, you do not need to enter session information such as the public IP address when you connect to the instance again.
Click Open.
Specify the username and password and press Enter. The default username is root.
Log on to the master node of a cluster by connecting to the specific ECS instance
Go to the Nodes tab.
Log on to the EMR console.
In the top navigation bar, select a region and a resource group based on your business requirements.
On the EMR on ECS page, find the desired cluster and click Nodes in the Actions column.
On the Nodes tab, find the desired node and click the node ID to go to the ECS console.
On the Instances page, click Connect in the Actions column of the ECS instance.
You can also select an appropriate tool to connect to the ECS instance. For more information, see Methods for connecting to an ECS instance.
NoteIf a permission error occurs when you use Workbench to connect to an ECS instance, see What do I do if I do not have permission to use Workbench to connect to an ECS instance? in the FAQ section in this topic.
Log on to other nodes of a cluster
Log on to other nodes of a cluster in password-free mode
You can perform the following operations to log on to a core node or a task node.
Log on to the master node of a cluster. For more information, see the Log on to the master node of a cluster section in this topic.
On the master node, run the following command to switch to the user emr-user:
su emr-user
Log on to the core node or the task node in password-free mode.
ssh <The node name of the core or task node>
For more information about how to obtain the name of a core or task node, see the Obtain the public IP address and the name of a node section in this topic. Example: core-1-1 or task-1-1.
Log on to other nodes of a cluster by connecting to the specific ECS instances
Go to the Nodes tab.
Log on to the EMR console.
In the top navigation bar, select a region and a resource group based on your business requirements.
On the EMR on ECS page, find the desired cluster and click Nodes in the Actions column.
On the Nodes tab, find the desired node and click the node ID to go to the ECS console.
On the Instances page, reset the instance password. For more information, see Reset the logon password of an instance.
ImportantBy default, no logon password is specified for core or task nodes. If you want to log on to a core or task node by using a password, modify the instance logon password in the ECS console.
Select an appropriate tool to connect to the ECS instance. For more information, see Methods for connecting to an ECS instance.
NoteIf a permission error occurs when you use Workbench to connect to an ECS instance, see What do I do if I do not have permission to use Workbench to connect to an ECS instance? in the FAQ section in this topic.
FAQ
How do I assign a public IP address or an EIP address to a node of a cluster after the cluster is created?
How do I log on to a cluster from my on-premises machine without using the password?
Can I use the password that I specified when I created a cluster to log on to the nodes of the cluster?
How do I reset my password?
What do I do if I do not have permission to use Workbench to connect to an ECS instance?
References
To ensure cluster security, the ports over which you can access the web UIs of open source components, such as Hadoop, Spark, and Flink, are not enabled. To access the web UIs of open source components, see the following topics: