In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This paper gives an example of how to install and configure rsync server on CentOS6.5 platform. Share with you for your reference, the details are as follows:
Rsync installation
# check whether rsync has been installed If you have already installed, you need to uninstall rpm-qa | grep rsync# installed rsync uninstall rpm-e rsync# download the latest rpm package (note the matching of operating system and digits) # rsync rpm package list address: http://pkgs.repoforge.org/rsyncwget http://pkgs.repoforge.org/rsync/rsync-3.1.1-1.el6.rfx.x86_64.rpm# rpm package install rpm-ivh rsync-3.1.1-1.el6.rfx.x86_64.rpm
Rsync server configuration
Startup configuration
1. Select the rsync server startup method
If the load of the ① rsync server is high, the stand-alone startup mode is used.
② rsync server is responsible for low, using xinetd mode of operation
two。 Create a profile rsyncd.conf
3. Create a configuration password for rsync servers that are not accessed anonymously (it is recommended that the configuration requires password access)
The xinetd configuration file for CentOS to run rsync,rsync in xinetd mode by default is / etc/xinetd.d/rsync
If you configure rsync to run in xinetd mode, execute the following command
Chkconfig rsync onservice xinetd restart# does not install xinetd service if performing service xinetd restart Discovery xinetd: unrecognized service # execute yum install xinetd installation xinetd service # start xinetd service (service xinetd start) after installation
Edit the xinetd configuration file / etc/xinetd.d/rsync file of rsync, and modify the parameter server_args =-- daemon-- config=/etc/rsyncd/rsyncd.conf to configure the parameters when the rsync server starts.
If you are using stand-alone mode, execute the following command
/ usr/bin/rsync-- daemon# edit / etc/rc.local file join / usr/bin/rsync-- daemon ensures that the rsync service will be started automatically every time the boot starts
Configuration file
# create rsync service directory mkdir / etc/rsyncd# create configuration file touch / etc/rsyncd/rsyncd.conf# create password file touch / etc/rsyncd/rsyncd.passwd# permission modify chown root:root / etc/rsyncd/rsyncd.passwdchmod 600 / etc/rsyncd/rsyncd.passwd
Introduction to configuration file syntax
1. Module
Start with [module name]
two。 Parameter configuration line
Format name = value
Where the value of value can be string (you can not use quotation marks) or boolean (0pm 1)
3. Starting with # is a comment line
4. So\ is a continuation character.
Global parameters (configurations other than [module name] are global)
Address
When running independently, the IP address used for the specified server to run. This parameter is ignored by the xinetd runtime and replaced with the-address option on the command line
Default value for all local IP
Port
Specifies the port number on which the rsync daemon listens. This parameter is ignored by the xinetd runtime and replaced with the-port option on the command line.
Default value is 873
Motd file
Specify a message file whose contents are displayed to the client when the client connects to the server.
Default value none
Pid file
The daemon of rsync writes its PID to the specified file.
Default value none
Log file
Specifies the log file for the rsync daemon without sending the log to syslog.
Default value none
Syslog facility
Specifies the message level when rsync sends log messages to syslog
Default value daemon
Socket options
Specify custom TCP options.
Default value none
Module parameters
Module parameters are mainly used to define which directory of the rsync server will be synchronized. The module declaration must be in the form of [module], which is the name you see on the rsync client, similar to the share name provided by the Samba server. The data that the server actually synchronizes is specified through path. You can specify multiple modules according to your needs, and the following parameters can be defined in the module:
1. Basic module parameters
Path
Specifies the synchronization path of the current module on the rsync server. This parameter must be specified.
Comment
Assign a description to the module, which, together with the module name, is displayed to the customer when the customer connects to get the module list
two。 Module control parameters
Use chroot
If true, rsync first chroot to the directory specified by the path parameter before transferring the file. The reason for this is to implement additional security, but the disadvantage is that root permissions are required and the directory files pointed to by symbolic links outside path cannot be backed up.
Default value true
Uid
Specifies that the module transfers files at the specified UID.
Default value nobody
Gid
Specifies that the module transfers files at the specified GID.
Default value nobody
Max connections
Set the maximum number of concurrent connections for the module to protect the server, and connection requests that exceed the limit will be told to try again later.
The default value of 0 is not limited
Read only
Specifies whether to allow customers to upload files. Upload is not allowed if it is true; if it is false and the server directory also has read and write access, upload is allowed.
Default value true
Write only
Specifies whether to allow customers to download files. If true, download is not allowed; if false and the server directory also has read access, download is allowed.
Default value false
3. Module authentication parameters
Hosts allow
Use a list of hosts to specify which host customers are allowed to connect to the module. Hosts that do not match the list of hosts will be rejected
Default value *
The customer host list definition can be in the following form:
Single IP address for example: 192.168.0.1
The whole network segment, for example: 192.168.0.0swap 24192.168.0.0lap255.255.0
Resolvable single hostname for example: centos,centos.bsmart.cn
All hosts in the domain such as .bsmart.cn
"" means all.
Multiple list items are separated by spaces.
Hosts deny
Use a list of hosts to specify which host customers are not allowed to connect to the module.
Default value is empty
Auth users
Specifies a list of user names separated by spaces or commas, and only these users are allowed to connect to the module. The users here have nothing to do with the users of the system. The user name and password are stored in clear text in the file specified by the secrets file parameter
Default anonymity
Secrets file
Specify an rsync authentication password file. This file works only if auth users is defined.
Default value is empty
Strict modes
Specifies whether to monitor the permissions of the password file. If true, the password file can only be accessed by the user running as the rsync server, and no other user can access the file.
Default value true
>-the permission of the rsync authentication password file must be 600, otherwise the client will not be able to connect to the server.
Each line in the rsync authentication password file specifies a user name: password pair in the format: username:passwd
Generally speaking, passwords should not exceed 8 characters. If you configure only anonymously accessed rsync servers, you do not need to set the above parameters.
Profile instance
# GLOBAL OPTIONSuid = rootgid = rootuse chroot = noread only = yes#limit access to private LANshosts allow=172.16.0.0/255.255.0.0 192.168.1.0 + 255.255.255.0 10.0.1.0/255.255.255.0hosts deny=*max connections = 5pid file = / var/run/rsyncd.pidsecrets file = / etc/rsyncd/rsyncd.secrets#lock file = / var/run/rsync.lock#motd file = / etc/rsyncd/rsyncd.motd#This will give you a Separate log file#log file = / var/log/rsync.log#This will log every file transferred-up to 85000 + per user Per synctransfer logging = yeslog format =% t% a% m% f% bsyslog facility = local3timeout = 30 years MODULE options path = / home/david/list=yesignore errorsauth users = davidcomment = David homeexclude = important/ [chinatmp] path = / tmp/china/list=noignore errorsauth users = chinacomment = tmp_china
Password file
David:asdf # format username: password china:jk # this user is not required to be a system user
Check to see if the rsync service starts
Netstat-an | grep 873
Rsync client
# install client yum-y install rsync# synchronization command #-a parameter, equivalent to-rlptgoD#-r is recursive-l is a linked file, meaning to copy a linked file;-p means to keep the original permissions of the file #-t keep the original time of the file;-g keep the original user group of the file;-o keep the original owner of the file;-D is equivalent to the block device file #-z compressed during transfer #-P transmission progress; #-v transmission progress and other information, which has something to do with-P, try it yourself. You can see the document; # synchronize rsync-avzP david@172.16.1.135::davidhome / tmp/david/# client data and server data consistent rsync-avzP-- delete david@172.16.1.135::davidhome / tmp/david/# specify the password file for transfer, password file permissions 600rsync-avzP-- delete-- password-file=/tmp/rsync.password david@172.16.1.135::davidhome / tmp/david/
I hope what is described in this article will be helpful to the configuration of CentOS server.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.