搭建可道云网盘并同步
- web服务器搭建环境(IP:172.16.1.7)
yun install rsync -y
mkdir /data
groupadd -g666 www
useradd -u666 -g666 wwww
chown www.www /data
yum install httpd php -y
sed -i '/^User/c User www' /etc/httpd/conf/httpd.conf
sed -i '/^Group/c Group www' /etc/httpd/conf/httpd.conf
cd /var/www/html/
chown -R www.www /var/www/html
wget http://static.kodcloud.com/update/download/kodexplorer4.40.zip
unzip kodexplorer4.40.zip
systemctl start httpd
systemctl enable httpd
yum install php-mbstring php-gd -y
cd /var/www/html/data/User/admin/home/
scp -rp * root@172.16.1.31:/data
mount -t nfs 172.16.1.31:/data /var/www/html/data/User/admin/home/
- NFS环境搭建(IP:172.16.1.31)
yum install rsync -y
groupadd -g666 www
useradd -u666 -g666 www
mkdir /backup /data
vim /etc/rsyncd.conf
------------------/etc/rsyncd.conf------------------------
uid = www
gid = www
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
list = false
auth users = rsync_backup
secrets file = /etc/rsync.passwd
[backup]
comment = commit
path = /backup
[data]
path = /data
------------------/etc/rsyncd.conf结束---------------------
vim /etc/rsync.passwd
-------------------/etc/rsync.passwd-----------------------------
rsync_backup:123456
------------------/etc/rsync.passwd结束---------------------------
chmod 600 /etc/rsync.passwd
chown -R www.www /backup
chown -R www.www /data
systemctl start rsyncd
systemctl enable rsyncd
yum install nfs-utils -y
vim /etc/exports
--------------------------/etc/exports----------------------------------
/data 172.16.1.0/24(rw,sync,all_squash,anonuid=666,anongid=666)
--------------------------/etc/exports结束-------------------------------
systemctl srat nfs
systemctl enable nfs
wget https://sersync.googlecode.com/files/sersync2.5.4_64bit_binary_stable_final.tar.gz
tar xf sersync2.5.4_64bit_binary_stable_final.tar.gz
mv GNU-Linux-x86/ /usr/local/serync
vim /usr/local/serync/confsml.xml
---------------------/usr/local/serync/confsml.xml------------------------
<host hostip="localhost" port="8008"></host>
<debug start="false"/>
<fileSystem xfs="false"/>
<filter start="false">
<exclude expression="(.*)\.svn"></exclude>
<exclude expression="(.*)\.gz"></exclude>
<exclude expression="^info/*"></exclude>
<exclude expression="^static/*"></exclude>
</filter>
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
<closeWrite start="true"/>
<moveFrom start="true"/>
<moveTo start="true"/>
<attrib start="true"/>
<modify start="true"/>
</inotify>
<sersync>
<localpath watch="/data">
<remote ip="172.16.1.41" name="data"/>
<!--<remote ip="192.168.8.39" name="tongbu"/>-->
<!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>
<rsync>
<commonParams params="-avz"/>
<auth start="true" users="rsync_backup" passwordfile="/etc/rsync.pass"/>
<userDefinedPort start="false" port="874"/><!-- port=874 -->
<timeout start="false" time="100"/><!-- timeout=100 -->
<ssh start="false"/>
</rsync>
<failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
<crontab start="false" schedule="600"><!--600mins-->
<crontabfilter start="false">
<exclude expression="*.php"></exclude>
<exclude expression="info/*"></exclude>
</crontabfilter>
</crontab>
<plugin start="false" name="command"/>
</sersync>
<plugin name="command">
<param prefix="/bin/sh" suffix="" ignoreError="true"/> <!--prefix /opt/tongbu/mmm.sh suffix-->
<filter start="false">
<include expression="(.*)\.php"/>
<include expression="(.*)\.sh"/>
</filter>
</plugin>
<plugin name="socket">
<localpath watch="/opt/tongbu">
<deshost ip="192.168.138.20" port="8009"/>
</localpath>
</plugin>
<plugin name="refreshCDN">
<localpath watch="/data0/htdocs/cms.xoyo.com/site/">
<cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
<sendurl base="http://pic.xoyo.com/cms"/>
<regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
</localpath>
</plugin>
</head>
---------------------/usr/local/serync/confsml.xml结束---------------------
/usr/local/sersync/sersync2 -dro /usr/local/sersync/confxml.xml
- Rsync环境搭建(IP:172.16.1.41)
yum install rsync -y
groupadd -g666 www
useradd -u666 -g 666 www
mkdir /data /backup
chown -R www.www /data
chown -R www.www /backup
vim /etc/rsyncd.conf
---------------------------/etc/rsyncd.conf--------------------------------
uid = www
gid = www
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
list = false
auth users = rsync_backup
secrets file = /etc/rsync.passwd
[backup]
comment = commit
path = /backup
[data]
path = /data
---------------------------/etc/rsyncd.conf结束-----------------------------
vim /etc/rsync.passwd
---------------------------/etc/rsync.passwd-------------------------------
rsync_backup:123456
---------------------------/etc/rsync.passwd结束----------------------------
chmod 600 /etc/rsync.passwd
systemctl start rsyncd
systemctl enable rsyncd
yum install nfs-utils -y
vim /etc/exports
---------------------------/etc/exports----------------------------------
/data 172.16.1.0/24(rw,all_squash,anonuid=666,anongid=666)
---------------------------/etc/exports结束-------------------------------
systemctl start nfs
systemctl enable nfs
- 当NFS服务器出现问题时,可以将web的可道云节点改为Rsync的/data节点
umount /var/www/html/data/User/admin/home/
mount -t nfs 172.16.1.41:/data /var/www/html/data/User/admin/home/
mount
umount -lf /var/www/html/data/User/admin/home