sshpass和做软链接
参考:
https://help.aliyun.com/document_detail/54530.html?spm=5176.11065259.1996646101.searchclickresult.d5d847dbBVUcQJ&aly_as=SCLlYD_p#title-k89-hb2-5zf
-L file #测试file是否为符号化(软)链接
$# 默认参数是否符合,不符合提示
sh deploy.sh <master_ip> master_password_file
deploy.sh:脚本名称,内容见下面代码。
master_ip:集群的 Master 节点的 IP,请确保可以访问。
master_password_file:保存 Master 节点的密码文件,将 Master 节点的密码直接写在文件内即可。
#!/usr/bin/bash
if [ $# != 2 ]
then
echo "Usage: $0 master_ip master_password_file"
exit 1;
fi
masterip=$1
masterpwdfile=$2
if ! type sshpass >/dev/null 2>&1; then
yum install -y sshpass
fi
if ! type java >/dev/null 2>&1; then
yum install -y java-1.8.0-openjdk
fi
mkdir -p /opt/apps
mkdir -p /etc/ecm
mkdir -p /usr/lib/bigboot-current/conf
echo "Start to copy package from $masterip to local gateway(/opt/apps)"
echo " -copying hadoop-2.7.2"
sshpass -f $masterpwdfile scp -r -o 'StrictHostKeyChecking no' root@$masterip:/usr/lib/hadoop-current /opt/apps/
echo " -copying hive-2.0.1"
sshpass -f $masterpwdfile scp -r root@$masterip:/usr/lib/hive-current /opt/apps/
echo " -copying spark-2.1.1"
sshpass -f $masterpwdfile scp -r root@$masterip:/usr/lib/spark-current /opt/apps/
echo "Start to link /usr/lib/\${app}-current to /opt/apps/\${app}"
if [ -L /usr/lib/hadoop-current ]
then
unlink /usr/lib/hadoop-current
fi
ln -s /opt/apps/hadoop-current /usr/lib/hadoop-current
if [ -L /usr/lib/hive-current ]
then
unlink /usr/lib/hive-current
fi
ln -s /opt/apps/hive-current /usr/lib/hive-current
if [ -L /usr/lib/spark-current ]
then
unlink /usr/lib/spark-current
fi
ln -s /opt/apps/spark-current /usr/lib/spark-current
echo "Start to copy conf from $masterip to local gateway(/etc/ecm)"
sshpass -f $masterpwdfile scp -r root@$masterip:/etc/ecm/hadoop-conf /etc/ecm/hadoop-conf
sshpass -f $masterpwdfile scp -r root@$masterip:/etc/ecm/hive-conf /etc/ecm/hive-conf
sshpass -f $masterpwdfile scp -r root@$masterip:/etc/ecm/spark-conf /etc/ecm/spark-conf
echo "Start to copy environment from $masterip to local gateway(/etc/profile.d)"
sshpass -f $masterpwdfile scp root@$masterip:/etc/profile.d/hdfs.sh /etc/profile.d/
sshpass -f $masterpwdfile scp root@$masterip:/etc/profile.d/yarn.sh /etc/profile.d/
sshpass -f $masterpwdfile scp root@$masterip:/etc/profile.d/hive.sh /etc/profile.d/
sshpass -f $masterpwdfile scp root@$masterip:/etc/profile.d/spark.sh /etc/profile.d/
sshpass -f $masterpwdfile scp root@$masterip:/usr/lib/bigboot-current/conf/smartdata-site.xml /usr/lib/bigboot-current/conf/
if [ -L /usr/lib/jvm/java ]
then
unlink /usr/lib/jvm/java
fi
echo "" >>/etc/profile.d/hdfs.sh
echo export JAVA_HOME=/usr/lib/jvm/jre-1.8.0 >>/etc/profile.d/hdfs.sh
echo "Start to copy host info from $masterip to local gateway(/etc/hosts)"
sshpass -f $masterpwdfile scp root@$masterip:/etc/hosts /etc/hosts_bak
cat /etc/hosts_bak | grep emr | grep cluster >>/etc/hosts
if ! id hadoop >& /dev/null
then
useradd hadoop
fi
sshpass和做软链接的更多相关文章
- sshpass做秘钥分发,ansible做自动化运维工具
最近公司机器的增多,顺便还要上报表系统,考虑到服务器越来越多,手工的管理显得越来的越吃力,所以打算推进公司自动化运维工具的使用. 推进的过程中,一步一个坑踩过来的.由于公司之前未运用过自动化运维工具, ...
- 一台服务器多实例mysql做主从复制
在一台服务器上开两个端口的mysql(3306.3307),做成主从复制环境 1)安装mysql(安装过程这里就不做过多介绍) 参考:http://www.cnblogs.com/kevingrace ...
- Linux中的链接文件_软链接和硬链接
一.链接文件介绍 Linux操作系统中的“链接文件”分为硬链接(hard link)和软链接(symbolic link).两种链接的本质区别在于inode.以下是详细介绍: 硬链接:当系统要读取一个 ...
- Linux系统——硬链接与软链接
文件属性软硬连接: 链接有两种,一种为硬链接(Hard Link),另一种为软链接或符号链接(Symbolic Link或Soft Link). 建立硬链接时,链接文件和被链接文件必须位于同一个文件系 ...
- 特殊权限set_uid、set_gid、stick_bit、软链接、硬链接文件 使用介绍
第2周第4次课(3月29日) 课程内容:2.18 特殊权限set_uid2.19 特殊权限set_gid2.20 特殊权限stick_bit2.21 软链接文件2.22 硬链接文件 2.18 ...
- devops持续集成
目录 Devops 版本控制系统 Git安装 Git使用 git四种状态 git基础命令 git分支 git合并冲突 git标签 git命令总结 Github使用 创建仓库 HTTP协议 SSH协议 ...
- k8s之ansible安装
项目地址:https://github.com/easzlab/kubeasz #:先配置harbor #:利用脚本安装docker root@k8s-harbor1:~# vim docker_in ...
- MySQL 系列(一) 生产标准线上环境安装配置案例及棘手问题解决
一.简介 MySQL是最流行的开放源码SQL数据库管理系统,它是由MySQL AB公司开发.发布并支持的.有以下特点: MySQL是一种数据库管理系统. MySQL是一种关联数据库管理系统. MySQ ...
- 在linux上部署web环境
1.升级python到2.7版本(通过源码包重新安装一个2.7版本的python):wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9. ...
随机推荐
- spring@Async注解实现异步方法调用
概述 如何实现异步方法调用,很多人首先会想到使用线程或者线程池技术,springboot中有一个很简单的方法可以实现异步方法调用,那就是在方法上使用@Async注解 例子 首先在Springboot启 ...
- Java进阶知识10 Hibernate一对多_多对一双向关联(Annotation+XML实现)
本文知识点(目录): 1.Annotation 注解版(只是测试建表) 2.XML版 的实现(只是测试建表) 3.附录(Annotation 注解版CRUD操作)[注解版有个问题:插入值时 ...
- 洛谷 P4933 大师
题面 (实名推荐:本题的出题人小哥哥打球暴帅哦!(APIO/CTSC/WC的时候一起打过球w,而且大学在我隔壁喔) ) 没仔细看数据范围的时候真是摸不着头脑...还以为要 O(N^2) dp 爆锤.. ...
- 数据结构实验之链表六:有序链表的建立(SDUT 2121)
#include <bits/stdc++.h> using namespace std; struct node { int data; struct node *next; }; in ...
- php shmop windows 信号量锁
if (!function_exists('sem_get')) { function sem_get($key) { return fopen(__FILE__ . '.sem.' . $key, ...
- 在浏览器上打开、预览Excel xlsx表格文件
现在的HTML5,有了FileReader文件读写API, 真是让javascript的能力大幅提升. 解析zip压缩文件.解析Excel xlsx 表格文档各种文件预览,实现起来也有了可能性,以前的 ...
- Windows 10 共享需要网络凭据的问题
如果Windows在资源管理器的网络中双击其他的网络设备,提示要输入网络凭据的解决办法: 打开"网络共享中心" -> "更改高级共享设置"->&qu ...
- solr安装记录
[root@localhost bin]# ./solr start -force*** [WARN] *** Your open file limit is currently 1024. It ...
- swoole入门简介
原文:https://www.cnblogs.com/dormscript/p/4811921.html 本文主要记录一下学习swoole的过程.填过的坑以及swoole究竟有多么强大! 首先说一下对 ...
- QList和QVector等容器的区别
QList和QVector等容器的区别. 1.大多数情况下可以用QList.像prepend()和insert()这种操作,通常QList比QVector快的多.这是因为QList是基于index标签 ...