????????? ??????Linux SSH????????ù??? ?????? Vertica 7.1??????????RHEL6.4?? ???У??????????????ssh??????????????????????????????????ssh???????????????????辡?????????????????????????????ж?ssh??????п??????á?
????????????????????ssh????????.
????1.???y??1??/etc/hosts???
????2.????1???2?????
????3.???y??1?????????
????4.??????????????ssh????
????1.???y??1??/etc/hosts???
???????1??/etc/hosts????????????????????IP???????????????????
????vi /etc/hosts
????192.168.56.102 JY-DB
????192.168.56.103 JY-DB2
????2.????1???2?????
????????1???????????????/usr/local/bin?????
???????1???????????????????????
cluster_copy_all_nodes
#!/bin/bash
SELF=`hostname`
if [ -z "$NODE_LIST" ]; then
echo
echo Error: NODE_LIST environment variable must be set in .bash_profile
exit 1
fi
for i in $NODE_LIST; do
if [ ! $i = $SELF ]; then
if [ $1 = "-r" ]; then
scp -oStrictHostKeyChecking=no -r $2 $i:$3
else
scp -oStrictHostKeyChecking=no $1 $i:$2
fi
fi
done
wait
???????2?????????????????????
cluster_run_all_nodes
#!/bin/bash
if [ -z "$NODE_LIST" ]; then
echo
echo Error: NODE_LIST environment variable must be set in .bash_profile
exit 1
fi
if [[ $1 = '--background' ]]; then
shift
for i in $NODE_LIST; do
ssh -oStrictHostKeyChecking=no -n $i "$@" &
done
else
for i in $NODE_LIST; do
ssh -oStrictHostKeyChecking=no $i "$@"
done
fi
wait
?????????????????????????
????chmod +x /usr/local/bin/cluster_*
????3.???y??1?????????
???????y??1???????????
????vi ~/.bash_profile
????export NODE_LIST='JY-DB JY-DB2'
??????????????е??????????г?????????μ???????????????????????????????????Ч??
????source ~/.bash_profile
????4.??????????????ssh????
????4.1 ?????ssh-keygen????RSA???????
????cluster_run_all_nodes "hostname; ssh-keygen -q -t rsa  -N "" -f  ~/.ssh/id_rsa"
????????????
????[root@JY-DB bin]# cluster_run_all_nodes "hostname ; ssh-keygen -q -t rsa  -N "" -f  ~/.ssh/id_rsa"
????root@jy-db's password:
????JY-DB
????root@jy-db2's password:
????JY-DB2
??????????????????????ssh????????????????????
????cluster_run_all_nodes "hostname ; rm -rf ~/.ssh"
????rm -rf ~/.ssh
????4.2 ?????е????????????????????key?????
??????192.168.56.102??л????
??????????????
????IP_NET="192.168.56."
????for((i=102;i<=103;i++))
????do
????ssh $IP_NET$i cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
????echo Summarize ssh info from $IP_NET$i into a single file.
????done
???????IP_NET????????ε??????for??????????????????IP??Χ????????????????
????????????????????????????е??????????
[root@JY-DB ~]# IP_NET="192.168.56."
[root@JY-DB ~]# for((i=102;i<=103;i++))
> do
> ssh $IP_NET$i cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
> echo Summarize ssh info from $IP_NET$i into a single file.
> done
root@192.168.56.102's password:
Summarize ssh info from 192.168.56.102 into a single file.
root@192.168.56.103's password:
Summarize ssh info from 192.168.56.103 into a single file.
????????????????????????key???????600????
????chmod 600 ~/.ssh/authorized_keys
????4.3 ??????????????л?????????key??????????????????????????
????cluster_copy_all_nodes ~/.ssh/authorized_keys ~/.ssh/
????4.4 ???ssh????
???????1???У?????????????????????????伴???
????cluster_run_all_nodes "hostname;date"
?????????ssh??????????????????ɡ?
?????????????????????????????????????????????????????????????1?????
??????????????1??????????????????
????cluster_copy_all_nodes ~/.bash_profile ~/
????cluster_copy_all_nodes /etc/hosts /etc
????cluster_copy_all_nodes /usr/local/bin/cluster_copy_all_nodes /usr/local/bin/
????cluster_copy_all_nodes /usr/local/bin/cluster_run_all_nodes /usr/local/bin/
????????????????????????????cluster_run_all_nodes???ssh???????
????cluster_run_all_nodes "hostname;date"