Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the small scripts commonly used in Hadoop deployment

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "what are the small scripts commonly used in Hadoop deployment". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Recently abandoned the non-ssh connection of Hadoop cluster deployment, or returned to the way of using ssh key authentication. There is some trouble here. Every machine has to upload the public key. I am also a very lazy person, so write a few small scripts to complete, as long as on a machine can do the distribution of public keys.

The first step is to generate the ssh key script:

#! / bin/sh ssh-keygen-t rsa-P''- f ~ / .ssh/id_rsa cp ~ / .ssh/id_rsa.pub ~ / .ssh/authorized_keys

Generally speaking, ssh-keygen needs to enter passphrase, but there are usually three returns. I am lazy to enter and add-P''.

Then there is the script that adds the public key to the slave node:

#! / bin/sh read-p "enter remote server IP:" ip ssh-copy-id-o StrictHostKeyChecking=no-I ~ / .ssh/id_rsa.pub root@$ip ssh root@$ip 'sed-I "s / ^ # RSAAuthentication\ yes/RSAAuthentication\ yes/g" / etc/ssh/sshd_config' ssh root@$ip' sed-I "s / ^ # PubkeyAuthentication\ yes/PubkeyAuthentication yes/g" / etc/ssh/sshd_config' ssh root@$ip 'sed-I "s / ^ # PermitRootLogin\ yes/PermitRootLogin\ yes/g "/ etc/ssh/sshd_config' ssh root@$ip 'service sshd restart' hostname= `ssh root@$ {ip}' hostname' `echo" add hostname and IP to the local / etc/hosts file "echo" $ip $hostname "> > / etc/hosts echo" remote host name is $hostname Please check / etc/hosts to make sure that the hostname and IP are added to the host list file "echo" host public key copy complete "

Then the third script reads the list of hosts and copies / etc/hosts to all hosts:

#! / bin/sh cat / etc/hosts | while read LINE do ip= `echo $LINE | awk'{print $1}'| grep-v ":" | grep-v "127.0.0.1" `echo "Copying / etc/hosts to ${ip}" scp-o StrictHostKeyChecking=no / etc/hosts root@$ {echo}: / etc/ done "what are the mini scripts commonly used in Hadoop deployment? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report