MySQL remote connection this has been practiced before, vaguely remember the damn space business sealed 3306 ....
I've been working on this all morning until now to get to the rsync.
Server 1: Sync source Server
Server 2: The synchronization server is the new server
First check that two servers have no rsync installed
The code is as follows |
Copy Code |
[Root@localhost. ssh]# Rpm-qa rsync# If no installation can yum install rsync
|
Next you need to configure the source server.
The code is as follows |
Copy Code |
#vi/etc/rsyncd.conf Log file =/var/log/rsyncd.log PID file =/var/run/rsyncd.pid Lock file =/var/run/rsync.lock [Test] #rsync区段的设定名称, the synchronization server will use the Path =/data/www/#需要同步的数据存放路径 Comment = Test folder #注释 UID = Apache #采用什么身份进行文件读取 GID = Apache #同上, must be a user, group with Read path permissions Ignore Errors #忽略错误 Read Only = yes #只读 List = no #不能列表 Auth users = Bak #连接rsync服务的帐号 Secrets file =/etc/rsyncd.secrets #指定存放帐号密码的位置 |
Next, we'll create a new file that holds our account username.
The code is as follows |
Copy Code |
#vi/etc/rsyncd.secrets #格式: Account Number: Password Bak:bac123
|
Change permissions for file password files
The code is as follows |
Copy Code |
#chown root:root/etc/rsyncd.secrets #chmod 600/etc/rsyncd.secrets |
Start the Rsync service
The code is as follows |
Copy Code |
#rsync--daemon |
Stop Rsync Server
The code is as follows |
Copy Code |
Kill ' Cat/var/run/rsyncd.pid ' #kill followed by an inverted quote |
Since this is only a transitional backup to use, so do not join since boot, join since start as follows
Revise the/etc/xinetd.d/rsync file and change the Disable=yes to Disable=no
The code is as follows |
Copy Code |
#sed-i-E "/disable/{s/yes/no/}"/etc/xinetd.d/rsync #service xinetd.d Restart |
Synchronizing server Configuration
The code is as follows |
Copy Code |
#rsync-azv--delete rsync://bak@192.168.1.2/test/var/www/html--password-file=/etc/rsyncpassword #vi/etc/rsyncpassword #直接填写密码即可 # #chmod 600/etc/rsyncpassword #修改文件的权限 #chown Root:root/etc/rsyncpassword #修改文件的所属用户和组 |
Timed Updates
The code is as follows |
Copy Code |
Crontab-e * * * * * * * * */data/rsync.sh #每20分钟同步一次, this is an incremental backup so there's no need to worry |
Now that the Rsync sync is done, we're done with our business needs. The next time to buy a server or to buy a reliable, or change a server really uncomfortable.
In fact, rsync can also be made to back up the site code. Let's talk about this later.