2012年4月24日
摘要: 页面表单:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><!DOCTYPE html><html lang="en"><head> <meta...
阅读全文
资源pom.xml
<properties>
<slf4j.version>1.7.1</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<logback.version>1.0.1</logback.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- logging related -->
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- common-logging 实际调用slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- java.util.logging 实际调用slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- slf4j-log4j绑定 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
<version>${logback.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
a.slf4j/logback 组合(logback.xml)
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
b.slf4j/log4j组合(log4j.properties or log4j.xml)
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<!-- slf4j-log4j绑定 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
c.如果是已用了commons-logging/log4j想用用slf4j/logback,那也容易用下面的配置
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- common-logging 实际调用slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<!-- log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
再到http://logback.qos.ch/translator/Welcome.do,將你原來的log4j.properties转成logback.xml
就可以將commons-logging.jar 跟 log4j.jar自你系統中移除了
环 境 a.下载 BeanSoft的绿色版mysql
(Copy 成两份 ,master,slave) 取mysql\mysql50green下内容复制
b.
在cmd命令行模式下进入master
\bin 执行mysqld install
master命令。作用是为Mysql安装一个服务,服务名是
master 。同理操作slave 。(注意
mysqld =mysqld-nt
)c.
在运行里运行REGEDIT,打开WINDOWS注册表编辑器,在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\master 打开,修改下面的ImagePath数值: "X:\
master \bin\mysqld" --defaults-file="D:\master\my.ini"
master 确定,退出注册表编辑器。 (同理操作slave)
d.定义my.ini拷贝到 X
:\ master 下面
[client]
port = 3308
[mysqld]
port =3308
server-id = 1
binlog-do-db=test1 ##要同步的数据库名为test1
log-bin =mysql-bin
e.定义my.ini拷贝到x:\slave下面
[client]
port = 3309
[mysqld]
port = 3309
server-id = 2
master-host = 127.0.0.1
master-user = slaver1
master-password = slaver1pwd
master-port = 3308
replicate-do-db=test1 ##要同步的数据库
f. 然后在master
Console 执行: GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO 'slaver1'@'127.0.0.1' IDENTIFIED BY 'slaver1pwd';
开一个新账号(用户名:slaver1 密码:slaver1pwd)并赋于权限
运行Mysqld.exe,并创建新数据库test1,可在Console下输入:show master status\G查看状态!
*************************** 1. row*****************
File: mysql-bin.000305
Position: 98
Binlog_Do_DB: test1
Binlog_Ignore_DB:
g.
运行Slaver 的Mysqld.exe,在Console窗口执行 show slave status\G 查看状态,如下:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_User: slaver1
Master_Port: 3308
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 2495
Relay_Log_File: 2012-0416-1022-relay-bin.000007
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: test1
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 2495
Relay_Log_Space: 235
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)
1 ::Windows XP配置
2 set pan=%0
3 set pan=%pan:~1,3%
4 set devenvdir=%pan%DEV_FOR_JEE
5
6 ::windows 7手动输入盘符,放开注释
7 set devenvdir=X:\DEV_FOR_JEE
8
9 wmic ENVIRONMENT where "name='JAVA_HOME'" delete
10 wmic ENVIRONMENT where "name='MVN_HOME'" delete
11 wmic ENVIRONMENT where "name='ClassPath'" delete
12 wmic ENVIRONMENT where "name='M2_REPO'" delete
13 wmic ENVIRONMENT create name="JAVA_HOME",username="<system>",VariableValue="%devenvdir%\java1.6"
14 wmic ENVIRONMENT create name="MVN_HOME",username="<system>",VariableValue="%devenvdir%\maven3.0.4"
15 wmic ENVIRONMENT create name="M2_REPO",username="<system>",VariableValue="%devenvdir%\repository"
16 wmic ENVIRONMENT create name="ClassPath",username="<system>",VariableValue="%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\bin;.;"
17 wmic ENVIRONMENT where "name='Path' and username='<system>'" set VariableValue="%%JAVA_HOME%%\bin;%%MVN_HOME%%\bin;%%M2_REPO%%;%path%"
18 pause
19