10.32/10.33 rsync通过服务同步 10.34 linux系统日志 10.35 screen工具

[[email protected] ~]# mkdir /tmp/rsync
[[email protected] ~]# chmod 777 /tmp/rsync

第二个机器

[[email protected] ~]# rsync -avP /tmp/lizhipeng.txt 192.168.5.128::test/lizhipeng0129.txt
rsync: failed to connect to 192.168.5.128 (192.168.5.128): No route to host (113)                 不通,检查下原因
rsync error: error in socket IO (code 10) at clientserver.c(122) [sender=3.0.9]
[[email protected] ~]# ping 192.168.5.128
PING 192.168.5.128 (192.168.5.128) 56(84) bytes of data.                                                     能ping通,再检查下telent
64 bytes from 192.168.5.128: icmp_seq=1 ttl=64 time=0.351 ms
64 bytes from 192.168.5.128: icmp_seq=2 ttl=64 time=0.218 ms
64 bytes from 192.168.5.128: icmp_seq=3 ttl=64 time=1.08 ms
^C
--- 192.168.5.128 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.218/0.552/1.089/0.384 ms

[[email protected] ~]# telnet 192.168.5.128 873           检查端口是否通,不通,检查一下iptables
Trying 192.168.5.128...
telnet: connect to address 192.168.5.128: No route to host

[[email protected] ~]# systemctl stop firewalld    关闭firewalld,机器1同样

[[email protected] ~]# telnet 192.168.5.128 873         通了
Trying 192.168.5.128...
Connected to 192.168.5.128.
Escape character is ‘^]‘.
@RSYNCD: 30.0

[[email protected] ~]# rsync -avP /tmp/lizhipeng.txt 192.168.5.128::test/lizhipeng0129.txt
Password:

密码关闭

[[email protected] ~]# rsync -avP /tmp/lizhipeng.txt 192.168.5.128::test/lizhipeng0129.txt               同步成功
sending incremental file list
lizhipeng.txt
1244 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1)

sent 1321 bytes received 27 bytes 898.67 bytes/sec
total size is 1244 speedup is 0.92

[[email protected] ~]# ls /tmp/rsync/     1机器下有这个文件
lizhipeng0129.txt

[[email protected] ~]# rsync -avP 192.168.5.128::test/lizhipeng0129.txt          /tmp/123.txt      机器1同步到机器2
receiving incremental file list
lizhipeng0129.txt
1244 100% 1.19MB/s 0:00:00 (xfer#1, to-check=0/1)

sent 45 bytes received 1356 bytes 2802.00 bytes/sec
total size is 1244 speedup is 0.89

[[email protected] ~]# cd /tmp/rsync/
[[email protected] rsync]# ls
lizhipeng0129.txt
[[email protected] rsync]# ln -s /etc/passwd ./12.txt                      机器1创建软链接12.txt指向/etc/passwd
[[email protected] rsync]# ls -l
总用量 4
lrwxrwxrwx 1 root root 11 1月 30 07:32 12.txt -> /etc/passwd
-rw-r--r-- 1 root root 1244 1月 29 01:06 lizhipeng0129.txt

机器2同步目录

[[email protected] ~]# rsync -avP 192.168.5.128::test/ /tmp/test/
receiving incremental file list
created directory /tmp/test
./
12.txt -> /etc/passwd
lizhipeng0129.txt
1244 100% 1.19MB/s 0:00:00 (xfer#1, to-check=0/3)

sent 51 bytes received 1407 bytes 2916.00 bytes/sec
total size is 1255 speedup is 0.86

没有同步成功

改成false

[[email protected] ~]# rsync -avP 192.168.5.128::test/ /tmp/test/                同步成功了
receiving incremental file list
12.txt -> /etc/passwd

sent 29 bytes received 117 bytes 292.00 bytes/sec
total size is 1255 speedup is 8.60
[[email protected] ~]# ls -l /tmp/test/
总用量 4
lrwxrwxrwx. 1 root root 11 1月 30 07:32 12.txt -> /etc/passwd
-rw-r--r--. 1 root root 1244 1月 29 01:06 lizhipeng0129.txt
[[email protected] ~]#

[[email protected] ~]# rsync -avLP 192.168.5.128::test/ /tmp/test/                              机器2同步出错,因为端口号不对
rsync: failed to connect to 192.168.5.128 (192.168.5.128): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(122) [Receiver=3.0.9]

[[email protected] ~]# rsync -avLP --port 8730 192.168.5.128::test/ /tmp/test/      --port 8730指定端口号
receiving incremental file list
./
12.txt
1244 100% 1.19MB/s 0:00:00 (xfer#1, to-check=2/4)
lizhipeng0130.txt
1244 100% 1.19MB/s 0:00:00 (xfer#2, to-check=0/4)

sent 67 bytes received 2701 bytes 5536.00 bytes/sec
total size is 3732 speedup is 1.35

[[email protected] ~]# vim /etc/rsyncd.conf

权限不够

[[email protected] ~]# vim /etc/rsyncd.conf        uid,gid改成root
[[email protected] ~]# cd /tmp/rsync/
[[email protected] rsync]# ls
12.txt lizhipeng0129.txt lizhipeng0130.txt

[[email protected] rsync]# chmod 600 !$
chmod 600 /etc/rsyncd.passwd

[[email protected] ~]# rsync -avP /tmp/test/ --port=8730 [email protected]::test/
Password:
sending incremental file list
./

sent 105 bytes received 20 bytes 19.23 bytes/sec
total size is 3732 speedup is 29.86
[[email protected] ~]# touch /tmp/test/1.txt
[[email protected] ~]# rsync -avP /tmp/test/ --port=8730 [email protected]::test/
Password:
sending incremental file list
./
1.txt
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=3/5)

sent 149 bytes received 30 bytes 32.55 bytes/sec
total size is 3732 speedup is 20.85

客户端填写密码

[[email protected] ~]# vim /etc/rsync_pass.txt
[[email protected] ~]# chmod 600 !$
chmod 600 /etc/rsync_pass.txt

[[email protected] ~]# touch /tmp/test/2.txt
[[email protected] ~]# rsync -avP /tmp/test/ --port=8730 --password-file=/etc/rsync_pass.txt [email protected]::test/                           不需要输入密码
sending incremental file list
./
2.txt
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/6)

sent 163 bytes received 30 bytes 386.00 bytes/sec
total size is 3732 speedup is 19.34

[[email protected] ~]# ls /var/log/message*
/var/log/messages /var/log/messages-20180108 /var/log/messages-20180114 /var/log/messages-20180121 /var/log/messages-20180128

[[email protected] ~]# dmesg -c  清空日志 内存中的

[[email protected] ~]# last 记录正确的登陆时间

[[email protected] ~]# lastb   登陆失败

btmp begins Wed Jan 31 05:37:48 2018

[[email protected] ~]# ls /var/log/btmp
/var/log/btmp
[[email protected] ~]# ls /var/log/secure
/var/log/secure

[[email protected] ~]# screen                 ctrl+a同时按,然后按d
[detached from 3389.pts-0.lizhipenglinux01]

[[email protected] ~]# screen -ls
There is a screen on:
3389.pts-0.lizhipenglinux01 (Detached)
1 Socket in /var/run/screen/S-root.

[[email protected] ~]# screen -r 3389. 回去

[[email protected] ~]# screen
[detached from 3430.pts-0.lizhipenglinux01]
[[email protected] ~]# screen
[detached from 3449.pts-0.lizhipenglinux01]
[[email protected] ~]# screen
[detached from 3468.pts-0.lizhipenglinux01]
[[email protected] ~]# screen -lsn
There are screens on:
3468.pts-0.lizhipenglinux01 (Detached)
3449.pts-0.lizhipenglinux01 (Detached)
3430.pts-0.lizhipenglinux01 (Detached)
3 Sockets in /var/run/screen/S-root.

[[email protected] ~]# screen -r 3468.
[detached from 3468.pts-0.lizhipenglinux01]
[[email protected] ~]# screen -lsn
There are screens on:
3468.pts-0.lizhipenglinux01 (Detached)
3449.pts-0.lizhipenglinux01 (Detached)
3430.pts-0.lizhipenglinux01 (Detached)
3 Sockets in /var/run/screen/S-root.

[[email protected] ~]# screen -S "test_screen"
[detached from 3499.test_screen]
[[email protected] ~]# screen -ls
There are screens on:
3499.test_screen (Detached)
3468.pts-0.lizhipenglinux01 (Detached)
3449.pts-0.lizhipenglinux01 (Detached)
3430.pts-0.lizhipenglinux01 (Detached)
4 Sockets in /var/run/screen/S-root.

原文地址:https://www.cnblogs.com/sisul/p/8387833.html

时间: 2024-11-10 08:22:13

10.32/10.33 rsync通过服务同步 10.34 linux系统日志 10.35 screen工具的相关文章

10.32/10.33 rsync通过服务同步10.34 linux系统日志10.35 screen工具

- 10.32/10.33 rsync通过服务同步 - 10.34 linux系统日志 - 10.35 screen工具 - 扩展 1. Linux日志文件总管logrotate http://linux.cn/article-4126-1.html 2. xargs用法详解 http://blog.csdn.net/zhangfn2011/article/details/6776925 # 10.32 rsync通过服务来同步 上 - rsync通过服务的方式同步 - 要编辑配置文件/etc/

八周三次课(1月31日) 10.32/10.33 rsync通过服务同步 10.34 linux系统日志 10.35 screen工具

八周三次课(1月31日)10.32 rsync通过服务同步10.33 rsync通过服务同步10.34 linux系统日志10.35 screen工具===============================================================================================================================================================================

10.32/10.33 rsync通过服务同步 10.34 linux系统日志 10.35 scre

八周三次课 10.32/10.33 rsync通过服务同步 10.34 linux系统日志 10.35 screen工具 10.32/10.33 rsync通过服务同步 编辑: rsync.conf 配置文件:/etc/rsync.conf 启动rsync服务 10.34 linux系统日志 10.35 screen工具 原文地址:http://blog.51cto.com/wbyyy/2067957

10.32/10.33 rsync通过服务同步 10.34 linux系统日志 screen工具

通过后台服务的方式 在远程主机上建立一个rsync的服务器,在服务器上配置好rsync的各种应用,然后将本机作为rsync的一个客户端连接远程的rsync服务器. 在128主机上建立并配置rsync的配置文件/etc/rsyncd.conf,把你的rsyncd.conf编辑成以下内容: [[email protected] ~]# vim /etc/rsyncd.conf # /etc/rsyncd: configuration file for rsync daemon mode port=8

rsync通过服务同步、linux系统日志、screen工具

rsync通过服务同步 /etc/rsyncd.conf是rsync的默认配置文件,该配置文件不存在,需要编辑内容 主服务器上的操作: 1.[[email protected] rsync]# cat /etc/rsyncd.conf #启动的端口 port=873 #log文件 log file=/var/log/rsync.log pid file=/var/run/rsyncd.pid #必须写服务端的IP address=192.168.3.83 [test] #模块存的地方 path=

Linux CentOS7 rsync通过服务同步、linux系统日志、screen工具

一.rsync通过服务同步 rsyncd.conf配置文件详解 port:指定在哪个端口启动rsyncd服务,默认是873端口. log file:指定日志文件. pid file:指定pid文件,这个文件的作用涉及服务的启动.停止等进程管理操作. address:指定启动rsyncd服务的IP.假如你的机器有多个IP,就可以指定由其中一个启动rsyncd服务,如果不指定该参数,默认是在全部IP上启动. []:指定模块名,里面内容自定义. path:指定数据存放的路径. use chroot t

rsync用服务同步文件、系统日志、screen工具

一.rsync通过服务同步 1?要编辑配置文件:/etc/rsyncd.conf2.启动rsync --daemon (检测是否启动:ps aux |grep rsync)3.格式:rsync -av test1/192.168.133.11.130::module/dir/ 例:从b机用rsync服务同步文件到a机1?在a机上编辑:/etc/rsyncd.conf文件.加入下面一段rsync.conf的样例,更改储存路径为/tmp/rsync , port=873 //指定端口 log fil

八周三课 rsync通过服务同步,linux系统日志,screen工具

rsync通过服务的方式同步通过服务的方式首先我们要开启一个服务,它的架构是cs架构.客户端和服务端.服务端开启一个服务,rsync服务,并且要监听一个端口,默认为873,并且这个端口是可以自定义的.开启服务后,客户端究竟可以通过873这个端口和服务端进行通信.它的命令格式有两个"::".例如:rsync -av test1/ 192.168.133.130::module/dir/自启动服务前,我们要编辑配置文件,配置文件的默认路径为 /etc/rsyncd.conf.启动方式为rs

rsync通过服务同步

对rsyncd.conf文件内容详解:port=873 //监听端口默认为873,可以自定义端口log file=/var/log/rsync.log //指定日志路径pid file=/var/run/rsyncd.pid //指定pid路径address=192.168.202.130 //可以自定义绑定的ip[test] //test为模块名,可以自定义path=/root/rsync // 指定该模块对应路径use chroot=true //是否限定在该目录下,默认为true,当有软连