Linux20180515 rsync syslog Screen

Source: Internet
Author: User

May 15 Task

10.32/10.33 rsync via service sync
10.34 Linux system logs
10.35 Screen Tool

Extended
1. Linux log File Explorer logrotate http://linux.cn/article-4126-1.html
2. Xargs usage detailed http://blog.csdn.net/zhangfn2011/article/details/6776925





It is not through SSH but through the service of the way to synchronize this need to open a service, CS architecture, client, server. Server to open a service, listening to a port default 873, and can be customized. Clients can transfer services and data over 873 ports after the server is opened.

To edit the configuration file before starting the service, the default address is/etc/rsyncd.conf. If you write somewhere else, write a new path when you open the service.

Start Service RSYBC--daemon


Command format:

Rsync-av current file IP to synchronize:: module name path/file name Module name is the [] in the configuration file the middle of the test

RSYNC-AVP/TMP/1.PASSWD 192.168.202.123::test/from02.passwd

Explain the settings above.

Port is ports

Log file

Pid

Address is the location of the server

[Test] is the module name, random, in the client can be used to write in the command


Here is a case:

Aming1 IP 192.168.202.123 This machine is set to server side set 873 port and log configuration path, etc.

Aming2 IP192.18.202.250 This machine is set to the client and then needs to synchronize a file from the client to the server side.


    1. First configure the configuration file on the server side,/etc/rsyncd.conf

    2. Start Service rsync--daemon

    3. Check if the following service is starting PS aux | grep rsync View process NETSTAT-LNTP Check Port 873

4. Then follow the path in the configuration file to accept the path 777 permission

5. Perform synchronization commands on the Aming2 machine

RSYNC-AVP/TMP/1.PASSWD 192.168.202.123::test/from02.passwd

passwd is the file to be transferred double colon followed by the module name followed by the name of the new file

6. Error has occurred

7. Check for errors. Ping can pass, network connection is not a problem. Then check the port, using the command telnet IP port, OK is the port problem. Iptables the problem, so to stop the FIREWALLD service. Systemctl Stop FIREWALLD Close the rules, both sides.

8 re-execute the transfer command, you will be asked to enter a password, the password is defined in the configuration file, Auth Secrets path, you can temporarily close first.

9 execution, success.



Say what the configuration file means:

port=873-----------Default port, 873 is not written.

Log file=/var/log/rsync.log--------a custom log file

PID file=/var/run/rsyncd.pid-------Specify the PID file, the role of this file involves the start of services, stop and other process management operations.

address=192.168.133.130----------Specify the IP that initiates the Rsync service, multiple IPs can specify one, and not specify the IP

[Test]-----Module Name

Path=/root/rsync specifying the data storage path

Use Chroot=true represents the first chroot to the directory specified by the path parameter before transferring the file, which allows for additional security, determines that root permissions are required, and cannot back up the directory files that the symbolic connection that you want to external only points to. The default is true, if there is a soft link file in the data, it is recommended to change to False (translation is if there is a soft link and transfer the entity is also transmitted, and the entity does not exist, will be an error)

Max connections=4 Specifies the maximum number of connections, which defaults to 0, i.e. no limit

Read Only=no True/false If the read-only definition is true then the client will not be able to write it.

List=true--------function is to list all the modules of the remote server if it is ture. is a security option, if the module name is visible, it is more dangerous, there is a security risk.

UID=ROOT specifies which user to transfer when transmitting.

Gid=root


Auth users=test Specify transfer with user name

Secrets file=/etc/rsyncd.passwd Specify the password file, this parameter to the above parameters if not specified, no password authentication

The format of this file is User: Password permission is 600. The client's directory is a/etc/rsync_pass.txt-only password, and the permissions are 600. It takes more than one option to sync,--password-file=/etc/rsync_pass.txt.



Hosts allow=192.168.133.132 1.1.1.1 2.2.2.2 192.168.133.0/24 is used to define which machines to do synchronization, 1.1.1.1 2.2.2.2 means that multiple IPs are followed by IP segments



If the server-side port changes, the client needs to add an option--port port number at the command line to ensure normal transmission.





Linux system Logs


As more and more services start to run, log is becoming more and more important. Many errors are recorded in the log.

Important logs:


The main log of/var/log/messages Linux is here


All the logs are recorded here, so it will be a long time before. So the system has a log cutting mechanism. Cut when it grows to a certain level. See


Because Linux has a service Logrotate log cut

Reference https://my.oschina.net/u/2000675/blog/908189



DMESG command

Displays hardware-related logs, which are stored in memory. Shutdown is none.


/VAR/LOG/DMESG records the startup-related information


The last command logs a properly logged-in log, the/var/log/wtmp file is called, and the binary file cannot be used with the cat

The LASTB command logs a log of failed logins, calls the var/log/btmp binary, and if someone tries brute force, it will leave a record.


Security log/var/log/secure




Screen tools virtual screens, virtual terminals.

Sometimes the script runs for a long time and cannot be interrupted halfway. So in order not to let a task accidentally interrupted, you need to ensure that the network can not make any mistakes.

There are two ways to solve it:

1, put in the background, there is output to the log.

Nohup Execute command Log &

This will run in the background even if the terminal is disconnected.


2,screen put in the background, ready to use, at any time to adjust out.

The screen command goes directly to a virtual terminal, executes a command that cannot be stopped, presses CTRL A and then presses D to exit the virtual terminal. The task continues

For example, execute the vmstat 1 command under Screen

Tells you that there is a screen ID of 4047

You can use the Screen-ls list to

Back to screen screen-r ID

Kill screen with exit


You can also use several screens at the same time.


But it's a long time to remember what commands are running under screen, how to differentiate?

There is a parameter that can be named,-S


Screen-s "Name" can also enter in the name, but also can use the ID in

Linux20180515 rsync syslog Screen

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.