12.04.2020»»воскресенье

Command To Generate Machine Keys In Hadoo

12.04.2020
-->

If you have done everything right and have already added keys in authorizedkeys as well, then all you need to do is to remove your idrsa and idrsa.pub (whatever names you have used for the keypair file) and empty your authorizedkeys, in short just take a rollback, because you might have given a password while generating rsa key.

Learn how to use Secure Shell (SSH) to securely connect to Apache Hadoop on Azure HDInsight. For information on connecting through a virtual network, see Azure HDInsight virtual network architecture and Plan a virtual network deployment for Azure HDInsight clusters.

At the beginning, it is recommended to create a separate user for Hadoop to isolate Hadoop file system from Unix file system. Open the root using the command “su”. Create a user from the root account using the command “useradd username”. Now you can open an existing user account using the command “su username”. The Hadoop shell is a family of commands that you can run from your operating system’s command line. The shell has two sets of commands: one for file manipulation (similar in purpose and syntax to Linux commands that many of us know and love) and one for Hadoop administration.

The following table contains the address and port information needed when connecting to HDInsight using an SSH client:

AddressPortConnects to..
<clustername>-ssh.azurehdinsight.net22Primary headnode
<clustername>-ssh.azurehdinsight.net23Secondary headnode
<clustername>-ed-ssh.azurehdinsight.net22edge node (ML Services on HDInsight)
<edgenodename>.<clustername>-ssh.azurehdinsight.net22edge node (any other cluster type, if an edge node exists)

Replace <clustername> with the name of your cluster. Replace <edgenodename> with the name of the edge node.

If your cluster contains an edge node, we recommend that you always connect to the edge node using SSH. The head nodes host services that are critical to the health of Hadoop. The edge node runs only what you put on it. For more information on using edge nodes, see Use edge nodes in HDInsight.

Tip

When you first connect to HDInsight, your SSH client may display a warning that the authenticity of the host can't be established. When prompted select 'yes' to add the host to your SSH client's trusted server list.

If you have previously connected to a server with the same name, you may receive a warning that the stored host key does not match the host key of the server. Consult the documentation for your SSH client on how to remove the existing entry for the server name.

SSH clients

Linux, Unix, and macOS systems provide the ssh and scp commands. The ssh client is commonly used to create a remote command-line session with a Linux or Unix-based system. The scp client is used to securely copy files between your client and the remote system.

Microsoft Windows doesn't install any SSH clients by default. The ssh and scp clients are available for Windows through the following packages:

  • OpenSSH Client. This client is an optional feature introduced in the Windows 10 Fall Creators Update.

  • Bash on Ubuntu on Windows 10.

  • Azure Cloud Shell. The Cloud Shell provides a Bash environment in your browser.

  • Git.

There are also several graphical SSH clients, such as PuTTY and MobaXterm. While these clients can be used to connect to HDInsight, the process of connecting is different than using the ssh utility. For more information, see the documentation of the graphical client you're using.

Authentication: SSH Keys

SSH keys use public-key cryptography to authenticate SSH sessions. SSH keys are more secure than passwords, and provide an easy way to secure access to your Hadoop cluster.

If your SSH account is secured using a key, the client must provide the matching private key when you connect:

Hadoop Command To Change Directory

  • Most clients can be configured to use a default key. For example, the ssh client looks for a private key at ~/.ssh/id_rsa on Linux and Unix environments.

  • You can specify the path to a private key. With the ssh client, the -i parameter is used to specify the path to private key. For example, ssh -i ~/.ssh/id_rsa sshuser@myedge.mycluster-ssh.azurehdinsight.net.

  • If you have multiple private keys for use with different servers, consider using a utility such as ssh-agent (https://en.wikipedia.org/wiki/Ssh-agent). The ssh-agent utility can be used to automatically select the key to use when establishing an SSH session.

Important

If you secure your private key with a passphrase, you must enter the passphrase when using the key. Utilities such as ssh-agent can cache the password for your convenience.

Create an SSH key pair

Use the ssh-keygen command to create public and private key files. The following command generates a 2048-bit RSA key pair that can be used with HDInsight:

You're prompted for information during the key creation process. For example, where the keys are stored or whether to use a passphrase. After the process completes, two files are created; a public key and a private key.

  • The public key is used to create an HDInsight cluster. The public key has an extension of .pub.

  • The private key is used to authenticate your client to the HDInsight cluster.

Important

You can secure your keys using a passphrase. A passphrase is effectively a password on your private key. Even if someone obtains your private key, they must have the passphrase to use the key.

Create HDInsight using the public key

Creation methodHow to use the public key
Azure portalUncheck Use cluster login password for SSH, and then select Public Key as the SSH authentication type. Finally, select the public key file or paste the text contents of the file in the SSH public key field.
Azure PowerShellUse the -SshPublicKey parameter of the New-AzHdinsightCluster cmdlet and pass the contents of the public key as a string.
Azure CLIUse the --sshPublicKey parameter of the az hdinsight create command and pass the contents of the public key as a string.
Resource Manager TemplateFor an example of using SSH keys with a template, see Deploy HDInsight on Linux with SSH key. The publicKeys element in the azuredeploy.json file is used to pass the keys to Azure when creating the cluster.
Hadoo

Authentication: Password

SSH accounts can be secured using a password. When you connect to HDInsight using SSH, you're prompted to enter the password.

Warning

Microsoft does not recommend using password authentication for SSH. Passwords can be guessed and are vulnerable to brute force attacks. Instead, we recommend that you use SSH keys for authentication.

Important

The SSH account password expires 70 days after the HDInsight cluster is created. If your password expires, you can change it using the information in the Manage HDInsight document.

Create HDInsight using a password

Creation methodHow to specify the password
Azure portalBy default, the SSH user account has the same password as the cluster login account. To use a different password, uncheck Use cluster login password for SSH, and then enter the password in the SSH password field.
Azure PowerShellUse the --SshCredential parameter of the New-AzHdinsightCluster cmdlet and pass a PSCredential object that contains the SSH user account name and password.
Azure CLIUse the --ssh-password parameter of the az hdinsight create command and provide the password value.
Resource Manager TemplateFor an example of using a password with a template, see Deploy HDInsight on Linux with SSH password. The linuxOperatingSystemProfile element in the azuredeploy.json file is used to pass the SSH account name and password to Azure when creating the cluster.

Change the SSH password

For information on changing the SSH user account password, see the Change passwords section of the Manage HDInsight document.

Authentication domain joined HDInsight

If you're using a domain-joined HDInsight cluster, you must use the kinit command after connecting with SSH local user. This command prompts you for a domain user and password, and authenticates your session with the Azure Active Directory domain associated with the cluster.

You can also enable Kerberos Authentication on each domain joined node (for example, head node, edge node) to ssh using the domain account. To do this edit sshd config file:

uncomment and change KerberosAuthentication to yes

Command

Use klist command to verify whether the Kerberos authentication was successful.

For more information, see Configure domain-joined HDInsight.

Connect to nodes

The head nodes and edge node (if there's one) can be accessed over the internet on ports 22 and 23.

  • When connecting to the head nodes, use port 22 to connect to the primary head node and port 23 to connect to the secondary head node. The fully qualified domain name to use is clustername-ssh.azurehdinsight.net, where clustername is the name of your cluster.

  • When connecting to the edge node, use port 22. The fully qualified domain name is edgenodename.clustername-ssh.azurehdinsight.net, where edgenodename is a name you provided when creating the edge node. clustername is the name of the cluster.

Important

The previous examples assume that you are using password authentication, or that certificate authentication is occurring automatically. If you use an SSH key-pair for authentication, and the certificate is not used automatically, use the -i parameter to specify the private key. For example, ssh -i ~/.ssh/mykey sshuser@clustername-ssh.azurehdinsight.net.

Once connected, the prompt changes to indicate the SSH user name and the node you're connected to. For example, when connected to the primary head node as sshuser, the prompt is sshuser@<active-headnode-name>:~$.

Connect to worker and Apache Zookeeper nodes

The worker nodes and Zookeeper nodes aren't directly accessible from the internet. They can be accessed from the cluster head nodes or edge nodes. The following are the general steps to connect to other nodes:

  1. Use SSH to connect to a head or edge node:

  2. From the SSH connection to the head or edge node, use the ssh command to connect to a worker node in the cluster:

    To retrieve a list of the node names, see the Manage HDInsight by using the Apache Ambari REST API document.

If the SSH account is secured using a password, enter the password when connecting.

If the SSH account is secured using SSH keys, make sure that SSH forwarding is enabled on the client.

Note

Another way to directly access all nodes in the cluster is to install HDInsight into an Azure Virtual Network. Then, you can join your remote machine to the same virtual network and directly access all nodes in the cluster.

For more information, see Plan a virtual network for HDInsight.

Configure SSH agent forwarding

Important

The following steps assume a Linux or UNIX-based system, and work with Bash on Windows 10. If these steps do not work for your system, you may need to consult the documentation for your SSH client.

  1. Using a text editor, open ~/.ssh/config. If this file doesn't exist, you can create it by entering touch ~/.ssh/config at a command line.

  2. Add the following text to the config file.

    Replace the Host information with the address of the node you connect to using SSH. The previous example uses the edge node. This entry configures SSH agent forwarding for the specified node.

  3. Test SSH agent forwarding by using the following command from the terminal:

    This command returns information similar to the following text:

    If nothing is returned, then ssh-agent isn't running. For more information, see the agent startup scripts information at Using ssh-agent with ssh (http://mah.everybody.org/docs/ssh) or consult your SSH client documentation.

  4. Once you've verified that ssh-agent is running, use the following to add your SSH private key to the agent:

    If your private key is stored in a different file, replace ~/.ssh/id_rsa with the path to the file.

  5. Connect to the cluster edge node or head nodes using SSH. Then use the SSH command to connect to a worker or zookeeper node. The connection is established using the forwarded key.

Copy files

The scp utility can be used to copy files to and from individual nodes in the cluster. For example, the following command copies the test.txt directory from the local system to the primary head node:

Since no path is specified after the :, the file is placed in the sshuser home directory.

The following example copies the test.txt file from the sshuser home directory on the primary head node to the local system:

Adobe key generator cs6 mac can't validate code iphone. Adobe CS6 series generator Sony Vegas Pro 9 portable CS5 touring cooper Sony Vegas Pro 12 free torrent. What is the situation that they have an installation and you had the other one so the installation will be illegitimate and Adobe would not like your attitude to the fact that you want it.

Important

scp can only access the file system of individual nodes within the cluster. It cannot be used to access data in the HDFS-compatible storage for the cluster.

Command To Generate Machine Keys In Hadoop Training

Use scp when you need to upload a resource for use from an SSH session. For example, upload a Python script and then run the script from an SSH session.

Equipment Keys

For information on directly loading data into the HDFS-compatible storage, see the following documents:

Hadoop Commands In Linux

  • HDInsight using Azure Storage.

  • HDInsight using Azure Data Lake Storage.

Next steps

Command To Generate Machine Keys In Hadoop Tutorial

The Hadoop shell is a family of commands that you can run from your operating system’s command line. The shell has two sets of commands: one for file manipulation (similar in purpose and syntax to Linux commands that many of us know and love) and one for Hadoop administration. The following list summarizes the first set of commands for you, indicating what the command does as well as usage and examples, where applicable.

  • cat: Copies source paths to stdout.

    Usage:hdfs dfs -cat URI [URI …]

    Example:

    • hdfs dfs -cat hdfs://<path>/file1

    • hdfs dfs-cat file:///file2 /user/hadoop/file3

  • chgrp: Changes the group association of files. With -R, makes the change recursively by way of the directory structure. The user must be the file owner or the superuser.

    Usage:hdfs dfs -chgrp [-R] GROUP URI [URI …]

  • chmod: Changes the permissions of files. With -R, makes the change recursively by way of the directory structure. The user must be the file owner or the superuser

    Usage:hdfs dfs -chmod [-R] <MODE[,MODE]… OCTALMODE> URI [URI …]

    Example:hdfs dfs -chmod 777test/data1.txt

  • chown: Changes the owner of files. With -R, makes the change recursively by way of the directory structure. The user must be the superuser.

    Usage:hdfs dfs -chown [-R] [OWNER][:[GROUP]] URI [URI ]

    Example:hdfs dfs -chown -R hduser2 /opt/hadoop/logs

  • copyFromLocal: Works similarly to the put command, except that the source is restricted to a local file reference.

    Usage:hdfs dfs -copyFromLocal <localsrc> URI

    Example:hdfs dfs -copyFromLocal input/docs/data2.txt hdfs://localhost/user/rosemary/data2.txt

  • copyToLocal: Works similarly to the get command, except that the destination is restricted to a local file reference.

    Usage:hdfs dfs -copyToLocal [-ignorecrc] [-crc] URI <localdst>

    Example:hdfs dfs -copyToLocal data2.txt data2.copy.txt

  • count: Counts the number of directories, files, and bytes under the paths that match the specified file pattern.

    Usage:hdfs dfs -count [-q] <paths>

    Example:hdfs dfs -count hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2

  • cp: Copies one or more files from a specified source to a specified destination. If you specify multiple sources, the specified destination must be a directory.

    Usage:hdfs dfs -cp URI [URI …] <dest>

    Example:hdfs dfs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir

  • du: Displays the size of the specified file, or the sizes of files and directories that are contained in the specified directory. If you specify the -s option, displays an aggregate summary of file sizes rather than individual file sizes. If you specify the -h option, formats the file sizes in a “human-readable” way.

    Usage:hdfs dfs -du [-s] [-h] URI [URI …]

    Example:hdfs dfs -du /user/hadoop/dir1 /user/hadoop/file1

  • dus: Displays a summary of file sizes; equivalent to hdfs dfs -du –s.

    Usage:hdfs dfs -dus <args>

  • expunge: Empties the trash. When you delete a file, it isn’t removed immediately from HDFS, but is renamed to a file in the /trash directory. As long as the file remains there, you can undelete it if you change your mind, though only the latest copy of the deleted file can be restored.

    Usage:hdfs dfs –expunge

  • get: Copies files to the local file system. Files that fail a cyclic redundancy check (CRC) can still be copied if you specify the ignorecrcoption. The CRC is a common technique for detecting data transmission errors. CRC checksum files have the .crc extension and are used to verify the data integrity of another file. These files are copied if you specify the -crc option.

    Usage:hdfs dfs -get [-ignorecrc] [-crc] <src> <localdst>

    Example:hdfs dfs -get /user/hadoop/file3 localfile

  • getmerge: Concatenates the files in srcand writes the result to the specified local destination file. To add a newline character at the end of each file, specify the addnl option.

    Usage:hdfs dfs -getmerge <src> <localdst> [addnl]

    Example:hdfs dfs -getmerge /user/hadoop/mydir/ ~/result_file addnl

  • ls: Returns statistics for the specified files or directories.

    Usage:hdfs dfs -ls <args>

    Example:hdfs dfs -ls /user/hadoop/file1

  • lsr: Serves as the recursive version of ls; similar to the Unix command ls -R.

    Usage:hdfs dfs -lsr <args>

    Example:hdfs dfs -lsr /user/hadoop

  • mkdir: Creates directories on one or more specified paths. Its behavior is similar to the Unix mkdir -p command, which creates all directories that lead up to the specified directory if they don’t exist already.

    Usage:hdfs dfs -mkdir <paths>

    Example:hdfs dfs -mkdir /user/hadoop/dir5/temp

  • moveFromLocal: Works similarly to the put command, except that the source is deleted after it is copied.

    Usage:hdfs dfs -moveFromLocal <localsrc> <dest>

    Example:hdfs dfs -moveFromLocal localfile1 localfile2 /user/hadoop/hadoopdir

  • mv: Moves one or more files from a specified source to a specified destination. If you specify multiple sources, the specified destination must be a directory. Moving files across file systems isn’t permitted.

    Usage:hdfs dfs -mv URI [URI …] <dest>

    Example:hdfs dfs -mv /user/hadoop/file1 /user/hadoop/file2

  • put: Copies files from the local file system to the destination file system. This command can also read input from stdin and write to the destination file system.

    Usage:hdfs dfs -put <localsrc> … <dest>

    Example:hdfs dfs -put localfile1 localfile2 /user/hadoop/hadoopdir; hdfs dfs -put – /user/hadoop/hadoopdir (reads input from stdin)

  • rm: Deletes one or more specified files. This command doesn’t delete empty directories or files. To bypass the trash (if it’s enabled) and delete the specified files immediately, specify the -skipTrash option.

    Usage:hdfs dfs -rm [-skipTrash] URI [URI …]

    Example:hdfs dfs -rm hdfs://nn.example.com/file9

  • rmr: Serves as the recursive version of –rm.

    Usage:hdfs dfs -rmr [-skipTrash] URI [URI …]

    Example:hdfs dfs -rmr /user/hadoop/dir

  • setrep: Changes the replication factor for a specified file or directory. With R, makes the change recursively by way of the directory structure.

    Usage:hdfs dfs -setrep <rep> [-R] <path>

    Example:hdfs dfs -setrep 3 -R /user/hadoop/dir1

  • stat: Displays information about the specified path.

    Usage:hdfs dfs -stat URI [URI …]

    Example:hdfs dfs -stat /user/hadoop/dir1

  • tail: Displays the last kilobyte of a specified file to stdout. The syntax supports the Unix -f option, which enables the specified file to be monitored. As new lines are added to the file by another process, tail updates the display.

    Usage:hdfs dfs -tail [-f] URI

    Example:hdfs dfs -tail /user/hadoop/dir1

  • test: Returns attributes of the specified file or directory. Specifies e to determine whether the file or directory exists; -z to determine whether the file or directory is empty; and -d to determine whether the URI is a directory.

    Usage:hdfs dfs -test -[ezd] URI

    Example:hdfs dfs -test /user/hadoop/dir1

  • text: Outputs a specified source file in text format. Valid input file formats are zip and TextRecordInputStream.

    Usage:hdfs dfs -text <src>

    Example:hdfs dfs -text /user/hadoop/file8.zip

  • touchz: Creates a new, empty file of size 0 in the specified path.

    Usage:hdfs dfs -touchz <path>

    Example:hdfs dfs -touchz /user/hadoop/file12