[root@Temence ~]# w
19:28:05 up 45 days, 9:20, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 117.136.66.76 19:27 0.00s 0.00s 0.00s w
load average系统负载值
第一个数值表示1分钟内系统的平均负载值
第二个数值表示 5 分钟内系统的平均负载值
第三个数值表示15分钟系统的平均负载值
这个值的意义是,单位时间段内CPU活动进程数。当然,这个值越大就说明服务器压力越大,一般情况下这个值只要不超过服务器的 cpu 数量就没有关系
[root@localhost ~]# cat /proc/cpuinfo
逻辑CPU数值,查看 processor值
物理cpu查看关键字physical id
uptime 命令同样也可以查看系统负载,实际上 uptime 得出的结果和 w 的第一行是一致的
w 查看的是系统整体上的负载,但是具体是
哪里(CPU, 内存,磁盘等)有压力就无法判断了。通过 vmstat 就可以知道具体是哪里有压力。vmstat 命
令打印的结果共分为 6 部分:procs, memory, swap, io, system, cpu。请重点关注一下 r b si so bi bo
几列。
[root@localhost ~]# vmstat 1 4
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1451332 1112 228832 0 0 8 1 19 29 0 0 100 0 0
0 0 0 1451332 1112 228832 0 0 0 0 39 47 0 0 100 0 0
0 0 0 1451332 1112 228832 0 0 0 0 28 41 0 0 100 0 0
0 0 0 1451332 1112 228832 0 0 0 0 28 35 0 0 100 0 0
r:run表示运行和等待cpu时间片的进程数。如果长期大于服务器 cpu 的个数,则说明 cpu 不够用了。
b:表示等待资源的进程数。比如,等待I/O、内存等,这列的值如果长时间大于 1,则需要关注一下
了
swpd:表示切换到交换分区中的内存数量
free:当前空闲的内存数量
buff:缓冲大小,(即将写入磁盘的)
cache:缓存大小,(从磁盘中读取的
si:由交换区写入到内存的数据量
so:由内存写入到交换区的数据量
bi:从块设备读取数据的量(读磁盘)
bo:从块设备写入数据的量(写磁盘)
in:表示在某一时间间隔中观测到的每秒设备中断数
cs:表示每秒产生的上下文切换次数
us:显示了用户下所花费 cpu 时间的百分比
sy:显示系统花费 cpu 时间百分比
id:表示 cpu 处于空闲状态的时间百分比
wa:表示 I/O 等待所占用 cpu 时间百分比
st:表示被偷走的 cpu 所占百分比(一般都为 0,不用关注)
动态监控进程所占系统资源,每隔 3 秒变一次,需要关注以下几项:%CPU、 %MEM、COMMAND
top -bn1 它表示非动态打印系统资源使用情况,可以用在 shell 脚本中
监控系统所有资源状态。比如,平均负载、网卡流量、磁盘状态、内存使用等。可以打印历史信息,可以显示当天从零点开始到当前时刻的系统状态信息。如果你的系统没有安装这个命令,请使用yum install -y syssta命令安装。初次使用 sar 命令会报错,那是因为 sar 工具还没有生成相应的数据库文件
[root@localhost ~]# sar -n DEV
Linux 3.10.0-514.el7.x86_64 (localhost.localdomain) 2017年07月11日 _x86_64_ (2 CPU)
07时30分01秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
07时40分01秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
07时40分01秒 ens33 0.23 0.21 0.02 0.03 0.00 0.00 0.00
07时50分01秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
07时50分01秒 ens33 0.09 0.09 0.01 0.01 0.00 0.00 0.00
平均时间: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: ens33 0.16 0.15 0.01 0.02 0.00 0.00 0.00
IFACE 表示设备名称
rxpck/s 表示每秒进入收取的包的数量
txpck/s 表示每秒发送出去的包的数量
rxKB/s 表示每秒收取的数据量(单位 KByte)
txKB/s 表示每秒发送的数据量
查看某一天的网卡流量历史,使用-f 选项,后面跟文件名
在/var/log/sa/目录下:
[root@localhost ~]# sar -n DEV -f /var/log/sa/sa20
查看服务器在过去的某个时间的负载状况。
[root@localhost ~]# sar -q
Linux 3.10.0-514.el7.x86_64 (localhost.localdomain) 2017年07月11日 _x86_64_ (2 CPU)
07时30分01秒 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked
07时40分01秒 0 203 0.00 0.01 0.05 0
07时50分01秒 2 202 0.04 0.03 0.05 1
平均时间: 1 202 0.02 0.02 0.05 0
监控网卡流量,需要安装 :
yum install -y epel-release 扩展源
yum install -y nload
可以使用左右方向键切换网卡,按q退出
[root@Temence ~]# yum install -y sysstat
iostat 1 一秒打印一次io状态
iostat -x 需要关注%util这个值,io等待百分比
动态显示IO排行榜
[root@Temence ~]# yum install -y iotop
当前系统的总内存大小以及使用内存的情况
[root@Temence ~]# free
total used free shared buff/cache available
Mem: 262144 6220 97584 2632 158340 160792
Swap: 131072 1812 129260
total=used+free+buff/cache
avaliable = free+buff/cache
-m 单位kb显示
-h 选择合适单位
关于buff/cache
磁盘数据 --> 内存(cache)--> cpu
cpu --> 内存(buff)--> 磁盘数据
检测系统进程
[root@Temence ~]# ps aux |grep httpd
root 5082 0.0 0.3 8988 812 pts/0 S+ 13:20 0:00 grep --color=auto http
[root@Temence ~]# ps -efl 与 ps aux类似
PID :进程的 id,杀掉进程kill -9 pid
STAT :表示进程的状态,主要有以下几个状态:
D 不能中断的进程(通常为 IO)
R 正在运行中的进程
S 已经中断的进程,通常情况下,系统中大部分进程都是这个状态
T 已经停止或者暂停的进程,如果我们正在运行一个命令,比如说 sleep 10 如果我们按一下 ctrl -z 让
他暂停,那么我们用 ps 查看就会显示 T 这个状态
W 这个好像是说,从内核 2.6xx 以后,表示为没有足够的内存页分配
X 已经死掉的进程(这个好像从来不会出现)
Z 僵尸进程,杀不掉,打不死的垃圾进程,占系统一小点资源,不过没有关系。如果太多,就有问题了。一般不会出现。
< 高优先级进程
N 低优先级进程
L 在内存中被锁了内存分页
s 主进程
l 多线程进程
+ 代表在前台运行的进程
打印网络连接状况、系统所开放端口、路由表等信息。
netstat -lnp 打印当前系统启动哪些端口,包括socket套接字文件
netstat -an 打印所有的网络连接状况
[root@Temence ~]# netstat -an | awk '/^tcp/ {++sta[$NF]} END {for(key in sta) print key,"\t",sta[key]}'
ss -an与netstat类似
tcpdump 和 tshark 工具
[root@Temence ~]# tcpdump -nn -i ens33
第一个n 将ip已数字形式显示出来,不加显示为主机名
[root@Temence ~]# tcpdump -nn -i ens33 host 192.168.1.33 and port 80 -c 100 -w 1.cap
host 指定 ip
port 指定端口
not port 过滤掉端口
可以使用and连接条件
-c 指定包数量
-w 写入指定文件里,使用tcp -r 1.cap查看包内容
tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e
扩展tcp三次握手四次挥手
tshark几个用法
centos7 默认没有该条命令
需要安装 yum install net-tools
否则只能使用ip addr查看ip信息
-a 查看所有一致网络信息,包括down状态的网卡
针对单独网卡进行操作
ifdown ens33
ifup ens33
拷贝网卡配置文件,并修改配置文件名ens33\:1
修改配置文件内容主要修改NAME、DEVICE字段值
然后重启网络 ifdown ens33 && ifup ens33
[root@Temence ~]# mii-tool ens33
SIOCGMIIPHY on 'venet0' failed: Operation not supported
如果出现以上使用下面命令
[root@Temence ~]# ethtool ens33
主机名配置文件 /etc/hostname
[root@Temence ~]# hostnamectl set-hostname Duke
该文件每次重启后会被网卡配置文件里DNS覆盖
[root@Temence ~]# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 74.82.42.42
nameserver 4.2.2.1
nameserver 8.8.4.4
本地域名解析,可以指定任意IP 域名对应关系,支持一个ip 多个域名
[root@Temence ~]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4
# Auto-generated hostname. Please do not remove this comment.
23.106.155.35 Temence
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Centos7中默认将原来的防火墙iptables升级为了firewalld,firewalld跟iptables比起来至少有两大好处:
1、firewalld可以动态修改单条规则,而不需要像iptables那样,在修改了规则后必须得全部刷新才可以生效;
2、firewalld在使用上要比iptables人性化很多,即使不明白“五张表五条链”而且对TCP/IP协议也不理解也可以实现大部分功能。
编辑配置文件:/etc/selinux/config
临时关闭: setenforce 0
获取selinux状态: getenfore
firewalld自身并不具备防火墙的功能 和iptables一样需要通过内核的netfilter来实现
firewalld和 iptables一样,作用都是用于维护规则,真正使用规则干活的是内核的netfilter,只不过firewalld和iptables的结构以及使用方法不一样罢了
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# yum install -y iptables-services
[root@localhost ~]# systemctl start iptables.service
iptables内置了4个表,即filter表、nat表、mangle表、raw表、security表(centos6版本无该表),分别用于实现包过滤,网络地址转换、包重构(修改)、数据跟踪处理、安全管理
表和链的关系
链(chains)是数据包传播的路径,每一条链其实就是众多规则中的一个检查清单,每一条链中可以有一 条或数条规则。当一个数据包到达一个链时,iptables就会从链中第一条规则开始检查,看该数据包是否满足规则所定义的条件。如果满足,系统就会根据 该条规则所定义的方法处理该数据包;否则iptables将继续检查下一条规则,如果该数据包不符合链中任一条规则,iptables就会根据该链预先定 义的默认策略来处理数据包。
规则表
1.filter表——三个链:INPUT、FORWARD、OUTPUT
作用:过滤数据包 内核模块:iptables_filter.
2.Nat表——三个链:PREROUTING、POSTROUTING、OUTPUT
作用:用于网络地址转换(IP、端口) 内核模块:iptable_nat
3.Mangle表——五个链:PREROUTING、POSTROUTING、INPUT、OUTPUT、FORWARD
作用:修改数据包的服务类型、TTL、并且可以配置路由实现QOS内核模块:iptable_mangle(别看这个表这么麻烦,咱们设置策略时几乎都不会用到它)
4.Raw表——两个链:OUTPUT、PREROUTING
作用:决定数据包是否被状态跟踪机制处理 内核模块:iptable_raw
1.INPUT——进来的数据包应用此规则链中的策略
2.OUTPUT——外出的数据包应用此规则链中的策略
3.FORWARD——转发数据包时应用此规则链中的策略
4.PREROUTING——对数据包作路由选择前应用此链中的规则 (记住!所有的数据包进来的时侯都先由这个链处理)
5.POSTROUTING——对数据包作路由选择后应用此链中的规则(所有的数据包出来的时侯都先由这个链处理)
规则配置文件路径为:/etc/sysconfig/iptables
- 常用参数
iptables -nvL 查看规则
iptables -F 暂时清除规则,重启后失效
service iptables save 保存当前规则
iptables -Z 清除iptables过滤计数器]
iptables [-t 表名] 命令选项 [链名] [条件匹配] [-j 目标动作]
[root@localhost ~]# iptables -A INPUT -s 10.72.11.12 -p tcp --sport 1234 -d 10.72.137.159 --dport 80 -j DROP
省略-t 针对filter 表
-A 表示增加一条规则
-I 表示插入一条规则
-D 删除一条规则
-s 源地址
-p 协议(tcp, udp, icmp)
--sport/--dport 后跟源端口/目标端口
-d 目的地址
-i 指定网卡
-j 动作(DROP 即把包丢掉,REJECT即包拒绝,ACCEPT 即允许包)。
-i 指定网卡
iptables -P INPUT DROP
# iptables -nvL --line-numbers
# iptables -D INPUT 1
利用iptables计数器实现基于端口的网络流量统计
[root@localhost ~]# cat /usr/local/sbin/iptables.sh
#! /bin/bash
ipt="/sbin/iptables"
$ipt -F
$ipt -P INPUT DROP
$ipt -P OUTPUT ACCEPT
$ipt -P FORWARD ACCEPT
$ipt -A INPUT -s 192.168.137.0/24 -p tcp --dport 22 -j ACCEPT
$ipt -A INPUT -p tcp --dport 80 -j ACCEPT
$ipt -A INPUT -p tcp --dport 21 -j ACCEPT
如果想开机启动时初始化防火墙*规则,则需要在 /etc/rc.d/rc.local 中添加一行 ―/bin/sh /usr/local/sbin/iptables.sh
A机器两块网卡ens33(192.168.133.130)、ens37(192.168.100.1),ens33可以上外网,ens37仅仅是内部网络,B机器只有ens37(192.168.100.100),和A机器ens37可以通信互联
1.需求一:可以让B机器连接外网
A机器上打开路由转发 echo "1">/proc/sys/net/ipv4/ip_forward
A上执行 iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -o ens33 -j MASQUERADE
2.需求二:C机器只能和A通信,让C机器可以直接连通B机器的22端口
A上打开路由转发echo "1">/ proc/sys/net/ipv4/ip_forward
A上执行iptables -t nat -A PREROUTING -d 192.168.133.130 -p tcp --dport 1122 -j DNAT --to 192.168.100.100:22
A上执行iptables -t nat -A POSTROUTING -s 192.168.100.100 -j SNAT --to 192.168.133.130
B上设置网关为192.168.100.1
service iptables save
将规则保存至/etc/sysconfig/iptables中
将规则保存至另外的一份文件中
iptables-save > myipt.rule
iptables-restore < myipt.rule
[root@localhost ~]# systemctl disable iptables 禁止
[root@localhost ~]# systemctl stop iptables 停用
[root@localhost ~]# systemctl enable firewalld 允许
[root@localhost ~]# systemctl start firewalld 开启
[root@localhost ~]# firewall-cmd --get-zones
work drop internal external trusted home dmz public block
[root@localhost ~]# firewall-cmd --get-default-zone
public
drop(丢弃):任何接收的网络数据包都被丢弃,没有任何回复,仅能有发送出去的网络连接。
block(限制):任何接收的网络连接都被IPv4的icmp-host-prohibited信息和IPv6的icmp6-adm-prohibited信息所拒绝。
public(公共):在公共区域内使用,不能相信网络内其他计算机不会对您的计算机造成危害,只能接收经过选择的连接。
external(外部):特别是为路由器启用了伪装功能的外部网,您不能信任来自网络的其他计算机,不能想他他们不会对你的计算机造成危害,只能接收经过选择的连接。
dmz(非军事区):用于您的非军事区内的电脑,此区域内可公开访问,可以有限的进入你的内部网络,仅仅接收经过选择的连接。
work(工作):用于工作区,你可以基本相信网络内的其他电脑不会危害你的电脑,仅仅接收经过选择的连接。
home(家庭):用于家庭网络,你可以基本相信网络内的其他计算机不会危害你的计算机,仅仅接收经过选择的连接。
internal(内部):用于内部网络,你可以基本相信网络内的其他计算机不会危害你的计算机,仅仅接收经过选择的连接。
trusted(信任):可接受所有的网络连接。
设定默认zone firewall-cmd --set-default-zone=work
查指定网卡 firewall-cmd --get-zone-of-interface=ens33
给指定网卡设置zone firewall-cmd --zone=public --add-interface=网卡
针对网卡更改zone firewall-cmd --zone=dmz --change-interface=网卡
针对网卡删除zone firewall-cmd --zone=dmz --remove-interface=网卡
查看系统所有网卡所在的zone firewall-cmd --get-active-zones
[root@localhost ~]# firewall-cmd --get-services
[root@localhost ~]# firewall-cmd --list-services
[root@localhost ~]# firewall-cmd --zone=public --add-service=http
[root@localhost ~]# firewall-cmd --zone=public --remove-service=http
[root@localhost ~]# ls /usr/lib/firewalld/zones/
block.xml drop.xml home.xml public.xml work.xml
dmz.xml external.xml internal.xml trusted.xml
[root@localhost ~]# firewall-cmd --zone=public --add-service=http --permanent
success
cp /usr/lib/firewalld/services/ftp.xml /etc/firewalld/services
vi /etc/firewalld/services/ftp.xml //把21改为1121
cp /usr/lib/firewalld/zones/work.xml /etc/firewalld/zones/
vi /etc/firewalld/zones/work.xml //增加一行
<service name="ftp"/>
firewall-cmd --reload //重新加载
firewall-cmd --zone=work --list-services
[root@localhost ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
-u:指定某个用户,不加-u 选项则为当前用户
-e:制定计划任务
-l:列出计划任务 或者查看/var/spool/cron/root
-r:删除计划任务
[root@localhost ~]# crontab -e
格式:分,时,日,月,周,命令行
01 10 05 06 3 /bin/bash /usr/local/sbin/123.sh >> /root/1.log 2>> /root/2.log
[root@localhost ~]# systemctl start crond
[root@localhost ~]# systemctl status crond
备份crontab
复制/var/spool/cron/root到另外路径即可
TIPS
在脚本中使用命令绝对路径或者将命令声明变量
每一条任务计划使用追加重定向或者追加错误重定向
[root@localhost ~]# ls /etc/init.d/
functions netconsole network README
--list 查看sysv服务
--level 指定级别
--add 添加启动服务
--del 删除启动服务
[root@localhost ~]# chkconfig --level 3 network off
[root@localhost ~]# mv 123 /etc/init.d/
[root@localhost init.d]# chkconfig --add 123
自定义脚本格式必须要有以下部分:
#! /binbash
# chkconfig: 2345 10 90
# description: 描述内容
centos7 管理服务
[root@localhost ~]# systemctl list-units --all --type=service
去掉--all,只会列出active状态的service
systemctl enable crond.service 让服务开机启动
systemctl disable crond 不让开机启动
systemctl status crond 查看状态
systemctl stop crond 停止服务
systemctl start crond 启动服务
systemctl restart crond 重启服务
systemctl is-enabled crond 检查服务是否开机启动
[root@localhost ~]# ls /usr/lib/systemd/system
service 系统服务
target 多个unit组成的组
device 硬件设备
mount 文件系统挂载点
automount 自动挂载点
path 文件或路径
scope 不是由systemd启动的外部进程
slice 进程组
snapshot systemd 快照
socket 进程间通信套接字
swap swap文件
timer 定时器
systemctl list-units 列出正在运行的unit
systemctl list-units --all 列出所有,包括失败的或者inactive的
systemctl list-units --all --state=inactive 列出inactive的unit
systemctl list-units --type=service 列出状态为active的service
systemct is-active crond.service 查看某个服务是否为active
系统为了方便管理用target来管理unit,target是unit组合。
[root@localhost ~]# systemctl list-unit-files --type=target
[root@localhost ~]# systemctl list-dependencies multi-user.target
[root@localhost ~]# systemctl get-default
[root@localhost ~]# systemctl set-default multi-user.target
一个service属于一种类型的unit
多个unit组成了一个target
一个target里面包含了多个service
[root@localhost ~]# cat /usr/lib/systemd/system/sshd.service
看[install]部分
remote synchronize一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限、时间、软硬链接等附加信息。
rsync 包括如下的一些特性:
能更新整个目录和树和文件系统;
有选择性的保持符号链链、硬链接、文件属于、权限、设备以及时间等;
对于安装来说,无任何特殊权限要求;
对于多个文件来说,内部流水线减少文件等待的延时;
能用rsh、ssh 或直接端口做为传输入端口;
支持匿名rsync 同步文件,是理想的镜像工具;
增量拷贝;
rsync [OPTION]... SRC(源文件/目录) DEST(目标文件/目录 本地拷贝
rsync [OPTION]... SRC [USER@]HOST:DEST 本地远程至拷贝
rsync [OPTION]... [USER@]HOST:SRC DEST 远程拷贝至本地
rsync [OPTION]... [USER@]HOST::SRC DEST
rsync [OPTION]... SRC [USER@]HOST::DEST
yum install -y rsync
[root@localhost ~]# rsync -av /etc/passwd /tmp/q.txt
[root@localhost ~]# rsync -av /tmp/1.txt 192.168.1.11:/tmp/2.txt
-a 包含-rtplgoD
-r 同步目录时要加上,类似cp时的-r选项
-v 同步时显示一些信息,让我们知道同步的过程
-l 保留软连接
-L 同步软链接时会把软连接源文件同时同步
-p 保持文件的权限属性
-o 保持文件的属主
-g 保持文件的属组
-D 保持设备文件信息
-t 保持文件的时间属性
--delte 删除DEST中SRC没有的文件
--exclude 过滤指定文件,如--exclude “logs”会把文件名包含logs的文件或者目录过滤掉,不同步
-P 显示同步过程,比如速率,比-v更加详细
-u 加上该选项后,如果DEST中的文件比SRC新,则不同步
-z 传输时压缩
拷贝本地源目录至本地目标目录
[root@localhost 111]# rsync -av /root/111/ /tmp/111_dest
-L参数,覆盖-l参数,将源目录中软连接文件指向的源文件,同步到远程目标目录中
[root@localhost 111]# rsync -avL /root/111/ /tmp/111_dest/
[root@localhost 111]# ll /tmp/111_dest/
总用量 1140
-rw-r--r-- 1 root root 1162548 6月 24 20:09 123.txt
drwxr-xr-x 2 root root 6 6月 24 20:10 456
-rw-r--r-- 1 root root 1933 7月 5 00:32 ggg
删除目标目录中比源目录多余的文件
[root@localhost 111]# ls .
123.txt 456 ggg
[root@localhost 111]# ls /tmp/111_dest/
123.txt 456 ggg new.txt
[root@localhost 111]# rsync -avL --delete /root/111/ /tmp/111_dest
sending incremental file list
./
deleting new.txt
sent 81 bytes received 16 bytes 194.00 bytes/sec
total size is 1164481 speedup is 12004.96
过滤指定txt文件
[root@localhost 111]# rm -fr /tmp/111_dest/*
[root@localhost 111]# ls .
123.txt 456 ggg
[root@localhost 111]# rsync -avL --exclude "*.txt" /root/111/ /tmp/111_dest/
sending incremental file list
./
ggg
456/
sent 2044 bytes received 38 bytes 4164.00 bytes/sec
total size is 1933 speedup is 0.93
显示同步过程
[root@localhost 111]# rsync -avP /root/111/ /tmp/111_dest/
sending incremental file list
./
123.txt
1162548 100% 119.72MB/s 0:00:00 (xfer#1, to-check=2/4)
ggg -> /root/passwd
456/
sent 1162835 bytes received 41 bytes 2325752.00 bytes/sec
total size is 1162560 speedup is 1.00
rsync 同步数据方式
从一台机器拷贝文件到另一台机器,需要安装openssh-clients
ssh同步数据
[root@localhost 111]# rsync -av 111/ 192.168.1.22:/tmp/111_dest
[root@localhost 111]# rsync -av -e "ssh -p 22" 111/ 192.168.1.22:/tmp/111_dest
rsync 通过服务的方式同步
要编辑配置文件/etc/rsyncd.conf
启动服务rsync --daemon
格式:rsync -av test1/ 192.168.1.22::module/dir/