10.32/10.33 rsync synchronizes 10.34 Linux system logs through Services 10.35 screen tool

Source: Internet
Author: User
Tags rsync

[Email protected] ~]# Mkdir/tmp/rsync
[Email protected] ~]# chmod 777/tmp/rsync

A second machine

[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) not pass, check the reason
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (122) [sender=3.0.9]
[[email protected] ~]# Ping 192.168.5.128
PING 192.168.5.128 (192.168.5.128) bytes of data. Can ping pass, and then check the Telent
Bytes from 192.168.5.128:icmp_seq=1 ttl=64 time=0.351 ms
Bytes from 192.168.5.128:icmp_seq=2 ttl=64 time=0.218 ms
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 Check the port is not through, check the iptables
Trying 192.168.5.128 ...
Telnet:connect to address 192.168.5.128:no route to host

[[email protected] ~]# systemctl stop firewalld off firewalld, machine 1 same

[[Email protected] ~]# telnet 192.168.5.128 873 pass.
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:

Password Close

[[Email protected]02 ~]# rsync-avp/tmp/lizhipeng.txt 192.168.5.128::test/lizhipeng0129.txt Sync succeeded
Sending incremental file list
Lizhipeng.txt
1244 100% 0.00kb/s 0:00:00 (xfer#1, TO-CHECK=0/1)

Sent 1321 bytes Received bytes 898.67 bytes/sec
Total size was 1244 speedup is 0.92

[[email protected] ~]# LS/TMP/RSYNC/1 machine has this file
Lizhipeng0129.txt

[[email protected] ~]# RSYNC-AVP 192.168.5.128::test/lizhipeng0129.txt/tmp/123.txt machine 1 sync to machine 2
Receiving incremental file list
Lizhipeng0129.txt
1244 100% 1.19mb/s 0:00:00 (xfer#1, TO-CHECK=0/1)

Sent bytes received 1356 bytes 2802.00 bytes/sec
Total size was 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 Machine 1 Creating a soft link 12.txt pointing to/etc/passwd
[Email protected] rsync]# ls-l
Total Dosage 4
lrwxrwxrwx 1 root root 11 January 07:32 12.txt-/etc/passwd
-rw-r--r--1 root Root 1244 January 01:06 lizhipeng0129.txt

Machine 2 Synchronization Directory

[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 Wuyi bytes received 1407 bytes 2916.00 bytes/sec
Total size was 1255 speedup is 0.86

No synchronization succeeded

Change to False

[[email protected] ~]# RSYNC-AVP 192.168.5.128::test//tmp/test/synchronization succeeded
Receiving incremental file list
12.txt-/etc/passwd

Sent bytes received 117 bytes 292.00 Bytes/sec
Total size was 1255 speedup is 8.60
[Email protected] ~]# ls-l/tmp/test/
Total Dosage 4
lrwxrwxrwx. 1 root root 11 January 07:32 12.txt-/etc/passwd
-rw-r--r--. 1 root root 1244 January 01:06 lizhipeng0129.txt
[Email protected] ~]#

[[email protected] ~]# RSYNC-AVLP 192.168.5.128::test//tmp/test/Machine 2 synchronization error because the port number is not correct
rsync:failed to connect to 192.168.5.128 (192.168.5.128): Connection refused (111)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (122) [receiver=3.0.9]

[[email protected] ~]# RSYNC-AVLP--port 8730 192.168.5.128::test//tmp/test/--port 8730 Specify port number
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 bytes received 2701 bytes 5536.00 bytes/sec
Total size was 3732 speedup is 1.35

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

Insufficient authority

[[email protected] ~]# vim/etc/rsyncd.conf Uid,gid changed to 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 bytes received bytes 19.23 Bytes/sec
Total size was 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 bytes 32.55 bytes/sec
Total size was 3732 speedup is 20.85

Client Fill in Password

[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/ No need to enter a password
Sending incremental file list
./
2.txt
0 100% 0.00kb/s 0:00:00 (xfer#1, TO-CHECK=2/6)

Sent 163 bytes Received bytes 386.00 bytes/sec
Total size was 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 empty the log in memory

[[email protected] ~]# last recorded the correct login time

[[email protected] ~]# LASTB Login failed

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 simultaneously press and press D
[Detached from 3389.pts-0.lizhipenglinux01]

[Email protected] ~]# Screen-ls
There is a screens on:
3389.PTS-0.LIZHIPENGLINUX01 (Detached)
1 Socket in/var/run/screen/s-root.

[Email protected] ~]# screen-r 3389. Get back

[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 is 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 is 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 is 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.

10.32/10.33 rsync synchronizes 10.34 Linux system logs through Services 10.35 screen tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.