Batch deploy ssh Authentication

Source: Internet
Author: User

Batch deployment of ssh authentication I think that when we build a hadoop cluster, everyone will encounter a problem. manually configure ssh two-way authentication. When the cluster size is very small, we can still endure it, but should I manually configure dozens or even hundreds of nodes? Therefore, we recommend that you use scripts to solve this problem in batches. There are a lot of related answers on the network, but they are not very easy to use. Here, we will record them. 1, install required rpm package, tcl-8.4.13-3.ML5.x86_64.rpm, expect-5.43.0-8.el5.x86_64.rpm, I use linux for redhat6.1 x86_64, tested no problem 2, script code Java code #! /Bin/bash #2013-09 # create a local public key if [! -D/root /. ssh]; then login CT-c "spawn ssh-keygen-t dsa login CT {\" * key * \ "{send \" \ r \"; exp_continue} \ "* passphrase * \" {send \ "\ r \"; exp_continue} \ "* again * \" {send \ "\ r \";}} "fi ssh-add ~ /. Ssh/id_dsa # private key to be manually loaded # create for p in batch ssh authentication $ (cat/root/ip.txt) absolute path of the ip.txt file do ip =$ (echo "$ p" | cut-f1-d ":") secret to obtain the IP address password in the ip.txt File $ (echo "$ p" | cut-f2-d ":") obtain the password in the ip.txt file # verify CT automatically starts to interact with each other and starts verify CT-c "spawn ssh-copy-id-I/root /. ssh/id_dsa.pub root @ $ ip Route CT {\ "* yes/no * \" {send \ "yes \ r \"; exp_continue} \ "* password * \" {send \ "$ password \ r \"; exp_continue} \ "* Password * \" {send \ "$ password \ r \";}} "ssh root @ $ ip '/root/slave_master.sh' # Call the remote script done 3. ip.txt to deploy the ip address + password Java code 10.185.224.105: 123456 10.185.224.104: 123456 10.185.224.103: 123456 4, it means there is no difference between scripts on the remote node and the local script. You need to use scripts to copy the remote script before deployment.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.