#!/bin/bash
#Date:2018-01-08
#Author:xxxxxx
#Function:xxxxxx
#Change:2018-01-17
# #设置忽略CTRL+C信号
trap 'my_exit;exit' SIGINT SIGTERM SIGQUIT #开启DEBUG模式
#set -x #如果有命令执行返回值为非0,那么脚本将结束,不再继续执行
# set -e #导入rsync使用的密码
export RSYNC_PASSWORD='xxxxxx' #设置脚本涉及的目录变量
pathdir=$(cd $(dirname $0);pwd)
#源主机同步到本机的临时目录
tmpdir='/data/migrate_tmp'
# tmpdir='/data/migrate_tmp/tmp' #测试用
#管理机
domain_m=("cms.domain.com" "pic.domain.com")
youxi_m=("/data1/www/abc.test.com" "/data1/www/pic.domain.com")
# youxi_m=("/data/migrate_tmp/abc.test.com" "/data/migrate_tmp/pic.domain.com") #测试用
#模板机
domain_t='cms.domain.com'
youxi_t='/data2/www/abc.test.com'
#web机
domain_web=''
youxi_web='/data/webapps'
#youxi_web='/data/migrate_tmp/webapps' #测试用
#图片机
domain_pic='pic.domain.com'
youxi_pic='/data/webapps/pic.domain.com' #判断临时目录是否存在,若不存在则创建
[ -d ${tmpdir} ] && rm -rf ${tmpdir}/* || mkdir -p ${tmpdir} #备份目录
# [ -d /data/fabuqi_bak ] && mkdir /data/fabuqi_bak #进入到脚本所在的目录
cd ${pathdir} #定义grep查找需要替换的文件列表正则
grep_re="img.dwstatic.com|img[1-5].dwstatic.com|pic[1-5].domain.com|pic[0-5]1.domain.com|public.domain.com|pic.domain.(com|cn)" #trap的执行函数
function my_exit(){
echo trap_handle_time: $(date "+%Y-%m-%d %H:%M:%S")
echo "exit"
} #脚本使用说明函数
function usage(){
echo "Usage: $0 [OPTIONS]"
echo " - Here to display help info ."
echo " - The args is only two ."
echo " - OPTIONS: [ all | zhuanqu_ID | 专区ID ] ."
echo " example: /bin/bash migrate.sh zxyzxy "
exit 1
} #logger function
function log_info(){
DATA_N=$(date "+%Y-%m-%d %H:%M:%S")
USER_N=$(whoami)
echo "${DATA_N} ${USER_N} execute $0 [INFO] $@" | tee -a ${pathdir}/migrate.log
} #配置变量函数,sync_dir是同步的源主机子目录,destdir是新发布器目标目录。
function config_and_rsync_single(){
#从源主机的哪个机器同步数据
rsync_from=${2}
#目标同步的目录
if [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
#拉取单个专区文件资源,保留文件时间属性
for i in `seq 0 $(expr ${#domain_m[*]} - 1)`
do
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_m[$i]}
destdir=${youxi_m[$i]}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,如果临时目录已经存在,就直接拷贝文件,如果不存在就创建临时目录在拷贝目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
[ -d ${tmpdir}/${sync_dir} ] && \cp -rpvu ${destdir}/* ${tmpdir}/${sync_dir} 2>>${pathdir}/migrate.log || mkdir -p ${tmpdir}/${sync_dir} && \cp -rpvu ${destdir}/* ${tmpdir}/${sync_dir} 2>>${pathdir}/migrate.log log_info "Start to get ${1} files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/${1} ${tmpdir}/${sync_dir} | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_single_id function ......"
update_single_id ${tmpdir}/${sync_dir} ${1} ${destdir}
done
log_info "建立专区对应的软连接 ..."
ln -nfs /data1/www/abc.test.com/${id} /data1/webapps/${id}.domain.com 2>>${pathdir}/migrate.log
chown -R www-data:www-data /data1/webapps/${id}.domain.com
elif [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_t}
destdir=${youxi_t}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir} 2>>${pathdir}/migrate.log log_info "Start to get ${1} files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/${1} ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_single_id function ......"
update_single_id ${tmpdir} ${1} ${destdir}
log_info "建立专区对应的软连接 ..."
ln -snf ${destdir}/${id} /data/data1/www/abc.test.com/${id}.domain.com 2>>${pathdir}/migrate.log
chown -R www-data:www-data /data/data1/www/abc.test.com/${id}.domain.com
elif [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_web}
destdir=${youxi_web}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir} 2>>${pathdir}/migrate.log log_info "Start to get ${1} files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${1}.domain.com ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_single_id function ......"
update_single_id ${tmpdir} ${1}.domain.com ${destdir} log_info "Start to backup ${1} nginx configure file......"
[ -d /data/services/nginx_vhost_bak ] || mkdir -p /data/services/nginx_vhost_bak
\cp -pvu /data/services/nginx_vhost/${1}.*.conf /data/services/nginx_vhost_bak/ 2>>${pathdir}/migrate.log
log_info "Start to rsync ${1} nginx configure file ......"
rsync -avuzt game_test@${rsync_from}::nginx_test/${1}.*.conf /data/services/nginx_vhost/
log_info "update the ${1} nginx conf,please to reload nginx service by manual ..."
# service nginx reload
else
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_pic}
destdir=${youxi_pic}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir} 2>>${pathdir}/migrate.log log_info "Start to get ${1} files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/${1} ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_single_id function ......"
update_single_id ${tmpdir} ${1} ${destdir}
fi
} #迁移单个专区函数
function update_single_id(){
_tmpdir=${1}
id=${2}
_destdir=${3}
cd ${_tmpdir}
log_info "replace contexts in the files that in the ${id} directory ..."
#判断目录是否为空
if [ "`ls -A ${_tmpdir}/${id}`" = "" ]; then
log_info "the ${id} is indeed empty."
#判断目录及其子目录是否为空
elif [ "`find ${_tmpdir}/${id}/* -type f`" = "" ]; then
log_info "the ${id} and subdir are empty."
#判断是否有文件需要做内容替换
elif [ "`grep -rEl ${grep_re} ${_tmpdir}/${id}/*`" = "" ]; then
log_info "the ${id} not files need to replace."
#不为空时执行修改文件内容操作
else
log_info "Start to sed ......"
sed -i -e 's/img\.dwstatic\.com/img\.game\.dwstatic\.com/g' \
-e 's/img\(.\)\.dwstatic\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/pic\(.\)\.domain\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/pic01\.domain\.com/img\.game\.dwstatic\.com/g' \
-e 's/pic\(.\)\(.\)\.domain\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/public\.domain\.com/publicgame\.domain\.com/g' \
-e 's/pic\.domain\.\(com\|cn\)/img\.game\.dwstatic\.com/g' $(grep -rEl ${grep_re} ${_tmpdir}/${id}/*)
fi if [ -d ${_destdir}/${id} ];then
log_info "the ${id} is a exist id,backup old ${id} dirs ..."
[ -d /data/fabuqi_bak/${id}_bak ] && log_info "the ${id}_bak is exist,not need to backup ..." || cp -rfp ${_destdir}/${id} /data/fabuqi_bak/${id}_bak
log_info "replace old ${id} dirs by new ${id} dirs ..."
#同步专区目录到新发布器目标目录中,只会在源文件的更改时间较目标文件更新时或是目标文件并不存在时,才复制文件,保留文件时间属性
\cp -rpvu ${_tmpdir}/${id}/* ${_destdir}/${id}/ | tee -a ${pathdir}/migrate.log
chown -R www-data:www-data ${_destdir}/${id}
else
log_info "the ${id} is a new id,not to backup."
#同步专区目录到新发布器目标目录中
\cp -rpvu ${_tmpdir}/${id} ${_destdir}/${id} | tee -a ${pathdir}/migrate.log
chown -R www-data:www-data ${_destdir}/${id}
fi log_info "update_single_id task done."
} #配置变量函数,sync_dir是同步的源主机子目录,destdir是新发布器目标目录。
function config_and_rsync_all(){
#从源主机的哪个机器同步数据
rsync_from=${1}
#目标同步的目录
if [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
#拉取所有专区文件资源,保留文件时间属性
for i in `seq 0 $(expr ${#domain_m[*]} - 1)`
do
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_m[$i]}
destdir=${youxi_m[$i]}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,如果临时目录已经存在,就直接拷贝文件,如果不存在就创建临时目录在拷贝目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
[ -d ${tmpdir}/${sync_dir} ] && \cp -rpvu ${destdir}/* ${tmpdir}/${sync_dir} || mkdir -p ${tmpdir}/${sync_dir} && \cp -rpvu ${destdir}/* ${tmpdir}/${sync_dir} log_info "Start to get ${sync_dir} all files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/* ${tmpdir}/${sync_dir} | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_all_id ${sync_dir} function ......"
update_all_id ${tmpdir}/${sync_dir} ${destdir}
done
for id in $(ls ${tmpdir}/${domain_m[0]})
do
log_info "建立专区对应的软连接 ..."
ln -nfs /data1/www/abc.test.com/${id} /data1/webapps/${id}.domain.com
chown -R www-data:www-data /data1/webapps/${id}.domain.com
done
elif [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_t}
destdir=${youxi_t}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir}/ log_info "Start to get all files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/* ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_all_id function ......"
update_all_id ${sync_dir} ${destdir}
for id in $(ls ${tmpdir}/${sync_dir})
do
log_info "建立专区对应的软连接 ..."
ln -snf ${destdir}/${id} /data/data1/www/abc.test.com/${id}.domain.com
chown -R www-data:www-data /data/data1/www/abc.test.com/${id}.domain.com
done
elif [[ "${rsync_from}" == "xxx.xxx.xxx.xxx" ]]; then
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_web}
destdir=${youxi_web}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir}/ log_info "Start to get all files ......"
rsync -avuzt game_test@${rsync_from}::game_test/* ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_all_id function ......"
update_all_id ${sync_dir} ${destdir} log_info "Start to backup all nginx configure file......"
\cp -r /data/services/nginx_vhost /data/services/nginx_vhost_bak
log_info "Start to rsync all nginx configure file ......"
rsync -avuzt game_test@${rsync_from}::nginx_test/* /data/services/nginx_vhost/
log_info "update the nginx conf,please to reload nginx service by manual ..."
# service nginx reload
else
log_info "set the sync_dir and destdir value ..."
sync_dir=${domain_pic}
destdir=${youxi_pic}
#备份目录
log_info "backup the destdir ..."
cp -rp ${destdir} ${destdir}_`date "+%Y%m%d%H%M%S"` #将目标目录拷贝到临时目录,为了保证sed处理之后文件时间改变不影响覆盖目标目录,所以将目标目录拷贝到临时目录处理之后再覆盖到目标目录中。
log_info "create tmpdir ..."
\cp -rpvu ${destdir}/* ${tmpdir}/ log_info "Start to get all files ......"
rsync -avuzt game_test@${rsync_from}::game_test/${sync_dir}/* ${tmpdir}/ | tee -a ${pathdir}/migrate.log
log_info "Start to execute update_all_id function ......"
update_all_id ${sync_dir} ${destdir}
fi
} #批量迁移所有专区的函数
function update_all_id(){
_tmpdir=${1}
_destdir=${2}
cd ${_tmpdir}
for id in $(ls ${_tmpdir}/)
do
if [[ ${id} == "ssss" || ${id} == "testsslj" ]]; then
log_info "skip the ${id}."
elif [[ -f ${_tmpdir}/${id} ]]; then
log_info "the ${_tmpdir}/${id} is a file,not dir,please check it and sync by manual."
else
log_info "migrate ${id} start..."
cd ${_tmpdir}/${id}
log_info "replace contexts in the files that in the ${id} directory ..."
#判断目录是否为空
if [ "`ls -A ${_tmpdir}/${id}`" = "" ]; then
log_info "the ${id} is indeed empty."
#判断目录及其子目录是否为空
elif [ "`find ${_tmpdir}/${id}/* -type f`" = "" ]; then
log_info "the ${id} and subdir are empty."
#判断是否有文件需要做内容替换
elif [ "`grep -rEl ${grep_re} ${_tmpdir}/${id}/*`" = "" ]; then
log_info "the ${id} not files need to replace."
#不为空时执行修改文件内容操作
else
log_info "Start to sed ......"
sed -i -e 's/img\.dwstatic\.com/img\.game\.dwstatic\.com/g' \
-e 's/img\(.\)\.dwstatic\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/pic\(.\)\.domain\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/pic01\.domain\.com/img\.game\.dwstatic\.com/g' \
-e 's/pic\(.\)\(.\)\.domain\.com/img\1\.game\.dwstatic\.com/g' \
-e 's/public\.domain\.com/publicgame\.domain\.com/g' \
-e 's/pic\.domain\.\(com\|cn\)/img\.game\.dwstatic\.com/g' $(grep -rEl ${grep_re} ${_tmpdir}/${id}/*)
fi if [ -d ${_destdir}/${id} ]; then
log_info "the ${id} is a exist id,backup old ${id} dirs ..."
[ -d /data/fabuqi_bak/${id}_bak ] && log_info "the ${id}_bak is exist,not need to backup ..." || cp -rfp ${_destdir}/${id} /data/fabuqi_bak/${id}_bak
log_info "replace old ${id} dirs by new ${id} dirs ..."
#同步专区目录到新发布器目标目录中,只会在源文件的更改时间较目标文件更新时或是目标文件并不存在时,才复制文件,保留文件时间属性
\cp -rpvu ${tmpdir}/${1}/${id}/* ${_destdir}/${id}/ | tee -a ${pathdir}/migrate.log
chown -R www-data:www-data ${_destdir}/${id}
else
log_info "the ${id} is a new id,not to backup."
#同步专区目录到新发布器目标目录中
\cp -rpvu ${tmpdir}/${1}/${id} ${_destdir}/${id} | tee -a ${pathdir}/migrate.log
chown -R www-data:www-data ${_destdir}/${id}
fi log_info "migrate ${id} end..."
fi
done
log_info "update_all_id task done."
} #主函数
function main(){
domain_ip=("xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx")
youxi_ip=("xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx" "xxx.xxx.xxx.xxx")
#限制执行脚本的ip,并且制定对应的新管理机从源主机管理机拉取文件,其他类型的机器一样,否则,不执行脚本。
for index in `seq 0 $(expr ${#domain_ip[*]} - 1)`
do
if [ $(ifconfig | grep ${youxi_ip[$index]} | wc -l) -eq 1 ]; then
ip=${domain_ip[$index]}
break
else
ip="error_x"
continue
fi
done if [ $# -ne 1 ]; then
usage
# elif [[ ${1} == "all" ]]; then
# config_and_rsync_all ${2}
elif [[ ${1} == "ssss" || ${1} == "testsslj" ]]; then
log_info "skip the ${1}."
else
if [[ ${ip} == "error_x" ]]; then
log_info "this host $(ifconfig | grep 'inet addr'|awk '{print $2}'| awk -F: '{print $2}'| grep -vE '^$' | head -1) no exist youxi_ip list,please add this ip to youxi_ip on this scripts."
else
config_and_rsync_single ${1} ${ip}
fi
fi
} #执行主函数
main $@

【原创】一个shell脚本记录(实现rsync生产文件批量迁移功能)的更多相关文章

  1. Shell脚本:使用rsync备份文件/目录

    本文我们介绍一个shell脚本,用来使用rsync命令将你本地Linux机器上的文件/目录备份到远程Linux服务器上.使用该脚本会以交互的方式实施备份,你需要提供远程备份服务器的主机名/ip地址和文 ...

  2. 向大家分享一个shell脚本的坑

    打算在跳板机上写一个shell脚本,批量检查远程服务器上的main进程是否在健康运行中. 先找出其中一台远程机器,查看main进程运行情况 [root@two002 tmp]# ps -ef|grep ...

  3. shell脚本中执行另一个shell脚本

    分类: 可以在一个shell脚本中执行另一个shell脚本(或非可执行文件,主要用于取得一些变量的值),方法是: . 文件名(包括路径) 或 变量=文件名(包括路径) . $变量   注意,圆点后面有 ...

  4. 编写第一个 Shell 脚本

    什么是 Shell 脚本? 一个 shell 脚本就是一个包含一系列命令的文件.shell 读取这个文件,然后执行 文件中的所有命令,就好像这些命令已经直接被输入到了命令行中一样. 怎样编写一个 Sh ...

  5. Shell教程 之第一个shell脚本

    1.第一个shell脚本 打开文本编辑器(可以使用 vi/vim 命令来创建文件),新建一个文件 test.sh,扩展名为 sh(sh代表shell),扩展名并不影响脚本执行 输入一些代码 #!/bi ...

  6. 编写第一个Shell脚本【TLCL】

    怎样编写一个 Shell 脚本 编写一个脚本 使脚本文件可执行 把脚本放到Shell能够找到的地方 脚本文件格式 #!/bin/bash # This is our first script. ech ...

  7. Linux Shell系列教程之(二)第一个Shell脚本

    本文是Linux Shell系列教程的第(二)篇,更多shell教程请看:Linux Shell系列教程 通过上一篇教程的学习,相信大家已经能够对shell建立起一个大体的印象了,接下来,我们通过一个 ...

  8. Shell脚本调用ftp上传文件

    Shell脚本调用ftp上传文件 1.脚本如下 ftp -n<<! open x.x.x.x ###x.x.x.x为ftp地址 user username password ###user ...

  9. 每秒执行一个shell脚本(转载)

      上周迁移了一台服务器,发现其中一个项目的数据没有更新,查询原服务器的数据,数据有更新,并找到了rsync服务,从其他服务器传输数据,那么如何找到这台服务器?因为是从远程传输到本地,而且不是很频繁, ...

随机推荐

  1. Linux目录结构及文件操作

    Linux文件目录遵循FHS标准 绝对路径:从根目录开始的路径:相对目录:从当前路径开始的路径 .表示当前目录,..表示上级目录,~表示当前用户的home目录,pwd获得当前绝对路径 新建文件 tou ...

  2. iOS密码框的实现方式

    说一下密码加密的实现方式   效果图:           实现方式:   主要说一下密码框的实现,这个密码框中间的四个数字其实是4个 UITextField ,然后通过键盘删除键 和TextFile ...

  3. 利用js参数,保持客户端文件的新鲜度

    不知道你是否碰到过如下情况,在服务端更新了一个重要的js文件后,由于浏览器的缓存机制,导致用户始终不能获取到最新的文件,此时的你恨不得有孙悟空吹毛化身的法术,帮用户清除浏览器的缓存.缓存既是程序员的好 ...

  4. Docker最全教程之使用Node.js搭建团队技术文档站(二十三)

    前言 各种编程语言均有其优势和生态,有兴趣的朋友完全可以涉猎多门语言.在平常的工作之中,也可以尝试选择相对适合的编程语言来完成相关的工作. 在团队技术文档站搭建这块,笔者尝试了许多框架,最终还是选择了 ...

  5. Java开发桌面程序学习(三)——基于Jfoenix库的JFXDialog封装仿Android对话框的工具DialogBuilder

    对话框的封装使用 最近写了个JFXUtils,DialogBuilder也是包含在里面了 JFXUtils的Github 前言 登录需要弹出登录对话框,但是,Jfoenix库使用对话框比较难受,还得动 ...

  6. ORACLE(系统表student) 基本与深入学习

    (一).首先我们先创建student表(系统有的可以跳过往下看)没有直接复制运行即可. create table student(sno varchar2(3) not null, --学号sname ...

  7. 13 CSS样式权重问题

    <!-- 权重问题整体说明: 1.权重的意义:判定CSS属性的优先级高低,也就是说判定那个CSS的属性优先显示,将其他的低优先级的CSS样式覆盖掉. 2.如何判断权重:数选择器的数量,按照Id选 ...

  8. Storm —— 单机环境搭建

    1. 安装环境要求 you need to install Storm's dependencies on Nimbus and the worker machines. These are: Jav ...

  9. Spark学习之路(十五)—— Spark Streaming 整合 Flume

    一.简介 Apache Flume是一个分布式,高可用的数据收集系统,可以从不同的数据源收集数据,经过聚合后发送到分布式计算框架或者存储系统中.Spark Straming提供了以下两种方式用于Flu ...

  10. Sqoop 简介与安装

    一.Sqoop 简介 Sqoop是一个常用的数据迁移工具,主要用于在不同存储系统之间实现数据的导入与导出: 导入数据:从MySQL,Oracle等关系型数据库中导入数据到HDFS.Hive.HBase ...