LAMP 环境同步

 LAMP 环境同步 :
:CENTOS   :WINDOWS
 
MYSQL 同步
 
设置主服务器
 
[root@centos etc]# cat /etc/my.cnf
[mysqld]
 
server-id=1
log-bin
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
 
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
 
配置从服务器:
  C:\APMServ 5.2.6 \MySQL5.1\my.ini
[mysqld]
basedir=C:/APMServ 5.2.6 /MySQL5.1
datadir=C:/APMServ 5.2.6 /MySQL5.1/data
port=3306
interactive_timeout=240
wait_timeout=240
 
server-id=2
master-host=192.168.0.185
master-port=3306
master-user=admin
master-password=123456
master-connect-retry=60
replicate-do-db=dvbbs
 
mysql>show master status; 查看主服务器状态 .
mysql>show slave status\G ; 查看从服务器状态
 
 
 
APACHE 同步
[root@centos etc]# cat rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 20
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
 
[web]
path = /var/www/html/bbs/
ignore errors
read only = yes
hosts allow = 192.168.0.0/24
hosts deny = 0.0.0 .0/32
   
 
LINUX 下同步 :
 
编写同步脚本:
#!/bin/sh
while true
do
/usr/bin/rsync -av 192.168.0.185::web /bbs/ >dev/null 2>&1
sleep 20
done
 
WINDOWS 下同步:
 
Windows   setup   cwRsync_ 3.1.0 _Installer.zip 软件 ..
编写同步脚本:
@echo off
:1
echo  同步中
rsync -av 192.168.0.185::web \bbs\
ping 127.0 -n 2 >nul 2>nul
goto 1
 
 
 
 
 

你可能感兴趣的:(职场,lamp,rsync,休闲,环境同步)