Log on to E-MapReduce (EMR) cluster nodes through SSH, Workbench, or other ECS instance connection methods to manage and interact with your cluster.
Prerequisites
-
Your local machine must be able to connect to the cluster's master node. You can turn on the Assign Public Network IP switch when you create a cluster. Alternatively, after creating the cluster, you can assign a static public IP address or an elastic IP address (EIP) to the master node in the ECS console. For more information, see How do I assign a public IP address after a cluster is created?.
-
Ensure the security group for the cluster allows inbound traffic on TCP port 22. For more information, see Add a security group rule.
Find a node's public IP and name
To find the public IP address or name of a node, perform the following steps.
-
Go to the Nodes page.
-
Log on to the E-MapReduce console.
-
In the top navigation bar, select a region and a resource group.
-
In the Actions column of the target cluster, click Nodes.
-
-
On the Nodes page, click the
icon next to the target node group to view its public IP address and node name.-
Public IP Address: The public IP address of the node.
NoteIf the public IP address of a node is not displayed, this indicates the Assign Public Network IP option was not enabled when the cluster was created. To assign a public IP address, see How do I assign a public IP address after a cluster is created?.
-
Node Name: The name of the node, such as
master-1-1,core-1-1, ortask-1-1.
-
Log on to the master node
SSH key pair
After you create a key pair, the private key is automatically downloaded and saved as a .pem file.
Follow the steps for your operating system.
Linux
The following example uses the ecs.pem private key file to log on to a master node.
-
Run the following command to change the permissions on the private key file.
chmod 400 ~/.ssh/ecs.pemIn this example,
~/.ssh/ecs.pemis the path to the ecs.pem private key file on your local machine. -
Run the following command to connect to the master node.
ssh -i ~/.ssh/ecs.pem emr-user@<public_ip_address_of_the_master_node>To obtain the public IP address of the master node, see Find a node's public IP and name.
Windows
Log on to a master node by using Command Prompt or PuTTY.
Command Prompt
Open Command Prompt and run the following command to log on to the master node.
ssh -i <path_to_your_.pem_private_key_file> emr-user@<public_ip_address_of_the_master_node>
To obtain the public IP address of the master node, see Find a node's public IP and name.
PuTTY
-
Download PuTTY and PuTTYgen.
-
Use PuTTYgen to convert the .pem private key file to a .ppk file.
-
Run PuTTYgen. This example uses PuTTYgen 0.82.
-
In the Actions section, click Load to import the private key file that you downloaded when creating the cluster.
When importing the file, set the file type to All files (*.*).
-
Select the .pem private key file that you want to convert and click Enable.
-
Click Save private key.
-
In the dialog box that appears, click Yes. Enter a name for the .ppk private key file and click Save.
Save the converted private key to your local machine. For example: kp-123.ppk.
-
-
Log on to the master node by using PuTTY.
-
Run PuTTY.
-
In the navigation pane, choose Connection > SSH > Auth > Credentials. For the Private key file for authentication option, click Browse and select the converted key file.
-
Click Session. In the Host Name (or IP address) field, enter the logon username and the public IP address of the master node.
Use the format
emr-user@<public_ip_address_of_the_master_node>, for example,emr-user@10.10.xx.xx. To obtain the public IP address of the master node, see Find a node's public IP and name.Ensure the Port is set to 22 and the Connection type is SSH.
-
Click Open. In the dialog box that appears, click Accept to log on to the master node.
-
SSH password
These steps assume you are using the root username and the password set during cluster creation.
Follow the steps for your operating system.
Linux
Run the following command in your local terminal to connect to the master node.
ssh root@<public_ip_address_of_the_master_node>
To obtain the public IP address of the master node, see Find a node's public IP and name.
Windows
-
Download and install PuTTY. Download link: PuTTY.
-
Start PuTTY.
-
Configure the information required to connect to the cluster.
-
Host Name (or IP address): Enter the static public IP address or EIP of the master node. To obtain the public IP address of the master node, see Find a node's public IP and name.
-
Port: Enter 22.
-
Connection type: Select SSH.
-
(Optional) To save these settings for future use, enter a name for the session in the Saved Sessions field and click Save.
-
-
Click Open.
-
Enter your username (
rootby default) and password to log on to the cluster.
ECS connection method
-
Go to the Nodes page.
-
Log on to the E-MapReduce console.
-
In the top navigation bar, select a region and a resource group as required.
-
In the Actions column of the target cluster, click Nodes.
-
-
On the Nodes page, click the ECS ID under the target node name to open the ECS console.
-
On the Instances page, click Remote connection next to the instance ID.
You can also select a suitable tool to connect to the node's ECS instance. For more information, see Connection methods.
NoteIf a permission issue occurs when you connect to an instance by using Workbench, see What do I do if a permission error occurs when I use Workbench to connect to an ECS instance?.
Log on to other cluster nodes
Password-free login to other nodes
To log on to a core or task node, perform the following steps.
-
Log on to the master node of the cluster. For more information, see Log on to the master node.
-
On the master node, switch to the
emr-useraccount.su emr-user -
Log on to the target core or task node without a password.
ssh <node_name_of_the_core_or_task_node>To obtain the name of the core or task node, see Find a node's public IP and name. Example node names include
core-1-1andtask-1-1.
ECS connection method
-
Go to the Nodes page.
-
Log on to the E-MapReduce console.
-
In the top navigation bar, select a region and a resource group as required.
-
In the Actions column of the target cluster, click Nodes.
-
-
On the Nodes page, click the ECS ID under the target node name to open the ECS console.
-
On the Instances page, click Reset Instance Password. For more information, see Reset the logon password for an instance.
ImportantBy default, core and task nodes do not have an ECS logon password. To log on with a password, you must first reset it in the ECS console.
-
After you reset your password, select an appropriate tool to connect to the node ECS instance. For more information, see Select an ECS remote connection method.
NoteIf a permission issue occurs when you connect to an instance by using Workbench, see What do I do if a permission error occurs when I use Workbench to connect to an ECS instance?.
FAQ
Assign a public IP address
Password-free login
Cluster creation password
Reset cluster password
Workbench permission error
References
For security reasons, the web UIs for open-source components like Hadoop, Spark, and Flink are not publicly accessible. Use one of the following methods to access them: