Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set rsync synchronization in linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Linux how to set rsync synchronization, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

[root@Hammer home] # rpm-qa | grep rsync # check whether the rsync package is installed on the system

Rsync-2.6.8-3.1

[root@Hammer CentOS] # rpm-ivh rsync-2.6.8-3.1.i386.rpm # install manually if not installed

[root@test rsync-3.0.4] # vim / etc/xinetd.d/rsync

1 configure rsync servervi / etc/xinetd.d/rsync

Change disable=yes to no

Service rsync

{

Disable = no

Socket_type = stream

Wait = no

User = root

Server = / usr/bin/rsync

Server_args =-- daemon

Log_on_failure + = USERID

}

2 configure rsync to start automatically

[root@test etc] # chkconfig rsync on

[root@test etc] # chkconfig rsync-- list

Rsync on

3 configure rsyncd.conf

[root@test etc] # vim rsyncd.conf

Uid = root

Gid = root

Use chroot = no

Max connections = 4

Strict modes = yes

Port = 873

Pid file = / var/run/rsyncd.pid

Lock file = / var/run/rsync.lock

Log file = / var/log/rsyncd.log

[backup]

Path = / srv

Comment = This is test

Auth users = scihoo

Uid = root

Gid = root

Secrets file = / home/rsync.ps

Read only = no

List = no

4 make sure the rsync port number in etc/services is correct

[root@test etc] # vim / etc/services

Rsync 873/tcp # rsync

Rsync 873/udp # rsync

5 configure rsync password (path has been written in the configuration file above) / home/rsync.ps (name can be written freely, as long as it is consistent with the one in the configuration file above), format (one user per line)

[root@test etc] # vi / home/rsync.ps

Scihoo:scihoo

6 configure rsync password file permissions

[root@test home] # chown root.root rsync.ps

[root@test home] # chmod 400 rsync.ps

7 Startup configuration

[root@test home] # / etc/init.d/xinetd restart

Stopping xinetd: [OK]

Starting xinetd: [OK]

8 if xinetd is not available, it needs to be installed.

[root@test home] # yum-y install xinetd

Start rsync server

Two methods of RSYNC server startup

9. Start the rsync server (start independently)

[root@test home] # / usr/bin/rsync-- daemon

10. Start the rsync server (with xinetd super process started)

[root@test home] # / etc/init.d/xinetd reload

11 join rc.local

In a variety of operating systems, rc files are stored in different locations, which can be modified to load rsync-daemon when the system is started.

[root@test home] # vi / etc/rc.local

/ usr/local/rsync-daemon # add a line

12 check whether rsync is started

[root@test home] # lsof-I: 873

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

Xinetd 4396 root 5u IPv4 633387 TCP *: rsync (LISTEN)

Client configuration

1 configure three processes will be fine

1.1 set password file

1.2 Test rsync execution instructions

1.3 put the rsync instruction into the work schedule (crontab)

[root@aj1 home] # vi / etc/xinetd.d/rsync

# default: off

# description: The rsync server is a good addition to an ftp server, as it\

# allows crc checksumming etc.

Service rsync

{

Disable = yes

Socket_type = stream

Wait = no

User = root

Server = / usr/bin/rsync

Server_args =-- daemon

Log_on_failure + = USERID

}

1.1 configure password file (Note: for security, set the attribute of the password file to: 600. The password of rsync.ps must be the same as that in the Rsync Server password setting case)

[root@aj1 home] # vi rsync.ps

Sciooo

[root@aj1 home] # chown root.root .rsync.ps # Note that permissions must be given

[root@aj1 home] # chmod 600.rsync.ps # permissions must be modified

1.2 download files from the server

[root@aj1 rsync-3.0.4] # rsync- avz-- password-file=/home/rsync.ps scihoo@192.168.0.206::backup / home/

Upload it locally to the server

[root@aj1 rsync-3.0.4] # rsync- avz-- password-file=/home/rsync.ps / home scihoo@192.168.0.206::backup

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report