One: Rsync backend service mode (daemon)
It can be understood that a rsync server is established on the remote host, the various applications of RSYNC are configured on the server, and the machine is used as a client of rsync to connect to the remote rsync server.
Configure a too rsync server first
Establish and configure the rsync configuration file/etc/rsyncd.conf
Vi/etc/rsyncd.conf
Add configuration
#port =873
Log File=/var/log/rsync.log
PID File=/var/run/rsync.pid
#address =192.168.233.129
[Test]
Path=/root/rsync
Use Chroot=true
Max Connextions=4
Read Only=no
List=true
Uid=root
Gid=root
Auth User=test
Secrets file=/etc/rsyncd.passwd
Hosts allow=192.168.233.130
The configuration file is not part of the full configuration section and the Module configuration section. The global part is a few parameters, such as Port,log file, PID file,address, etc.
and [test] The following is the module configuration.
There can be more than one module in a configuration file, the module name is customized. Some parameters in the module can also be configured as global parameters.
View Module Name: rsync--port 873 192.168.233.129::
The meaning of the parameter
PORT specifies on which port to start the RSYNCD service, default is 873
Log file specifies the logfile
PID file to specify the PID files, the role of this file related to the start of services and stop processes such as management operations
address Specifies the IP that initiates the RSYNCD service, if the machine has multiple IPs, you can specify one of the startup RSYNCD services, which is started by default on all IPs.
[Test] Specifies the module name, custom
path specifies where data is stored
The user chroot True|false is true by default, and consciousness is first chroot to the directory specified by the path parameter before transferring the file. The reason for this is to implement additional security protections, with the disadvantage that you need to roots permissions, and you cannot back up the directory files that point to external symbolic connections. The chroot value is true by default and is set to False if there is a soft connection file in the data.
Max connections Specifies the maximum number of connections, the default is 0, which is no limit
Read Only true|false cannot be uploaded to the path specified by the module if True
list Specifies whether the module is listed when the user queries the available modules on the server, sets True to list, false to hide
UID/GID Specifies which user/group to transfer when transferring files
Auth user name specified for use
Secrets file specifies the password files, if you do not specify the above parameters do not use password authentication, note that the password file permissions must be 600
Hosts allow specifies the host that is allowed to connect to the module, either IP or network segment, if multiple, separated by a space
Edit Secrets file, after saving to give 600 permissions, if the permissions are not correct, can not complete synchronization.
vim/etc/rsyncd.passwd
Input test:test123
chmod 600/etc/rsyncd.passwd
Start the RSYNCD service
Rsync--daemon--config=/etc/rsyncd.conf
After starting, you can check the log and see if the port is started
Cat/var/log/rsync.log
NETSTAT-LNP |grep 873
If you want to boot up, write rsync--daemon--config=/etc/rsyncd.conf to the/etc/rc.d/rc.local file
And then to another machine test
RSYNC-AVL [email protected]::test/test1//tmp/#冒号后的test为模块名, followed by file path under path
Modifying the rsyncd.conf configuration file is immediate and does not require a restart of the service.
In the above synchronization process, can also be used in a secret-free way.
Specifying a password file
Edit a password file on the client leewill2 and customize it as pass
Vim/etc/pass
Just enter the user's password
Test123
Permissions to modify passwords
chmod 400/etc/pass
Then specify the password file at the time of synchronization.
Rsync-avl--password-file=/etc/pass [Email protected]::test/test1//tmp/
Two: Linux logs
The configuration file is/ETC/RSYSLOG.CONF,CENTOS6 before the version is syslog.conf, which services are primarily documented and what level of information needs to be logged.
Log format:
Log generated by Auth:pam
Verification information for login information such as Authpriv:ssh,ftp
Cron: Time Task related
Kern: Kernel
LPR: Printing
Mail: Message
Mark (syslog): Rsyslog Service internal information, time identification
News: Newsgroups
User: Related information generated by your program
Uucp:unix to UNIX Copy,unix host related communication
Local1~7: Custom Log device
Log level:
Debug: With debug information, the most log information
Info: Log of general information (most commonly used)
Notice: Information of the most important general conditions
Warning: Warning Level
ERR: Error level, information that prevents a feature or module from working correctly
Crit: Severity level, information that prevents the entire system or the entire software from working properly
Alert: Information that needs to be modified immediately
Emerg: Critical information such as kernel crashes
None: Nothing is recorded
From top to bottom, the level is low to high, and the information recorded is getting less
Connection symbols
.: Indicates information greater than or equal to a certain level
. =: Represents information equal to a certain level
.!: Indicates level information outside of a hierarchy
Log cutting configuration file:
Cat/etc/logrotate.conf
Weekly: Cut once a week
Rotate 4: Only 4 are left after cutting
Dateext: Name by log
System log files
- /var/log/messages Core System log files, if a service does not have a log defined, the log generated by the service will be in this file, which is archived once a week.
Its filing with the Bureau/etc/logratate.conf to control. This log file is generated by the syslogd daemon, and if this service is stopped, the system does not generate the log.
- /var/log/wtmp: Used to view user login history, but cannot be viewed directly with cat, only last view.
- /var/log/btmp: Similar to wtmp, can only be viewed with LASTB to record invalid login history.
- /var/log/maillog: is used to record message-related information.
- /var/log/secure: A security-related log, the user's normal login or login failure will be recorded, the FTP service-related log logs will be recorded in the face.
- DMESG: This command is used to view information thrown by the system's real-time hardware device, such as a disk exception, network exception, or kernel exception, but is only recorded in memory and disappears after a reboot.
- /VAR/LOG/DMESG: This log records hardware-related information when the system starts.
Rsync Backend Service mode (daemon), Linux logs