一、环境介绍
二、安装后端服务器

三、安装前端Apache服务

四、配置Apache使用mod_jk模块实现代理及负载均衡

五、配置Apache基于mod_proxy模块实现代理及负载均衡

六、论坛安装

七、安装并配置Keepalived实现前端高可用

 


一、环境介绍

Apache+Tomcat构建Tomcat负载均衡集群_第1张图片

系统版本:CentOS 6.4_x86_64 

Mysql版本:mysql-5.1.66-2.el6_3.x86_64 

Apache版本:httpd-2.2.25 点此下载

Keepalived版本:keepalived-1.2.7 点此下载

Tomcat版本:apache-tomcat-7.0.33 点此下载

Jdk版本: jdk-7u40-linux-x64 点此下载

Tomcat-commectors版本:tomcat-connectors-1.2.37 点此下载

论坛版本:JspRun!_6.0.0_GBK 点此下载

环境介绍:

当用户通过 "www.allen.com" 域名访问时,首先是由前端两台Apache代理服务器响应并转发到后端Tomcat服务器上,而在Apache上做的是反向代理负载均衡到后端Tomcat服务器上,前端服务器使用Keepalived做的高可用集群,【Apache1默认为Master,Apache2为Backup】虚拟IP地址为"172.16.14.10"模拟为公网IP;当然这里数据库只有一台主机会成为点故障,这里不要介绍Mysql的高可用,如果有兴趣可以看前面写的博客 

提示:这里使用Keepalived做高可用时,前面所有的服务都已完成后,最后实现的对前端服务器做高可用


二、安装后端Tomcat与Mysql服务器

1、在Tomcat1与Tomcat2服务器上安装Tomcat,安装方法相同,这里只介绍一次

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
安装JDK
# rpm -ivh jdk-7u40-linux-x64.rpm
# vim /etc/profile.d/java.sh
exportJAVA_HOME=/usr/java/latest
exportPATH=$JAVA_HOME/bin:$PATH
# . /etc/profile.d/java.sh
# java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
------------------------------------------------------------------------
安装Tomcat
# tar xf apache-tomcat-7.0.33.tar.gz -C /usr/local/
# cd /usr/local/
# ln -s apache-tomcat-7.0.33 tomcat
# vim /etc/profile.d/tomcat.sh
exportCATALINA_HOME=/usr/local/tomcat
exportPATH=$CATALINA_HOME/bin:$PATH
# . /etc/profile.d/tomcat.sh
# catalina.sh version
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.33
Server built: Nov 18 2012 04:15:21
Server number: 7.0.33.0
OS Name: Linux
OS Version: 2.6.32-358.el6.x86_64
Architecture: amd64
JVM Version: 1.7.0_40-b43
JVM Vendor: Oracle Corporation

2、启动Tomcat服务并访问测试,默认访问端口为"8080";如下

1
2
3
4
5
6
7
8
9
10
11
# catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
# jps
2283 Jps
2272 Bootstrap
# ss -tanlp | grep 8080
LISTEN 0 100 :::8080 :::* users:(("java",2272,40))

Apache+Tomcat构建Tomcat负载均衡集群_第2张图片

3、开启Tomcat管理及状态页面

1
2
3
4
5
6
# vim /usr/local/tomcat/conf/tomcat-users.xml
"manager-gui"/>
"admin-gui"/>
"allen"password="admin"roles="manager-gui,admin-gui"/>
# catalina.sh stop
# catalina.sh start

4、访问Tomcat后台管理

Apache+Tomcat构建Tomcat负载均衡集群_第3张图片

Apache+Tomcat构建Tomcat负载均衡集群_第4张图片

5、安装Mysql服务器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
######安装Mysql并创建数据库,授权用户访问新创建的数据库有所有权,方便后面使用
[root@Mysql ~]# yum -y install mysql-server
[root@Mysql ~]# service mysqld start
[root@Mysql ~]# mysql
mysql> create database bbs;
mysql> grant all on bbs.* to  'bbsuser'@'172.16.%.%'identified by 'bbspass';
mysql> flush privileges;
----------------------------------------------------------------------
远程连接数据库测试授权用户是否能连接成功
# mysql -ubbsuser -pbbspass -h 172.16.14.5 -e 'show databases';
+--------------------+
| Database |
+--------------------+
| information_schema |
| bbs |
test|
+--------------------+

三、安装前端Apache服务

1、在Apache1与Apache2服务器上安装Httpd软件,安装方法相同,这里只介绍一次

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# tar xf httpd-2.2.25.tar.bz2
# cd httpd-2.2.25
# yum -y install gcc gcc-c++ openssl-devel pcre-devel
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-modules=most --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-mpms-shared=all --with-mpm=prefork --enable-proxy --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-cache --enable-cache-disk --enable-mem-cache --enable-file-cache --enable-proxy-connect
# make && make install
# cp build/rpm/httpd.init /etc/init.d/httpd
------修改如下内容
# vim /etc/init.d/httpd
httpd=${HTTPD-/usr/local/apache/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache/logs/${prog}.pid}
lockfile=${LOCKFILE-/var/lock/subsys/${prog}}
RETVAL=0
# check for 1.3 configuration
check13 () {
CONFFILE=/etc/httpd/httpd.conf
----------------------------------------------------------------------
修改环境变量并把Httpd加入到系统服务
# echo "PATH=/usr/local/apache/bin:$PATH" >> /etc/profile.d/http.sh
# . /etc/profile.d/http.sh
# ln -s /usr/local/apache/include/ /usr/include/httpd
# chkconfig --add httpd
----------------------------------------------------------------------
创建测试页
# echo "

APACHE

" > /usr/local/apache/htdocs/index.html

2、在Apache1与Apache2服务器上安装"tomcat-connectors"

1
2
3
4
5
6
7
8
9
10
11
12
13
# tar xf tomcat-connectors-1.2.37-src.tar.gz
# cd tomcat-connectors-1.2.37-src/native/
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make && make install
------------------------------------------------------------------------
安装完成后会生成如下文件
# ls /usr/local/apache/modules/
mod_jk.so
------------------------------------------------------------------------
启动Httpd服务
#service httpd start
# ss -tanl |grep 80
LISTEN 0 128 :::80 :::*

3、访问测试Apache是否正常工作

Apache+Tomcat构建Tomcat负载均衡集群_第5张图片


四、配置Apache使用mod_jk模块实现代理及负载均衡

1、修改Apache主配置文件,包含一个文件并创建该文件;实现代理功能

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
将下面指令添加到文件末尾即可
# vim /etc/httpd/httpd.conf
Include /etc/httpd/extra/mod_jk.conf
------------------------------------------------------------------------
创建文件添加如下内容
# vim /etc/httpd/extra/mod_jk.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/extra/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkMount /* TomcatA
JkMount /status/ stat1
------------------------------------------------------------------------
# vim /etc/httpd/extra/workers.properties
worker.list=TomcatA,stat1
worker.TomcatA.port=8009
worker.TomcatA.host=172.16.14.3
worker.TomcatA.type=ajp13
worker.TomcatA.lbfactor=1
worker.stat1. type= status
----------------------------------------------------------------------
# service httpd restart

2、修改后端Tomcat1服务器,添加一个虚拟主机并提供测试页面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[root@Tomcat1 ~]# cd /usr/local/tomcat/conf/
[root@Tomcat1 conf]# cp server.xml server.xml.bak
[root@Tomcat1 conf]# vim server.xml
######修改如下内容
"Catalina"defaultHost="www.allen.com"jvmRoute="TomcatA">
######在"Engine"中添加如下内容
"www.allen.com"appBase="/web/allen"
unpackWARs= "true"autoDeploy="true">
"org.apache.catalina.valves.AccessLogValve"directory="logs"
prefix= "allen_access_log."suffix=".txt"
pattern= "%h %l %u %t "%r" %s %b"/>
""docBase="/web/allen"/>
</Host>
----------------------------------------------------------------------
######创建网站存放目录并创建测试页
[root@Tomcat1 ~]# mkdir -p /web/allen
[root@Tomcat1 ~]# vim /web/allen/index.jsp
<%@ page language= "java"%>
<head>TomcatA<</code><code class="bash plain">/title</code><code class="bash plain">><</code><code class="bash plain">/head</code><code class="bash plain">></code></span></span> </div> <div class="line number21 index20 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><body></span></code> </div> <div class="line number22 index21 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><h1><font color=</code><span style="color:#000000;"><code class="bash string">"red"</code><code class="bash plain">>TomcatA <</code><code class="bash plain">/font</code><code class="bash plain">><</code><code class="bash plain">/h1</code><code class="bash plain">></code></span></span> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><table align=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"centre"</span></code><span style="font-family:nsimsun;"><code class="bash plain">border=</code><code class="bash string">"1"</code><code class="bash plain">></code></span></span> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><span style="color:#000000;"><code class="bash functions">tr</code><code class="bash plain">></code></span></span> </div> <div class="line number25 index24 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td>Session ID<</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number26 index25 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><% session.setAttribute(</code><span style="color:#000000;"><code class="bash string">"abc"</code><code class="bash plain">,</code><code class="bash string">"abc"</code><code class="bash plain">); %></code></span></span> </div> <div class="line number27 index26 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td><%= session.getId() %><</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number28 index27 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/tr</code><code class="bash plain">></code></span> </div> <div class="line number29 index28 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><span style="color:#000000;"><code class="bash functions">tr</code><code class="bash plain">></code></span></span> </div> <div class="line number30 index29 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td>Created on<</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number31 index30 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td><%= session.getCreationTime() %><</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number32 index31 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/tr</code><code class="bash plain">></code></span> </div> <div class="line number33 index32 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/table</code><code class="bash plain">></code></span> </div> <div class="line number34 index33 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/body</code><code class="bash plain">></code></span> </div> <div class="line number35 index34 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/html</code><code class="bash plain">></code></span> </div> <div class="line number36 index35 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number37 index36 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######重启Tomcat服务并查看是否启动成功</span></code> </div> <div class="line number38 index37 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat1 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh stop</span></code></span> </div> <div class="line number39 index38 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat1 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh configtest</span></code></span> </div> <div class="line number40 index39 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat1 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh start</span></code></span> </div> <div class="line number41 index40 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat1 ~]</code><code class="bash comments"><span style="color:#000000;"># ss -tanlp | grep java</span></code></span> </div> <div class="line number42 index41 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 100 :::8080 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,40))</code></span></span> </div> <div class="line number43 index42 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,52))</code></span></span> </div> <div class="line number44 index43 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 100 :::8009 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,41))</code></span></span> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">3、访问Apache1主机,验证是否代理成功</span></p> <p><a href="http://img.e-com-net.com/image/info3/d27c79fb3f6d4424adcabb14a3765dee.jpg" target="_blank"><img title="2013-10-01_153314.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第6张图片" src="http://img.e-com-net.com/image/info3/d27c79fb3f6d4424adcabb14a3765dee.jpg" width="650" height="152" style="border:1px solid black;"></a></p> <p><span style="color:#000000;"><span style="font-family:'宋体', simsun;color:#000000;">4、修改Apache配置文件(mod_jk.conf、workers.properties);</span><strong><span style="font-family:'宋体', simsun;color:#000000;">实现负载均衡</span></strong></span><br></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /etc/httpd/extra/mod_jk.conf</span></code> </div> <div class="line number2 index1 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">LoadModule jk_module modules</code><code class="bash plain">/mod_jk</code><code class="bash plain">.so</code></span> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">JkWorkersFile </code><code class="bash plain">/etc/httpd/extra/workers</code><code class="bash plain">.properties</code></span> </div> <div class="line number4 index3 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">JkLogFile logs</code><code class="bash plain">/mod_jk</code><code class="bash plain">.log</code></span> </div> <div class="line number5 index4 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">JkLogLevel debug</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">JkMount /* lbcluster</span></code> </div> <div class="line number7 index6 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">JkMount </code><code class="bash plain">/status/</code></span> <code class="bash plain"><span style="font-family:nsimsun;">stat1</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">------------------------------------------------------------------------</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /etc/httpd/extra/workers.properties</span></code> </div> <div class="line number10 index9 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.list=lbcluster,stat1</span></code> </div> <div class="line number11 index10 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatA.port=8009</span></code> </div> <div class="line number12 index11 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatA.host=172.16.14.3</span></code> </div> <div class="line number13 index12 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">worker.TomcatA.</code><span style="color:#000000;"><code class="bash functions">type</code><code class="bash plain">=ajp13</code></span></span> </div> <div class="line number14 index13 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatA.lbfactor=1</span></code> </div> <div class="line number15 index14 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatB.port = 8009</span></code> </div> <div class="line number16 index15 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatB.host=172.16.14.4</span></code> </div> <div class="line number17 index16 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatB.</span></code> <span style="color:#000000;"><code class="bash functions"><span style="font-family:nsimsun;">type</span></code><code class="bash plain"><span style="font-family:nsimsun;">= ajp13</span></code></span> </div> <div class="line number18 index17 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.TomcatB.lbfactor = 1</span></code> </div> <div class="line number19 index18 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">worker.lbcluster.</span></code> <span style="color:#000000;"><code class="bash functions"><span style="font-family:nsimsun;">type</span></code><code class="bash plain"><span style="font-family:nsimsun;">= lb</span></code></span> </div> <div class="line number20 index19 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">worker.lbcluster.sticky_session = 0 </code><code class="bash comments"><span style="color:#000000;">#取值为{1|0}1将用户session与后端服务器绑定,0为不绑定,如果支持session复制或session共享可以设置为0</span></code></span> </div> <div class="line number21 index20 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">worker.lbcluster.balance_workers = TomcatA, TomcatB</span></code> </div> <div class="line number22 index21 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">worker.stat1.</span></code> <span style="color:#000000;"><code class="bash functions"><span style="font-family:nsimsun;">type</span></code><code class="bash plain"><span style="font-family:nsimsun;">= status</span></code></span> </div> <div class="line number23 index22 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number24 index23 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># service httpd reload</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">5、修改后端Tomcat2服务器,添加一个虚拟主机并提供测试页面</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div> <div class="line number25 index24 alt2"> 25 </div> <div class="line number26 index25 alt1"> 26 </div> <div class="line number27 index26 alt2"> 27 </div> <div class="line number28 index27 alt1"> 28 </div> <div class="line number29 index28 alt2"> 29 </div> <div class="line number30 index29 alt1"> 30 </div> <div class="line number31 index30 alt2"> 31 </div> <div class="line number32 index31 alt1"> 32 </div> <div class="line number33 index32 alt2"> 33 </div> <div class="line number34 index33 alt1"> 34 </div> <div class="line number35 index34 alt2"> 35 </div> <div class="line number36 index35 alt1"> 36 </div> <div class="line number37 index36 alt2"> 37 </div> <div class="line number38 index37 alt1"> 38 </div> <div class="line number39 index38 alt2"> 39 </div> <div class="line number40 index39 alt1"> 40 </div> <div class="line number41 index40 alt2"> 41 </div> <div class="line number42 index41 alt1"> 42 </div> <div class="line number43 index42 alt2"> 43 </div> <div class="line number44 index43 alt1"> 44 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># cd /usr/local/tomcat/conf/</span></code></span> </div> <div class="line number2 index1 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 conf]</code><code class="bash comments"><span style="color:#000000;"># cp server.xml server.xml.bak</span></code></span> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 conf]</code><code class="bash comments"><span style="color:#000000;"># vim server.xml</span></code></span> </div> <div class="line number4 index3 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######修改如下内容</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash plain"><span style="font-family:nsimsun;"><Engine name=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"Catalina"</span></code><span style="font-family:nsimsun;"><code class="bash plain">defaultHost=</code><code class="bash string">"www.allen.com"</code></span><span style="font-family:nsimsun;"><code class="bash plain">jvmRoute=</code><code class="bash string">"TomcatB"</code><code class="bash plain">></code></span></span> </div> <div class="line number6 index5 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######在"Engine"中添加如下内容</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash plain"><span style="font-family:nsimsun;"><Host name=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"www.allen.com"</span></code><span style="font-family:nsimsun;"><code class="bash plain">appBase=</code><code class="bash string">"/web/allen"</code></span></span> </div> <div class="line number8 index7 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">unpackWARs=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"true"</span></code><span style="font-family:nsimsun;"><code class="bash plain">autoDeploy=</code><code class="bash string">"true"</code><code class="bash plain">></code></span></span> </div> <div class="line number9 index8 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><Valve className=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"org.apache.catalina.valves.AccessLogValve"</span></code><span style="font-family:nsimsun;"><code class="bash plain">directory=</code><code class="bash string">"logs"</code></span></span> </div> <div class="line number10 index9 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">prefix=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"allen_access_log."</span></code><span style="font-family:nsimsun;"><code class="bash plain">suffix=</code><code class="bash string">".txt"</code></span></span> </div> <div class="line number11 index10 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">pattern=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"%h %l %u %t "%r" %s %b"</span></code><code class="bash plain"><span style="font-family:nsimsun;">/></span></code></span> </div> <div class="line number12 index11 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><Context path=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">""</span></code><span style="font-family:nsimsun;"><code class="bash plain">docBase=</code><code class="bash string">"/web/allen"</code></span><code class="bash plain"><span style="font-family:nsimsun;">/></span></code></span> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Host</code><code class="bash plain">></code></span> </div> <div class="line number14 index13 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number15 index14 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######创建网站存放目录并创建测试页</span></code> </div> <div class="line number16 index15 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># mkdir -p /web/allen</span></code></span> </div> <div class="line number17 index16 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># vim /web/allen/index.jsp</span></code></span> </div> <div class="line number18 index17 alt1"> <code class="bash plain"><span style="font-family:nsimsun;"><%@ page language=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"java"</span></code><code class="bash plain"><span style="font-family:nsimsun;">%></span></code></span> </div> <div class="line number19 index18 alt2"> <code class="bash plain"><span style="font-family:nsimsun;"><html></span></code> </div> <div class="line number20 index19 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><span style="color:#000000;"><code class="bash functions">head</code><code class="bash plain">><title>TomcatB<</code><code class="bash plain">/title</code><code class="bash plain">><</code><code class="bash plain">/head</code><code class="bash plain">></code></span></span> </div> <div class="line number21 index20 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><body></span></code> </div> <div class="line number22 index21 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><h1><font color=</code><span style="color:#000000;"><code class="bash string">"blue"</code><code class="bash plain">>TomcatB <</code><code class="bash plain">/font</code><code class="bash plain">><</code><code class="bash plain">/h1</code><code class="bash plain">></code></span></span> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;"><table align=</span></code> <span style="color:#000000;"><code class="bash string"><span style="font-family:nsimsun;">"centre"</span></code><span style="font-family:nsimsun;"><code class="bash plain">border=</code><code class="bash string">"1"</code><code class="bash plain">></code></span></span> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><span style="color:#000000;"><code class="bash functions">tr</code><code class="bash plain">></code></span></span> </div> <div class="line number25 index24 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td>Session ID<</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number26 index25 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><% session.setAttribute(</code><span style="color:#000000;"><code class="bash string">"abc"</code><code class="bash plain">,</code><code class="bash string">"abc"</code><code class="bash plain">); %></code></span></span> </div> <div class="line number27 index26 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td><%= session.getId() %><</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number28 index27 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/tr</code><code class="bash plain">></code></span> </div> <div class="line number29 index28 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><span style="color:#000000;"><code class="bash functions">tr</code><code class="bash plain">></code></span></span> </div> <div class="line number30 index29 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td>Created on<</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number31 index30 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><td><%= session.getCreationTime() %><</code><code class="bash plain">/td</code><code class="bash plain">></code></span> </div> <div class="line number32 index31 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/tr</code><code class="bash plain">></code></span> </div> <div class="line number33 index32 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/table</code><code class="bash plain">></code></span> </div> <div class="line number34 index33 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/body</code><code class="bash plain">></code></span> </div> <div class="line number35 index34 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/html</code><code class="bash plain">></code></span> </div> <div class="line number36 index35 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number37 index36 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######重启Tomcat服务并查看是否启动成功</span></code> </div> <div class="line number38 index37 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh stop</span></code></span> </div> <div class="line number39 index38 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh configtest</span></code></span> </div> <div class="line number40 index39 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># catalina.sh start</span></code></span> </div> <div class="line number41 index40 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Tomcat2 ~]</code><code class="bash comments"><span style="color:#000000;"># ss -tanlp | grep java</span></code></span> </div> <div class="line number42 index41 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 100 :::8080 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,40))</code></span></span> </div> <div class="line number43 index42 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,52))</code></span></span> </div> <div class="line number44 index43 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">LISTEN 0 100 :::8009 :::* </code><span style="color:#000000;"><code class="bash functions">users</code><code class="bash plain">:((</code><code class="bash string">"java"</code><code class="bash plain">,6323,41))</code></span></span> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">6、访问Apache服务器,测试是否实现负载均衡<br></span></p> <p><a href="http://img.e-com-net.com/image/info3/3af82d490bd44eef92607722cc2fafdd.jpg" target="_blank"><img style="float:none;;border:1px solid black;" title="a.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第7张图片" src="http://img.e-com-net.com/image/info3/3af82d490bd44eef92607722cc2fafdd.jpg" width="650" height="151"></a></p> <p><a href="http://img.e-com-net.com/image/info3/8931d7126392457f9702d14b59659f98.jpg" target="_blank"><img style="float:none;;border:1px solid black;" title="b.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第8张图片" src="http://img.e-com-net.com/image/info3/8931d7126392457f9702d14b59659f98.jpg" width="650" height="152"></a></p> <p><strong><span style="font-family:'宋体', simsun;color:#e36c09;">由上可见,基于Apache的mod_jk模块已成功实现负载均衡功能</span></strong></p> <hr> <p><strong><span style="font-family:'宋体', simsun;color:#000000;font-size:18px;">五、配置Apache基于mod_proxy模块实现代理及负载均衡</span></strong></p> <p><span style="font-family:'宋体', simsun;">1、修改Apache的主配置文件,包含一个文件并创建该文件;</span><strong><span style="font-family:'宋体', simsun;">实现代理功能</span></strong></p> <p><strong><span style="font-family:'宋体', simsun;"></span></strong></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div> <div class="line number25 index24 alt2"> 25 </div> <div class="line number26 index25 alt1"> 26 </div> <div class="line number27 index26 alt2"> 27 </div> <div class="line number28 index27 alt1"> 28 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /etc/httpd/httpd.conf</span></code> </div> <div class="line number2 index1 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">#Include /etc/httpd/extra/mod_jk.conf #注释此行</span></code> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">Include </code><code class="bash plain">/etc/httpd/extra/mod_proxy</code><code class="bash plain">.conf</code></span> </div> <div class="line number4 index3 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">------------------------------------------------------------------------</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /etc/httpd/extra/mod_proxy.conf</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyVia On</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyRequests Off</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyPreserveHost Off</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash plain"><span style="font-family:nsimsun;"><Proxy *></span></code> </div> <div class="line number10 index9 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Order allow,deny</span></code> </div> <div class="line number11 index10 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Allow from all</span></code> </div> <div class="line number12 index11 alt1"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Proxy</code><code class="bash plain">></code></span> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPass / ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009/</code></span> </div> <div class="line number14 index13 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPa***everse / ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009/</code></span> </div> <div class="line number15 index14 alt2"> <code class="bash plain"><span style="font-family:nsimsun;"><Location / ></span></code> </div> <div class="line number16 index15 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Order allow,deny</span></code> </div> <div class="line number17 index16 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Allow from all</span></code> </div> <div class="line number18 index17 alt1"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Location</code><code class="bash plain">></code></span> </div> <div class="line number19 index18 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number20 index19 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># service httpd reload</span></code> </div> <div class="line number21 index20 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">======================================================================</span></code> </div> <div class="line number22 index21 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">注释:</span></code> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPass / ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009/ </code><code class="bash comments"><span style="color:#000000;">#使用的是ajp协议</span></code></span> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPa***everse / ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009/</code></span> </div> <div class="line number25 index24 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">可以更改为使用http协议;如下</span></code> </div> <div class="line number26 index25 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPass / http:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8080/</code></span> </div> <div class="line number27 index26 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPa***everse / http:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8080/</code></span> </div> <div class="line number28 index27 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######这里只演示使用ajp协议,如果是Apache与Tomcat结合建议使用ajp协议</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">2、访问Apache1服务器,测试是否代理成功</span><br></p> <p><a href="http://img.e-com-net.com/image/info3/b80dd84478c44c96be17f47e260f40dd.jpg" target="_blank"><img title="2013-10-01_163003.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第9张图片" src="http://img.e-com-net.com/image/info3/b80dd84478c44c96be17f47e260f40dd.jpg" width="650" height="152" style="border:1px solid black;"></a></p> <p><span style="font-family:'宋体', simsun;">3、修改Apache配置文件(mod_proxy.conf);</span><strong><span style="font-family:'宋体', simsun;">实现负载均衡</span></strong></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div> <div class="line number25 index24 alt2"> 25 </div> <div class="line number26 index25 alt1"> 26 </div> <div class="line number27 index26 alt2"> 27 </div> <div class="line number28 index27 alt1"> 28 </div> <div class="line number29 index28 alt2"> 29 </div> <div class="line number30 index29 alt1"> 30 </div> <div class="line number31 index30 alt2"> 31 </div> <div class="line number32 index31 alt1"> 32 </div> <div class="line number33 index32 alt2"> 33 </div> <div class="line number34 index33 alt1"> 34 </div> <div class="line number35 index34 alt2"> 35 </div> <div class="line number36 index35 alt1"> 36 </div> <div class="line number37 index36 alt2"> 37 </div> <div class="line number38 index37 alt1"> 38 </div> <div class="line number39 index38 alt2"> 39 </div> <div class="line number40 index39 alt1"> 40 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /etc/httpd/extra/mod_proxy.conf</span></code> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyVia Off</span></code> </div> <div class="line number3 index2 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyRequests Off</span></code> </div> <div class="line number4 index3 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">ProxyPreserveHost Off</span></code> </div> <div class="line number5 index4 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><Proxy balancer:</code><code class="bash plain">//allen</code><code class="bash plain">></code></span> </div> <div class="line number6 index5 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009 loadfactor=1</code></span> </div> <div class="line number7 index6 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.4:8009 loadfactor=1</code></span> </div> <div class="line number8 index7 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">ProxySet lbmethod=bytraffic</span></code> </div> <div class="line number9 index8 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Proxy</code><code class="bash plain">></code></span> </div> <div class="line number10 index9 alt1"> <span style="font-family:nsimsun;"><code class="bash plain"><Location </code><code class="bash plain">/allen</code><code class="bash plain">> </code><code class="bash comments"><span style="color:#000000;">#设置状态及管理页面</span></code></span> </div> <div class="line number11 index10 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">SetHandler balancer-manager</span></code> </div> <div class="line number12 index11 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Proxypass !</span></code> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Order allow,deny</span></code> </div> <div class="line number14 index13 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Allow from all</span></code> </div> <div class="line number15 index14 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Location</code><code class="bash plain">></code></span> </div> <div class="line number16 index15 alt1"> <code class="bash plain"><span style="font-family:nsimsun;"><Proxy *></span></code> </div> <div class="line number17 index16 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Order allow,deny</span></code> </div> <div class="line number18 index17 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Allow from all</span></code> </div> <div class="line number19 index18 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Proxy</code><code class="bash plain">></code></span> </div> <div class="line number20 index19 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPass / balancer:</code><code class="bash plain">//allen/</code></span> <code class="bash plain"><span style="font-family:nsimsun;">stickysession=JSESSIONID</span></code> </div> <div class="line number21 index20 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">ProxyPa***everse / balancer:</code><code class="bash plain">//allen/</code></span> </div> <div class="line number22 index21 alt1"> <code class="bash plain"><span style="font-family:nsimsun;"><Location / ></span></code> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Order allow,deny</span></code> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">Allow from all</span></code> </div> <div class="line number25 index24 alt2"> <span style="font-family:nsimsun;"><code class="bash plain"><</code><code class="bash plain">/Location</code><code class="bash plain">></code></span> </div> <div class="line number26 index25 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number27 index26 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">注释:</span></code> </div> <div class="line number28 index27 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8009 loadfactor=1 </code><code class="bash comments"><span style="color:#000000;">#使用ajp协议</span></code></span> </div> <div class="line number29 index28 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember ajp:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.4:8009 loadfactor=1</code></span> </div> <div class="line number30 index29 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">可更改为使用http协议</span></code> </div> <div class="line number31 index30 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember http:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.3:8080 loadfactor=1</code></span> </div> <div class="line number32 index31 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">BalancerMember http:</code><code class="bash plain">//172</code><code class="bash plain">.16.14.4:8080 loadfactor=1</code></span> </div> <div class="line number33 index32 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######这里只介绍使用ajp协议,如果有兴趣可以更改一下;loadfactor:权重</span></code> </div> <div class="line number34 index33 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number35 index34 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">ProxySet lbmethod=bytraffic </code><code class="bash comments"><span style="color:#000000;">#设置调度算法</span></code></span> </div> <div class="line number36 index35 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">byrequests:即基于权重将统计请求个数进行调度(默认)</span></code> </div> <div class="line number37 index36 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">bytraffic:则执行基于权重的流量计数调度</span></code> </div> <div class="line number38 index37 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">bybusyness:通过考量每个后端服务器的当前负载进行调度</span></code> </div> <div class="line number39 index38 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">----------------------------------------------------------------------</span></code> </div> <div class="line number40 index39 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># service httpd reload</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">4、访问Apache服务器,测试基于mod_proxy模块是否实现负载均衡</span></p> <p><a href="http://img.e-com-net.com/image/info3/ceb0f28f12a94681a1bc1ced7007b07e.jpg" target="_blank"><img style="float:none;;border:1px solid black;" title="2013-10-01_164655.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第10张图片" src="http://img.e-com-net.com/image/info3/ceb0f28f12a94681a1bc1ced7007b07e.jpg" width="650" height="150"></a></p> <p><a href="http://img.e-com-net.com/image/info3/3bc409e30749427b87265290ed74dd49.jpg" target="_blank"><img style="float:none;;border:1px solid black;" title="2013-10-01_164739.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第11张图片" src="http://img.e-com-net.com/image/info3/3bc409e30749427b87265290ed74dd49.jpg" width="650" height="149"></a></p> <p><span style="font-family:'宋体', simsun;">5、访问状态页面</span></p> <p><a href="http://img.e-com-net.com/image/info3/828f03e305ec478299b8e961f942615e.jpg" target="_blank"><img title="2013-10-01_174628.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第12张图片" src="http://img.e-com-net.com/image/info3/828f03e305ec478299b8e961f942615e.jpg" width="650" height="307" style="border:1px solid black;"></a></p> <hr> <p><strong><span style="font-family:'宋体', simsun;font-size:18px;">六、论坛安装</span></strong></p> <p><span style="font-family:'宋体', simsun;">1、在Tomcat1服务器上安装<br></span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># unzip JspRun\!_6.0.0_GBK.zip</span></code> </div> <div class="line number2 index1 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># mv /web/allen/index.jsp /web/allen/test.jsp</span></code> </div> <div class="line number3 index2 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># cp -r upload/* /web/allen/</span></code> </div> <div class="line number4 index3 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">------------------------------------------------------------------------</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">修改论坛数据库连接文件</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># vim /web/allen/config.properties</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">dbhost = 172.16.14.5</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">dbport=3306</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">dbuser = bbsuser</span></code> </div> <div class="line number10 index9 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">dbpw = bbspass</span></code> </div> <div class="line number11 index10 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">dbname = bbs</span></code> </div> <div class="line number12 index11 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">------------------------------------------------------------------------</span></code> </div> <div class="line number13 index12 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># catalina.sh stop</span></code> </div> <div class="line number14 index13 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># catalina.sh start</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">2、安装论坛程序<br></span></p> <p><a href="http://img.e-com-net.com/image/info3/ee6c8b12ef634aa989fa4cea79adb8ec.jpg" target="_blank"><img title="2013-10-01_181046.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第13张图片" src="http://img.e-com-net.com/image/info3/ee6c8b12ef634aa989fa4cea79adb8ec.jpg" width="650" height="332" style="border:1px solid black;"></a></p> <p><span style="line-height:28px;background-color:#ffffff;font-family:'宋体', simsun;color:#2c2c2c;font-size:14px;"><span style="line-height:28px;background-color:#ffffff;font-family:'宋体', simsun;color:#2c2c2c;font-size:16px;">3、</span><span style="line-height:28px;background-color:#ffffff;font-family:'宋体', simsun;color:#2c2c2c;font-size:14px;">点击下一步-->我同意-->下一步,进入数据库配置页面</span></span></p> <p><a href="http://img.e-com-net.com/image/info3/558e49cc3e6344e0bd3104c84e2be2a1.gif" target="_blank"><img title="2013-10-01_181210.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第14张图片" src="http://img.e-com-net.com/image/info3/558e49cc3e6344e0bd3104c84e2be2a1.gif" width="906" height="559" style="border:1px solid black;"></a></p> <p><span style="line-height:28px;background-color:#ffffff;margin:0px;font-family:'宋体', simsun;color:#2c2c2c;font-size:16px;padding:0px;">4、点下一步-->(填写管理员密码)下一步-->进入创建数据表阶段-->然后点</span><img style="margin:0px;vertical-align:top;padding:0px;" title="2013-09-30_103504.gif" alt="103517659.gif" src="http://img.e-com-net.com/image/info3/d8e5fc53c2154cbd824fdef383ac44c7.gif" width="236" height="22"><span style="line-height:28px;background-color:#ffffff;margin:0px;font-family:'宋体', simsun;color:#2c2c2c;font-size:16px;padding:0px;">-->进入首页</span></p> <p><a href="http://img.e-com-net.com/image/info3/1f178148cf3045ed811e1fdf8c729950.jpg" target="_blank"><img title="2013-10-01_181420.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第15张图片" src="http://img.e-com-net.com/image/info3/1f178148cf3045ed811e1fdf8c729950.jpg" width="650" height="401" style="border:1px solid black;"></a></p> <p><span style="line-height:28px;background-color:#ffffff;font-family:'宋体', simsun;color:#2c2c2c;font-size:16px;">5、将论坛程序拷贝到Tomcat2服务器上一份并访问测试</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># mv /web/allen/index.jsp /web/allen/test.jsp #把原来的测试页重命名</span></code> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">------------------------------------------------------------------------</span></code> </div> <div class="line number3 index2 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># scp -r 172.16.14.3:/web/allen/* /web/allen/</span></code> </div> <div class="line number4 index3 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># catalina.sh stop</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;"># catalina.sh start</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:nsimsun;color:#000000;"><a href="http://img.e-com-net.com/image/info3/54a9117fc072436486820e471b888c7f.jpg" target="_blank"><img title="2013-10-01_182238.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第16张图片" src="http://img.e-com-net.com/image/info3/54a9117fc072436486820e471b888c7f.jpg" width="650" height="401" style="border:1px solid black;"></a></span></p> <p><span style="font-family:'宋体', simsun;">6、访问Apache服务器,测试是否能正常访问论坛程序,这里就不在做访问测试</span></p> <hr> <p><strong><span style="font-family:'宋体', simsun;font-size:18px;">七、安装并配置Keepalived</span></strong></p> <p><span style="font-family:'宋体', simsun;">1、将Apache1服务器的Httpd配置文件复制到Apache2服务器</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># cd /etc/httpd/</span></code></span> </div> <div class="line number2 index1 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 httpd]</code><code class="bash comments"><span style="color:#000000;"># scp httpd.conf 172.16.14.2:/etc/httpd/</span></code></span> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 httpd]</code><code class="bash comments"><span style="color:#000000;"># cd extra/</span></code></span> </div> <div class="line number4 index3 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 extra]</code><code class="bash comments"><span style="color:#000000;"># scp mod_jk.conf mod_proxy.conf workers.properties 172.16.14.2:/etc/httpd/extra/</span></code></span> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">2、在Apache1与Apache2服务器上安装Keepalived;这里使用rpm包安装,光盘映像中有</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># yum -y install keepalived</span></code></span> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">--------------------------------------------</span></code> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache2 ~]</code><code class="bash comments"><span style="color:#000000;"># yum -y install keepalived</span></code></span> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">3、配置Apache1服务器上的Keepalived</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div> <div class="line number25 index24 alt2"> 25 </div> <div class="line number26 index25 alt1"> 26 </div> <div class="line number27 index26 alt2"> 27 </div> <div class="line number28 index27 alt1"> 28 </div> <div class="line number29 index28 alt2"> 29 </div> <div class="line number30 index29 alt1"> 30 </div> <div class="line number31 index30 alt2"> 31 </div> <div class="line number32 index31 alt1"> 32 </div> <div class="line number33 index32 alt2"> 33 </div> <div class="line number34 index33 alt1"> 34 </div> <div class="line number35 index34 alt2"> 35 </div> <div class="line number36 index35 alt1"> 36 </div> <div class="line number37 index36 alt2"> 37 </div> <div class="line number38 index37 alt1"> 38 </div> <div class="line number39 index38 alt2"> 39 </div> <div class="line number40 index39 alt1"> 40 </div> <div class="line number41 index40 alt2"> 41 </div> <div class="line number42 index41 alt1"> 42 </div> <div class="line number43 index42 alt2"> 43 </div> <div class="line number44 index43 alt1"> 44 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># vim /etc/keepalived/keepalived.conf</span></code></span> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">! Configuration File </span></code> <span style="color:#000000;"><code class="bash keyword"><span style="font-family:nsimsun;">for</span></code><code class="bash plain"><span style="font-family:nsimsun;">keepalived</span></code></span> </div> <div class="line number3 index2 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">global_defs {</span></code> </div> <div class="line number4 index3 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">notification_email {</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">root@localhost</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">notification_email_from admin@allen.com</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">smtp_server 172.16.0.0</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">smtp_connect_timeout 30</span></code> </div> <div class="line number10 index9 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">router_id LVS_ALLEN</span></code> </div> <div class="line number11 index10 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number12 index11 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">vrrp_script chk_httpd {</span></code> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">script </code><code class="bash string"><span style="color:#000000;">"killall -0 httpd"</span></code></span> </div> <div class="line number14 index13 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">interval 1</span></code> </div> <div class="line number15 index14 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">weight -2</span></code> </div> <div class="line number16 index15 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number17 index16 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">vrrp_instance httpd_1 {</span></code> </div> <div class="line number18 index17 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">state MASTER</span></code> </div> <div class="line number19 index18 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">interface eth0</span></code> </div> <div class="line number20 index19 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">virtual_router_id 58</span></code> </div> <div class="line number21 index20 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">priority 100</span></code> </div> <div class="line number22 index21 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">advert_int 1</span></code> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">authentication {</span></code> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">auth_type PASS</span></code> </div> <div class="line number25 index24 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">auth_pass 1058</span></code> </div> <div class="line number26 index25 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number27 index26 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">virtual_ipaddress {</span></code> </div> <div class="line number28 index27 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">172.16.14.10</span></code> </div> <div class="line number29 index28 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number30 index29 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">track_script {</span></code> </div> <div class="line number31 index30 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">chk_httpd</span></code> </div> <div class="line number32 index31 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number33 index32 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number34 index33 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># service keepalived start</span></code></span> </div> <div class="line number35 index34 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># chkconfig keepalived on</span></code></span> </div> <div class="line number36 index35 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># chkconfig --list keepalived</span></code></span> </div> <div class="line number37 index36 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">keepalived 0:off 1:off 2:on 3:on 4:on 5:on 6:off</span></code> </div> <div class="line number38 index37 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># ip addr show eth0</span></code></span> </div> <div class="line number39 index38 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000</span></code> </div> <div class="line number40 index39 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">link</code><code class="bash plain">/ether</code></span> <code class="bash plain"><span style="font-family:nsimsun;">00:0c:29:2c:1a:24 brd ff:ff:ff:ff:ff:ff</span></code> </div> <div class="line number41 index40 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet 172.16.14.1</code><code class="bash plain">/16</code></span> <code class="bash plain"><span style="font-family:nsimsun;">brd 172.16.255.255 scope global eth0</span></code> </div> <div class="line number42 index41 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet 172.16.14.10</code><code class="bash plain">/32</code></span> <code class="bash plain"><span style="font-family:nsimsun;">scope global eth0</span></code> </div> <div class="line number43 index42 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet6 fe80::20c:29ff:fe2c:1a24</code><code class="bash plain">/64</code></span> <code class="bash plain"><span style="font-family:nsimsun;">scope link</span></code> </div> <div class="line number44 index43 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">valid_lft forever preferred_lft forever</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">4、配置Apache2服务器上的Keepalived</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div> <div class="line number18 index17 alt1"> 18 </div> <div class="line number19 index18 alt2"> 19 </div> <div class="line number20 index19 alt1"> 20 </div> <div class="line number21 index20 alt2"> 21 </div> <div class="line number22 index21 alt1"> 22 </div> <div class="line number23 index22 alt2"> 23 </div> <div class="line number24 index23 alt1"> 24 </div> <div class="line number25 index24 alt2"> 25 </div> <div class="line number26 index25 alt1"> 26 </div> <div class="line number27 index26 alt2"> 27 </div> <div class="line number28 index27 alt1"> 28 </div> <div class="line number29 index28 alt2"> 29 </div> <div class="line number30 index29 alt1"> 30 </div> <div class="line number31 index30 alt2"> 31 </div> <div class="line number32 index31 alt1"> 32 </div> <div class="line number33 index32 alt2"> 33 </div> <div class="line number34 index33 alt1"> 34 </div> <div class="line number35 index34 alt2"> 35 </div> <div class="line number36 index35 alt1"> 36 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache2 ~]</code><code class="bash comments"><span style="color:#000000;"># vim /etc/keepalived/keepalived.conf</span></code></span> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">! Configuration File </span></code> <span style="color:#000000;"><code class="bash keyword"><span style="font-family:nsimsun;">for</span></code><code class="bash plain"><span style="font-family:nsimsun;">keepalived</span></code></span> </div> <div class="line number3 index2 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">global_defs {</span></code> </div> <div class="line number4 index3 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">notification_email {</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">root@localhost</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">notification_email_from admin@allen.com</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">smtp_server 172.16.0.0</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">smtp_connect_timeout 30</span></code> </div> <div class="line number10 index9 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">router_id LVS_ALLEN</span></code> </div> <div class="line number11 index10 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number12 index11 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">vrrp_script chk_httpd {</span></code> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">script </code><code class="bash string"><span style="color:#000000;">"killall -0 httpd"</span></code></span> </div> <div class="line number14 index13 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">interval 1</span></code> </div> <div class="line number15 index14 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">weight -2</span></code> </div> <div class="line number16 index15 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number17 index16 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">vrrp_instance httpd_1 {</span></code> </div> <div class="line number18 index17 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">state BACKUP</span></code> </div> <div class="line number19 index18 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">interface eth0</span></code> </div> <div class="line number20 index19 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">virtual_router_id 58</span></code> </div> <div class="line number21 index20 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">priority 99</span></code> </div> <div class="line number22 index21 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">advert_int 1</span></code> </div> <div class="line number23 index22 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">authentication {</span></code> </div> <div class="line number24 index23 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">auth_type PASS</span></code> </div> <div class="line number25 index24 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">auth_pass 1058</span></code> </div> <div class="line number26 index25 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number27 index26 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">virtual_ipaddress {</span></code> </div> <div class="line number28 index27 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">172.16.14.10</span></code> </div> <div class="line number29 index28 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number30 index29 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">track_script {</span></code> </div> <div class="line number31 index30 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">chk_httpd</span></code> </div> <div class="line number32 index31 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number33 index32 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">}</span></code> </div> <div class="line number34 index33 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache2 ~]</code><code class="bash comments"><span style="color:#000000;"># service keepalived start</span></code></span> </div> <div class="line number35 index34 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache2 ~]</code><code class="bash comments"><span style="color:#000000;"># chkconfig --list keepalived</span></code></span> </div> <div class="line number36 index35 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">keepalived 0:off 1:off 2:on 3:on 4:on 5:on 6:off</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">5、使用"www.allen.com" 域名访问,验证是否能访问到论坛;由于没有DNS服务器解析,修改了"hosts"文件;如:</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######添加如下内容解析</span></code> </div> <div class="line number2 index1 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">C:\Windows\System32\drivers\etc\hosts</span></code> </div> <div class="line number3 index2 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">172.16.14.10 www.allen.com</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:nsimsun;"><a href="http://img.e-com-net.com/image/info3/50236c618a4e4912a75388a55fd8b028.jpg" target="_blank"><img title="2013-10-01_193941.gif" alt="Apache+Tomcat构建Tomcat负载均衡集群_第17张图片" src="http://img.e-com-net.com/image/info3/50236c618a4e4912a75388a55fd8b028.jpg" width="650" height="401" style="border:1px solid black;"></a></span></p> <p><span style="font-family:'宋体', simsun;">6、模拟前端一台服务器出现故障;查看虚拟IP是否转移</span></p> <div> <div class="syntaxhighlighter bash ie"> <table> <tbody> <tr> <td class="gutter"> <div class="line number1 index0 alt2"> 1 </div> <div class="line number2 index1 alt1"> 2 </div> <div class="line number3 index2 alt2"> 3 </div> <div class="line number4 index3 alt1"> 4 </div> <div class="line number5 index4 alt2"> 5 </div> <div class="line number6 index5 alt1"> 6 </div> <div class="line number7 index6 alt2"> 7 </div> <div class="line number8 index7 alt1"> 8 </div> <div class="line number9 index8 alt2"> 9 </div> <div class="line number10 index9 alt1"> 10 </div> <div class="line number11 index10 alt2"> 11 </div> <div class="line number12 index11 alt1"> 12 </div> <div class="line number13 index12 alt2"> 13 </div> <div class="line number14 index13 alt1"> 14 </div> <div class="line number15 index14 alt2"> 15 </div> <div class="line number16 index15 alt1"> 16 </div> <div class="line number17 index16 alt2"> 17 </div></td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######停止Apache1服务器上的Httpd服务来模拟故障;并查看IP</span></code> </div> <div class="line number2 index1 alt1"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># service httpd stop</span></code></span> </div> <div class="line number3 index2 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache1 ~]</code><code class="bash comments"><span style="color:#000000;"># ip addr show eth0</span></code></span> </div> <div class="line number4 index3 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000</span></code> </div> <div class="line number5 index4 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">link</code><code class="bash plain">/ether</code></span> <code class="bash plain"><span style="font-family:nsimsun;">00:0c:29:2c:1a:24 brd ff:ff:ff:ff:ff:ff</span></code> </div> <div class="line number6 index5 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet 172.16.14.1</code><code class="bash plain">/16</code></span> <code class="bash plain"><span style="font-family:nsimsun;">brd 172.16.255.255 scope global eth0</span></code> </div> <div class="line number7 index6 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet6 fe80::20c:29ff:fe2c:1a24</code><code class="bash plain">/64</code></span> <code class="bash plain"><span style="font-family:nsimsun;">scope link</span></code> </div> <div class="line number8 index7 alt1"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">valid_lft forever preferred_lft forever</span></code> </div> <div class="line number9 index8 alt2"> <code class="bash plain"><span style="font-family:nsimsun;">========================================================================</span></code> </div> <div class="line number10 index9 alt1"> <code class="bash comments"><span style="font-family:nsimsun;color:#000000;">######查看Apache2服务器上的IP</span></code> </div> <div class="line number11 index10 alt2"> <span style="font-family:nsimsun;"><code class="bash plain">[root@Apache2 ~]</code><code class="bash comments"><span style="color:#000000;"># ip addr show eth0</span></code></span> </div> <div class="line number12 index11 alt1"> <code class="bash plain"><span style="font-family:nsimsun;">2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000</span></code> </div> <div class="line number13 index12 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">link</code><code class="bash plain">/ether</code></span> <code class="bash plain"><span style="font-family:nsimsun;">00:0c:29:ec:f6:3f brd ff:ff:ff:ff:ff:ff</span></code> </div> <div class="line number14 index13 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet 172.16.14.2</code><code class="bash plain">/16</code></span> <code class="bash plain"><span style="font-family:nsimsun;">brd 172.16.255.255 scope global eth0</span></code> </div> <div class="line number15 index14 alt2"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet 172.16.14.10</code><code class="bash plain">/32</code></span> <code class="bash plain"><span style="font-family:nsimsun;">scope global eth0</span></code> </div> <div class="line number16 index15 alt1"> <code class="bash spaces"></code> <span style="font-family:nsimsun;"><code class="bash plain">inet6 fe80::20c:29ff:feec:f63f</code><code class="bash plain">/64</code></span> <code class="bash plain"><span style="font-family:nsimsun;">scope link</span></code> </div> <div class="line number17 index16 alt2"> <code class="bash spaces"></code> <code class="bash plain"><span style="font-family:nsimsun;">valid_lft forever preferred_lft forever</span></code> </div> </div></td> </tr> </tbody> </table> </div> </div> <p><span style="font-family:'宋体', simsun;">7、从上一步可以看出,虚拟IP地址已成功转移,说明还能正常提供服务,可以再次访问测试;如果服务器修复好重新上线,虚拟IP还会转移回去;这里就不再测试</span></p> <p><br></p> <p><strong><span style="color:#ff0000;font-size:20px;">到此,基于Apache做反向代理实现了Tomcat的负载均衡;而Keepalived实现了前端服务器的高可用;关于session保存的问题,方案有很多,比如可以保存到"memcached"、"redis"等,使用哪种方案具体还要根据自己的需求而定...</span></strong></p> <p>本文出自 “ALLEN” 博客,谢绝转载!</p> <p> </p> </div> </div> </div> </div> </div> <!--PC和WAP自适应版--> <div id="SOHUCS" sid="1206879677730361344"></div> <script type="text/javascript" src="/views/front/js/chanyan.js"></script> <!-- 文章页-底部 动态广告位 --> <div class="youdao-fixed-ad" id="detail_ad_bottom"></div> </div> <div class="col-md-3"> <div class="row" id="ad"> <!-- 文章页-右侧1 动态广告位 --> <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_1"> </div> </div> <!-- 文章页-右侧2 动态广告位 --> <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_2"></div> </div> <!-- 文章页-右侧3 动态广告位 --> <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_3"></div> </div> </div> </div> </div> </div> </div> <div class="container"> <h4 class="pt20 mb15 mt0 border-top">你可能感兴趣的:(负载均衡,Apache,Tomcat,RHEL/CentOs)</h4> <div id="paradigm-article-related"> <div class="recommend-post mb30"> <ul class="widget-links"> <li><a href="/article/1835508130268672000.htm" title="消息中间件有哪些常见类型" target="_blank">消息中间件有哪些常见类型</a> <span class="text-muted">xmh-sxh-1314</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a> <div>消息中间件根据其设计理念和用途,可以大致分为以下几种常见类型:点对点消息队列(Point-to-PointMessagingQueues):在这种模型中,消息被发送到特定的队列中,消费者从队列中取出并处理消息。队列中的消息只能被一个消费者消费,消费后即被删除。常见的实现包括IBM的MQSeries、RabbitMQ的部分使用场景等。适用于任务分发、负载均衡等场景。发布/订阅消息模型(Pub/Sub</div> </li> <li><a href="/article/1835490712716668928.htm" title="第六集如何安装CentOS7.0,3分钟学会centos7安装教程" target="_blank">第六集如何安装CentOS7.0,3分钟学会centos7安装教程</a> <span class="text-muted">date分享</span> <div>从光盘引导系统按回车键继续进入引导程序安装界面,选择语言这里选择简体中文版点击继续选择桌面安装下面给系统分区选择磁盘,点击完成选择基本分区,点击加号swap分区,大小填内存的两倍在选择根分区,使用所有可用的磁盘空间选择文件系统ext4点击完成,点击开始安装设置root密码,点击完成设置普通用户和密码,点击完成整个过程持续八分钟左右根据个人配置不同,时间长短不同好,现在点击重启系统进入重启状态点击本</div> </li> <li><a href="/article/1835471058648526848.htm" title="1分钟解决 -bash: mvn: command not found,在Centos 7中安装Maven" target="_blank">1分钟解决 -bash: mvn: command not found,在Centos 7中安装Maven</a> <span class="text-muted">Energet!c</span> <a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>1分钟解决-bash:mvn:commandnotfound,在Centos7中安装Maven检查Java环境1下载Maven2解压Maven3配置环境变量4验证安装5常见问题与注意事项6总结检查Java环境Maven依赖Java环境,请确保系统已经安装了Java并配置了环境变量。可以通过以下命令检查:java-version如果未安装,请先安装Java。1下载Maven从官网下载:前往Apach</div> </li> <li><a href="/article/1835470932295118848.htm" title="CentOS的根目录下,/bin 和 /sbin 用途和权限" target="_blank">CentOS的根目录下,/bin 和 /sbin 用途和权限</a> <span class="text-muted">Energet!c</span> <a class="tag" taget="_blank" href="/search/Linux%E6%97%A5%E5%B8%B8/1.htm">Linux日常</a><a class="tag" taget="_blank" href="/search/centos/1.htm">centos</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a> <div>CentOS的根目录下,/bin和/sbin用途和权限一、/bin(Binary)二、/sbin(SystemBinary)三、总结在CentOS的根目录下,/bin和/sbin目录有不同的用途和权限一、/bin(Binary)用途:存放系统的基本命令,这些命令对所有用户都是可用的。例如:ls、cp、mv、rm等。权限:普通用户和系统管理员都可以使用这些命令。二、/sbin(SystemBinar</div> </li> <li><a href="/article/1835465261080211456.htm" title="CentOS 7官方源停服,配置本机光盘yum源" target="_blank">CentOS 7官方源停服,配置本机光盘yum源</a> <span class="text-muted">码哝小鱼</span> <a class="tag" taget="_blank" href="/search/linux%E8%BF%90%E7%BB%B4/1.htm">linux运维</a><a class="tag" taget="_blank" href="/search/centos/1.htm">centos</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a> <div>1、挂载系统光盘mkdir/mnt/isomount-oloop/tools/CentOS-7-x86_64-DVD-1810.iso/mnt/isocd/mnt/iso/Packages/rpm-ivh/mnt/iso/Packages/yum-utils-1.1.31-50.el7.noarch.rpm(图形界面安装,默契已安装)如安装yum-utils依赖错误,按提示安装依赖包rpm-ivh</div> </li> <li><a href="/article/1835461728423473152.htm" title="第1步win10宿主机与虚拟机通过NAT共享上网互通" target="_blank">第1步win10宿主机与虚拟机通过NAT共享上网互通</a> <span class="text-muted">学习3人组</span> <a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a> <div>VM的CentOS采用NAT共用宿主机网卡宿主机器无法连接到虚拟CentOS要实现宿主机与虚拟机通信,原理就是给宿主机的网卡配置一个与虚拟机网关相同网段的IP地址,实现可以互通。1、查看虚拟机的IP地址2、编辑虚拟机的虚拟网络的NAT和DHCP的配置,设置虚拟机的网卡选择NAT共享模式3、宿主机的IP配置,确保vnet8的IPV4属性与虚拟机在同一网段4、ping测试连通性[root@localh</div> </li> <li><a href="/article/1835454543471669248.htm" title="Java:爬虫框架" target="_blank">Java:爬虫框架</a> <span class="text-muted">dingcho</span> <a class="tag" taget="_blank" href="/search/Java/1.htm">Java</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E7%88%AC%E8%99%AB/1.htm">爬虫</a> <div>一、ApacheNutch2【参考地址】Nutch是一个开源Java实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。包括全文搜索和Web爬虫。Nutch致力于让每个人能很容易,同时花费很少就可以配置世界一流的Web搜索引擎.为了完成这一宏伟的目标,Nutch必须能够做到:每个月取几十亿网页为这些网页维护一个索引对索引文件进行每秒上千次的搜索提供高质量的搜索结果简单来说Nutch支持分</div> </li> <li><a href="/article/1835432358141063168.htm" title="深入浅出 -- 系统架构之负载均衡Nginx的性能优化" target="_blank">深入浅出 -- 系统架构之负载均衡Nginx的性能优化</a> <span class="text-muted">xiaoli8748_软件开发</span> <a class="tag" taget="_blank" href="/search/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84/1.htm">系统架构</a><a class="tag" taget="_blank" href="/search/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84/1.htm">系统架构</a><a class="tag" taget="_blank" href="/search/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/1.htm">负载均衡</a><a class="tag" taget="_blank" href="/search/nginx/1.htm">nginx</a> <div>一、Nginx性能优化到这里文章的篇幅较长了,最后再来聊一下关于Nginx的性能优化,主要就简单说说收益最高的几个优化项,在这块就不再展开叙述了,毕竟影响性能都有多方面原因导致的,比如网络、服务器硬件、操作系统、后端服务、程序自身、数据库服务等,对于性能调优比较感兴趣的可以参考之前《JVM性能调优》中的调优思想。优化一:打开长连接配置通常Nginx作为代理服务,负责分发客户端的请求,那么建议开启H</div> </li> <li><a href="/article/1835428317084348416.htm" title="最简单将静态网页挂载到服务器上(不用nginx)" target="_blank">最简单将静态网页挂载到服务器上(不用nginx)</a> <span class="text-muted">全能全知者</span> <a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a><a class="tag" taget="_blank" href="/search/nginx/1.htm">nginx</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a><a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/%E7%AC%94%E8%AE%B0/1.htm">笔记</a> <div>最简单将静态网页挂载到服务器上(不用nginx)如果随便弄个静态网页挂在服务器都要用nignx就太麻烦了,所以直接使用Apache来搭建一些简单前端静态网页会相对方便很多检查Web服务器服务状态:sudosystemctlstatushttpd#ApacheWeb服务器如果发现没有安装web服务器:安装Apache:sudoyuminstallhttpd启动Apache:sudosystemctl</div> </li> <li><a href="/article/1835415206004617216.htm" title="浅谈MapReduce" target="_blank">浅谈MapReduce</a> <span class="text-muted">Android路上的人</span> <a class="tag" taget="_blank" href="/search/Hadoop/1.htm">Hadoop</a><a class="tag" taget="_blank" href="/search/%E5%88%86%E5%B8%83%E5%BC%8F%E8%AE%A1%E7%AE%97/1.htm">分布式计算</a><a class="tag" taget="_blank" href="/search/mapreduce/1.htm">mapreduce</a><a class="tag" taget="_blank" href="/search/%E5%88%86%E5%B8%83%E5%BC%8F/1.htm">分布式</a><a class="tag" taget="_blank" href="/search/%E6%A1%86%E6%9E%B6/1.htm">框架</a><a class="tag" taget="_blank" href="/search/hadoop/1.htm">hadoop</a> <div>从今天开始,本人将会开始对另一项技术的学习,就是当下炙手可热的Hadoop分布式就算技术。目前国内外的诸多公司因为业务发展的需要,都纷纷用了此平台。国内的比如BAT啦,国外的在这方面走的更加的前面,就不一一列举了。但是Hadoop作为Apache的一个开源项目,在下面有非常多的子项目,比如HDFS,HBase,Hive,Pig,等等,要先彻底学习整个Hadoop,仅仅凭借一个的力量,是远远不够的。</div> </li> <li><a href="/article/1835410666316460032.htm" title="【2023年】云计算金砖牛刀小试6" target="_blank">【2023年】云计算金砖牛刀小试6</a> <span class="text-muted">geekgold</span> <a class="tag" taget="_blank" href="/search/%E4%BA%91%E8%AE%A1%E7%AE%97/1.htm">云计算</a><a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a><a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C/1.htm">网络</a><a class="tag" taget="_blank" href="/search/kubernetes/1.htm">kubernetes</a><a class="tag" taget="_blank" href="/search/%E5%AE%B9%E5%99%A8/1.htm">容器</a> <div>第一套【任务1】私有云服务搭建[10分]【题目1】基础环境配置[0.5分]使用提供的用户名密码,登录提供的OpenStack私有云平台,在当前租户下,使用CentOS7.9镜像,创建两台云主机,云主机类型使用4vCPU/12G/100G_50G类型。当前租户下默认存在一张网卡,自行创建第二张网卡并连接至controller和compute节点(第二张网卡的网段为10.10.X.0/24,X为工位号</div> </li> <li><a href="/article/1835357725761040384.htm" title="Hadoop" target="_blank">Hadoop</a> <span class="text-muted">傲雪凌霜,松柏长青</span> <a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/hadoop/1.htm">hadoop</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/%E5%88%86%E5%B8%83%E5%BC%8F/1.htm">分布式</a> <div>ApacheHadoop是一个开源的分布式计算框架,主要用于处理海量数据集。它具有高度的可扩展性、容错性和高效的分布式存储与计算能力。Hadoop核心由四个主要模块组成,分别是HDFS(分布式文件系统)、MapReduce(分布式计算框架)、YARN(资源管理)和HadoopCommon(公共工具和库)。1.HDFS(HadoopDistributedFileSystem)HDFS是Hadoop生</div> </li> <li><a href="/article/1835350539211206656.htm" title="CentOS7 安装MySQL5.7.44" target="_blank">CentOS7 安装MySQL5.7.44</a> <span class="text-muted">不要Null了</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/centos/1.htm">centos</a><a class="tag" taget="_blank" href="/search/mysql/1.htm">mysql</a> <div>1.下载mysql安装包,我放在百度网盘里(下方链接)链接:https://pan.baidu.com/s/1_Mn1XW_1mWdTV4mhnLG66A提取码:s31n2.首先看看以前是否安装过mysqlrpm-qa|grep-imysql如果已经安装过mysql会提示卸载mysqlrpm-emysql-…3.使用FinallShell或者Xftp进行上传放到/usr/local/mysql,没</div> </li> <li><a href="/article/1835333491814920192.htm" title="maven-assembly-plugin 打包实例" target="_blank">maven-assembly-plugin 打包实例</a> <span class="text-muted">带着二娃去遛弯</span> <div>1.先在pom.xml文件中添加assembly打包插件org.apache.maven.pluginsmaven-assembly-plugin2.6assembly/assembly.xmlmake-assemblypackagesingle说明:1.需要修改的可能就是descriptors标签下面的打包配置文件目录,指定assembly.xml的路径.2.可以添加多个打包配置文件,进行多种形</div> </li> <li><a href="/article/1835321295861018624.htm" title="Gobelieve 架构" target="_blank">Gobelieve 架构</a> <span class="text-muted">weixin_34099526</span> <a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">数据库</a><a class="tag" taget="_blank" href="/search/golang/1.htm">golang</a><a class="tag" taget="_blank" href="/search/json/1.htm">json</a> <div>Gobelievegithub地址声明:转简书JackieF的文章,为了自己方便copy了一份,加一些自己的东西.链接:https://www.jianshu.com/p/8121d6e85282IMCore主要分三大块:im客户连接服务器(可分布式部署,暂无负载均衡模块)imr路由查询服务器(主要解决im分布式部署的问题)ims存储服务器(主从部署)基础模块1.数据包协议包:header(12)</div> </li> <li><a href="/article/1835294885297614848.htm" title="Kafka详细解析与应用分析" target="_blank">Kafka详细解析与应用分析</a> <span class="text-muted">芊言芊语</span> <a class="tag" taget="_blank" href="/search/kafka/1.htm">kafka</a><a class="tag" taget="_blank" href="/search/%E5%88%86%E5%B8%83%E5%BC%8F/1.htm">分布式</a> <div>Kafka是一个开源的分布式事件流平台(EventStreamingPlatform),由LinkedIn公司最初采用Scala语言开发,并基于ZooKeeper协调管理。如今,Kafka已经被Apache基金会纳入其项目体系,广泛应用于大数据实时处理领域。Kafka凭借其高吞吐量、持久化、分布式和可靠性的特点,成为构建实时流数据管道和流处理应用程序的重要工具。Kafka架构Kafka的架构主要由</div> </li> <li><a href="/article/1835263643080552448.htm" title="Tomcat 中 catalina.out、catalina.log、localhost.log 和 access_log 的区别" target="_blank">Tomcat 中 catalina.out、catalina.log、localhost.log 和 access_log 的区别</a> <span class="text-muted">金色888</span> <div>打开Tomcat安装目录中的log文件夹,我们可以看到很多日志文件,这篇文章就来介绍下这些日记文件的具体区别。catalina.out日志#catalina.out日志文件是Tomcat的标准输出(stdout)和标准出错(stderr)输出的“目的地”。我们在应用里使用System.out打印的内容都会输出到这个日志文件中。另外,如果我们在应用里使用其他的日志框架,配置了向Console输出日志</div> </li> <li><a href="/article/1835233629056364544.htm" title="java 技术 架构 相关文档" target="_blank">java 技术 架构 相关文档</a> <span class="text-muted">圣心</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>在Java中,有许多不同的技术和架构,这里我将列举一些常见的Java技术和架构,并提供一些相关的文档资源。SpringFrameworkSpring是一个开源的Java/JavaEE全功能框架,以Apache许可证形式发布,提供了一种实现企业级应用的方法。官方文档:SpringFrameworkSpringBootSpringBoot是Spring的一个子项目,旨在简化创建生产级的Spring应用</div> </li> <li><a href="/article/1835195687143305216.htm" title="10- 【JavaWeb】Tomcat、Servlet基础" target="_blank">10- 【JavaWeb】Tomcat、Servlet基础</a> <span class="text-muted">weixin_44329069</span> <a class="tag" taget="_blank" href="/search/JavaWeb/1.htm">JavaWeb</a><a class="tag" taget="_blank" href="/search/tomcat/1.htm">tomcat</a><a class="tag" taget="_blank" href="/search/servlet/1.htm">servlet</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a> <div>1.MacOS配置Tomcat服务器教程MacOS配置Tomcat服务器教程2.Servlet基础1.创建ServletServlet是一个扩展服务器功能的Java类,主要用于处理HTTP请求。以下是一个简单的Servlet示例:importjava.io.IOException;importjavax.servlet.ServletException;importjavax.servlet.an</div> </li> <li><a href="/article/1835188748925628416.htm" title="Spring Boot 请求处理流程:从负载均衡到多实例并发 - 电子商务网站实例" target="_blank">Spring Boot 请求处理流程:从负载均衡到多实例并发 - 电子商务网站实例</a> <span class="text-muted">烟雨国度</span> <a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/boot/1.htm">boot</a><a class="tag" taget="_blank" href="/search/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/1.htm">负载均衡</a><a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a> <div>SpringBoot请求处理流程:从负载均衡到多实例并发-电子商务网站实例SpringBoot请求处理流程:从负载均衡到多实例并发SpringBoot作为一个强大的Java应用开发框架,能够有效地处理高并发请求。本文将基于三个关键流程图,详细分析SpringBoot应用如何从负载均衡到请求处理,再到多实例并发处理的整个过程。1.负载均衡和多实例处理首先,让我们看一下描述负载均衡和多实例处理的流程图</div> </li> <li><a href="/article/1835183410532937728.htm" title="Apache Shiro安全框架(2)-用户认证" target="_blank">Apache Shiro安全框架(2)-用户认证</a> <span class="text-muted">heyrian</span> <a class="tag" taget="_blank" href="/search/Java/1.htm">Java</a><a class="tag" taget="_blank" href="/search/shiro/1.htm">shiro</a> <div>身份认证在shiro中用户需要提供用户的principals(身份)和credentials(证明)来证明该用户属于当前系统用户。常见的认证方式即用户名/密码。在解释身份认证之前,我们先来看看shiro中的Subject和Realm,这是身份认证的两个关键的概念。Subjectsubject代表当前用户,内部主要维护当前用户信息。shiro中所有的subject都交给SecurityManager</div> </li> <li><a href="/article/1835182528839905280.htm" title="Open Feign 实战笔记" target="_blank">Open Feign 实战笔记</a> <span class="text-muted">自强-X</span> <a class="tag" taget="_blank" href="/search/spring-cloud/1.htm">spring-cloud</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/%E5%BE%AE%E6%9C%8D%E5%8A%A1/1.htm">微服务</a><a class="tag" taget="_blank" href="/search/ribbon/1.htm">ribbon</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/cloud/1.htm">cloud</a> <div>OpenFeign笔记概念声明式的web服务客户端。使用接口加注解的形式编程。它是对RestTemplate和ribbon做了进一步封装。Feign已经停更,OpenFeign是在Feign的基础上又做了进一步的封装。Feign:Feign是SpringCloud组件中的一个轻量级RESTful的HTTP服务客户端Feign内置了Ribbon,用来做客户端负载均衡,去调用服务注册中心的服务。Fei</div> </li> <li><a href="/article/1835179122112950272.htm" title="Apache HBase基础(基本概述,物理架构,逻辑架构,数据管理,架构特点,HBase Shell)" target="_blank">Apache HBase基础(基本概述,物理架构,逻辑架构,数据管理,架构特点,HBase Shell)</a> <span class="text-muted">May--J--Oldhu</span> <a class="tag" taget="_blank" href="/search/HBase/1.htm">HBase</a><a class="tag" taget="_blank" href="/search/HBase/1.htm">HBase</a><a class="tag" taget="_blank" href="/search/shell/1.htm">shell</a><a class="tag" taget="_blank" href="/search/hbase%E7%89%A9%E7%90%86%E6%9E%B6%E6%9E%84/1.htm">hbase物理架构</a><a class="tag" taget="_blank" href="/search/hbase%E9%80%BB%E8%BE%91%E6%9E%B6%E6%9E%84/1.htm">hbase逻辑架构</a><a class="tag" taget="_blank" href="/search/hbase/1.htm">hbase</a> <div>NoSQL综述及ApacheHBase基础一.HBase1.HBase概述2.HBase发展历史3.HBase应用场景3.1增量数据-时间序列数据3.2信息交换-消息传递3.3内容服务-Web后端应用程序3.4HBase应用场景示例4.ApacheHBase生态圈5.HBase物理架构5.1HMaster5.2RegionServer5.3Region和Table6.HBase逻辑架构-Row7.</div> </li> <li><a href="/article/1835176601768259584.htm" title="Flume:大规模日志收集与数据传输的利器" target="_blank">Flume:大规模日志收集与数据传输的利器</a> <span class="text-muted">傲雪凌霜,松柏长青</span> <a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/flume/1.htm">flume</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a> <div>Flume:大规模日志收集与数据传输的利器在大数据时代,随着各类应用的不断增长,产生了海量的日志和数据。这些数据不仅对业务的健康监控至关重要,还可以通过深入分析,帮助企业做出更好的决策。那么,如何高效地收集、传输和存储这些海量数据,成为了一项重要的挑战。今天我们将深入探讨ApacheFlume,它是如何帮助我们应对这些挑战的。一、Flume概述ApacheFlume是一个分布式、可靠、可扩展的日志</div> </li> <li><a href="/article/1835126299543302144.htm" title="商业预测 初识R" target="_blank">商业预测 初识R</a> <span class="text-muted">hongyanwin</span> <a class="tag" taget="_blank" href="/search/r%E8%AF%AD%E8%A8%80/1.htm">r语言</a><a class="tag" taget="_blank" href="/search/%E9%A2%84%E6%B5%8B/1.htm">预测</a> <div>1.打开帮助文档首页,查阅其中的“IntroductiontoR”helpRhelp2.安装vcd包install.packages("vcd")3.列出此包中可用的函数和数据集ls("package:vcd")/data(package="vcd")4.载入包并阅读数据集Arthritis的描述library("v.d")/?Arthritis5.显示数据集Arthritis的内容查看数据集结构</div> </li> <li><a href="/article/1835119899802955776.htm" title="ceph KVM使用rbd做存储" target="_blank">ceph KVM使用rbd做存储</a> <span class="text-muted">SkTj</span> <div>博客:https://blog.csdn.net/bobpen/article/details/40112939博客:http://www.aboutyun.com/thread-13195-1-1.html导言很多cepher都会使用RBD块存储功能,下面介绍qemu-kvm访问RBD的方法。操作目前Ubuntu14.04.x和CentOS7.1(如使用CentOS7建议升级到7.1,CentO</div> </li> <li><a href="/article/1835113065595629568.htm" title="Superset二次开发之源码DependencyList.tsx 分析" target="_blank">Superset二次开发之源码DependencyList.tsx 分析</a> <span class="text-muted">aimmon</span> <a class="tag" taget="_blank" href="/search/Superset%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91/1.htm">Superset二次开发</a><a class="tag" taget="_blank" href="/search/Superset/1.htm">Superset</a><a class="tag" taget="_blank" href="/search/BI/1.htm">BI</a><a class="tag" taget="_blank" href="/search/%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91/1.htm">二次开发</a><a class="tag" taget="_blank" href="/search/typescript/1.htm">typescript</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a> <div>功能点路径superset-frontend\src\dashboard\components\nativeFilters\FiltersConfigModal\FiltersConfigForm\DependencyList.tsx/***LicensedtotheApacheSoftwareFoundation(ASF)underone*ormorecontributorlicenseagre</div> </li> <li><a href="/article/1835110293278126080.htm" title="史上最全的maven的pom.xml文件详解" target="_blank">史上最全的maven的pom.xml文件详解</a> <span class="text-muted">Meta999</span> <a class="tag" taget="_blank" href="/search/Maven/1.htm">Maven</a> <div>注:详解文件中,用红色进行标注的是平常项目中常用的配置节点。要详细学习!转载的,太经典了、、、、欢迎收藏xxxxxxxxxxxx4.0.0xxxxxxjar1.0-SNAPSHOTxxx-mavenhttp://maven.apache.orgAmavenprojecttostudymaven.jirahttp://jira.baidu.com/banseonDemobanseon@126.com</div> </li> <li><a href="/article/1835097183804813312.htm" title="oracle数据库安装和配置详细讲解" target="_blank">oracle数据库安装和配置详细讲解</a> <span class="text-muted">程序员小羊!</span> <a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">数据库</a><a class="tag" taget="_blank" href="/search/oracle/1.htm">oracle</a> <div>大家好,我是程序员小羊!前言:Oracle数据库是全球广泛使用的关系型数据库管理系统(RDBMS),提供高性能、可靠性、安全性和可扩展性,广泛应用于企业关键任务系统。下面详细介绍如何在CentOS系统上安装和配置Oracle数据库。1.前提条件1.1硬件要求内存:最小1GB,推荐2GB以上。硬盘:至少10GB的可用空间,视具体应用需求而定。1.2软件要求操作系统:CentOS7或CentOS8(确</div> </li> <li><a href="/article/1835086344972496896.htm" title="专访AMD:AMD 正式加入龙蜥社区首秀:开源协作与 AI 创新的交汇点" target="_blank">专访AMD:AMD 正式加入龙蜥社区首秀:开源协作与 AI 创新的交汇点</a> <span class="text-muted">OpenAnolis小助手</span> <a class="tag" taget="_blank" href="/search/%E5%BC%80%E6%BA%90/1.htm">开源</a><a class="tag" taget="_blank" href="/search/%E9%BE%99%E8%9C%A5%E7%A4%BE%E5%8C%BA/1.htm">龙蜥社区</a><a class="tag" taget="_blank" href="/search/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/1.htm">操作系统</a><a class="tag" taget="_blank" href="/search/%E9%BE%99%E8%9C%A5%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%A4%A7%E4%BC%9A/1.htm">龙蜥操作系统大会</a><a class="tag" taget="_blank" href="/search/AI/1.htm">AI</a> <div>编者按:近日,2024龙蜥操作系统大会已于北京圆满举办。会上,龙蜥社区发布了“AnolisOS23生态衍生计划”、“CentOS替代计划”及“AI应用推广计划”三大计划,从产品、生态及应用维度为AI需求爆发主动布局,打造面向“云+AI”的下一代服务器操作系统。大会另一个重要的信息是今年龙蜥社区又迎来了一个重量级选手——AMD公司,展示其在开源、AI等领域的最新进展和合作成果。AMD公司大型数据中心</div> </li> <li><a href="/article/10.htm" title="jsonp 常用util方法" target="_blank">jsonp 常用util方法</a> <span class="text-muted">hw1287789687</span> <a class="tag" taget="_blank" href="/search/jsonp/1.htm">jsonp</a><a class="tag" taget="_blank" href="/search/jsonp%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/1.htm">jsonp常用方法</a><a class="tag" taget="_blank" href="/search/jsonp+callback/1.htm">jsonp callback</a> <div>jsonp 常用java方法 (1)以jsonp的形式返回:函数名(json字符串) /*** * 用于jsonp调用 * @param map : 用于构造json数据 * @param callback : 回调的javascript方法名 * @param filters : <code>SimpleBeanPropertyFilter theFilt</div> </li> <li><a href="/article/137.htm" title="多线程场景" target="_blank">多线程场景</a> <span class="text-muted">alafqq</span> <a class="tag" taget="_blank" href="/search/%E5%A4%9A%E7%BA%BF%E7%A8%8B/1.htm">多线程</a> <div>0 能不能简单描述一下你在java web开发中需要用到多线程编程的场景?0 对多线程有些了解,但是不太清楚具体的应用场景,能简单说一下你遇到的多线程编程的场景吗? Java多线程 2012年11月23日 15:41 Young9007 Young9007 4 0 0 4 Comment添加评论关注(2) 3个答案 按时间排序 按投票排序 0 0 最典型的如: 1、</div> </li> <li><a href="/article/264.htm" title="Maven学习——修改Maven的本地仓库路径" target="_blank">Maven学习——修改Maven的本地仓库路径</a> <span class="text-muted">Kai_Ge</span> <a class="tag" taget="_blank" href="/search/maven/1.htm">maven</a> <div>      安装Maven后我们会在用户目录下发现.m2 文件夹。默认情况下,该文件夹下放置了Maven本地仓库.m2/repository。所有的Maven构件(artifact)都被存储到该仓库中,以方便重用。但是windows用户的操作系统都安装在C盘,把Maven仓库放到C盘是很危险的,为此我们需要修改Maven的本地仓库路径。    </div> </li> <li><a href="/article/391.htm" title="placeholder的浏览器兼容" target="_blank">placeholder的浏览器兼容</a> <span class="text-muted">120153216</span> <a class="tag" taget="_blank" href="/search/placeholder/1.htm">placeholder</a> <div>【前言】 自从html5引入placeholder后,问题就来了, 不支持html5的浏览器也先有这样的效果, 各种兼容,之前考虑,今天测试人员逮住不放, 想了个解决办法,看样子还行,记录一下。   【原理】 不使用placeholder,而是模拟placeholder的效果, 大概就是用focus和focusout效果。   【代码】 <scrip</div> </li> <li><a href="/article/518.htm" title="debian_用iso文件创建本地apt源" target="_blank">debian_用iso文件创建本地apt源</a> <span class="text-muted">2002wmj</span> <a class="tag" taget="_blank" href="/search/Debian/1.htm">Debian</a> <div>1.将N个debian-506-amd64-DVD-N.iso存放于本地或其他媒介内,本例是放在本机/iso/目录下 2.创建N个挂载点目录 如下: debian:~#mkdir –r /media/dvd1 debian:~#mkdir –r /media/dvd2 debian:~#mkdir –r /media/dvd3 …. debian:~#mkdir –r /media</div> </li> <li><a href="/article/645.htm" title="SQLSERVER耗时最长的SQL" target="_blank">SQLSERVER耗时最长的SQL</a> <span class="text-muted">357029540</span> <a class="tag" taget="_blank" href="/search/SQL+Server/1.htm">SQL Server</a> <div>对于DBA来说,经常要知道存储过程的某些信息: 1.   执行了多少次 2.   执行的执行计划如何 3.   执行的平均读写如何 4.   执行平均需要多少时间 列名          &</div> </li> <li><a href="/article/772.htm" title="com/genuitec/eclipse/j2eedt/core/J2EEProjectUtil" target="_blank">com/genuitec/eclipse/j2eedt/core/J2EEProjectUtil</a> <span class="text-muted">7454103</span> <a class="tag" taget="_blank" href="/search/eclipse/1.htm">eclipse</a> <div>今天eclipse突然报了com/genuitec/eclipse/j2eedt/core/J2EEProjectUtil 错误,并且工程文件打不开了,在网上找了一下资料,然后按照方法操作了一遍,好了,解决方法如下: 错误提示信息: An error has occurred.See error log for more details. Reason: com/genuitec/</div> </li> <li><a href="/article/899.htm" title="用正则删除文本中的html标签" target="_blank">用正则删除文本中的html标签</a> <span class="text-muted">adminjun</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/1.htm">正则表达式</a><a class="tag" taget="_blank" href="/search/%E5%8E%BB%E6%8E%89html%E6%A0%87%E7%AD%BE/1.htm">去掉html标签</a> <div>使用文本编辑器录入文章存入数据中的文本是HTML标签格式,由于业务需要对HTML标签进行去除只保留纯净的文本内容,于是乎Java实现自动过滤。 如下: public static String Html2Text(String inputString) { String htmlStr = inputString; // 含html标签的字符串 String textSt</div> </li> <li><a href="/article/1026.htm" title="嵌入式系统设计中常用总线和接口" target="_blank">嵌入式系统设计中常用总线和接口</a> <span class="text-muted">aijuans</span> <a class="tag" taget="_blank" href="/search/linux+%E5%9F%BA%E7%A1%80/1.htm">linux 基础</a> <div>               嵌入式系统设计中常用总线和接口         任何一个微处理器都要与一定数量的部件和外围设备连接,但如果将各部件和每一种外围设备都分别用一组线路与CPU直接连接,那么连线</div> </li> <li><a href="/article/1153.htm" title="Java函数调用方式——按值传递" target="_blank">Java函数调用方式——按值传递</a> <span class="text-muted">ayaoxinchao</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E6%8C%89%E5%80%BC%E4%BC%A0%E9%80%92/1.htm">按值传递</a><a class="tag" taget="_blank" href="/search/%E5%AF%B9%E8%B1%A1/1.htm">对象</a><a class="tag" taget="_blank" href="/search/%E5%9F%BA%E7%A1%80%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B/1.htm">基础数据类型</a> <div>Java使用按值传递的函数调用方式,这往往使我感到迷惑。因为在基础数据类型和对象的传递上,我就会纠结于到底是按值传递,还是按引用传递。其实经过学习,Java在任何地方,都一直发挥着按值传递的本色。   首先,让我们看一看基础数据类型是如何按值传递的。   public static void main(String[] args) { int a = 2; </div> </li> <li><a href="/article/1280.htm" title="ios音量线性下降" target="_blank">ios音量线性下降</a> <span class="text-muted">bewithme</span> <a class="tag" taget="_blank" href="/search/ios%E9%9F%B3%E9%87%8F/1.htm">ios音量</a> <div>直接上代码吧   //second 几秒内下降为0 - (void)reduceVolume:(int)second { KGVoicePlayer *player = [KGVoicePlayer defaultPlayer]; if (!_flag) { _tempVolume = player.volume; </div> </li> <li><a href="/article/1407.htm" title="与其怨它不如爱它" target="_blank">与其怨它不如爱它</a> <span class="text-muted">bijian1013</span> <a class="tag" taget="_blank" href="/search/%E9%80%89%E6%8B%A9/1.htm">选择</a><a class="tag" taget="_blank" href="/search/%E7%90%86%E6%83%B3/1.htm">理想</a><a class="tag" taget="_blank" href="/search/%E8%81%8C%E4%B8%9A/1.htm">职业</a><a class="tag" taget="_blank" href="/search/%E8%A7%84%E5%88%92/1.htm">规划</a> <div>        抱怨工作是年轻人的常态,但爱工作才是积极的心态,与其怨它不如爱它。         一般来说,在公司干了一两年后,不少年轻人容易产生怨言,除了具体的埋怨公司“扭门”,埋怨上司无能以外,也有许多人是因为根本不爱自已的那份工作,工作完全成了谋生的手段,跟自已的性格、专业、爱好都相差甚远。   </div> </li> <li><a href="/article/1534.htm" title="一边时间不够用一边浪费时间" target="_blank">一边时间不够用一边浪费时间</a> <span class="text-muted">bingyingao</span> <a class="tag" taget="_blank" href="/search/%E5%B7%A5%E4%BD%9C/1.htm">工作</a><a class="tag" taget="_blank" href="/search/%E6%97%B6%E9%97%B4/1.htm">时间</a><a class="tag" taget="_blank" href="/search/%E6%B5%AA%E8%B4%B9/1.htm">浪费</a> <div>一方面感觉时间严重不够用,另一方面又在不停的浪费时间。 每一个周末,晚上熬夜看电影到凌晨一点,早上起不来一直睡到10点钟,10点钟起床,吃饭后玩手机到下午一点。 精神还是很差,下午像一直野鬼在城市里晃荡。 为何不尝试晚上10点钟就睡,早上7点就起,时间完全是一样的,把看电影的时间换到早上,精神好,气色好,一天好状态。 控制让自己周末早睡早起,你就成功了一半。 有多少个工作</div> </li> <li><a href="/article/1661.htm" title="【Scala八】Scala核心二:隐式转换" target="_blank">【Scala八】Scala核心二:隐式转换</a> <span class="text-muted">bit1129</span> <a class="tag" taget="_blank" href="/search/scala/1.htm">scala</a> <div>Implicits work like this: if you call a method on a Scala object, and the Scala compiler does not see a definition for that method in the class definition for that object, the compiler will try to con</div> </li> <li><a href="/article/1788.htm" title="sudoku slover in Haskell (2)" target="_blank">sudoku slover in Haskell (2)</a> <span class="text-muted">bookjovi</span> <a class="tag" taget="_blank" href="/search/haskell/1.htm">haskell</a><a class="tag" taget="_blank" href="/search/sudoku/1.htm">sudoku</a> <div>继续精简haskell版的sudoku程序,稍微改了一下,这次用了8行,同时性能也提高了很多,对每个空格的所有解不是通过尝试算出来的,而是直接得出。   board = [0,3,4,1,7,0,5,0,0, 0,6,0,0,0,8,3,0,1, 7,0,0,3,0,0,0,0,6, 5,0,0,6,4,0,8,0,7, </div> </li> <li><a href="/article/1915.htm" title="Java-Collections Framework学习与总结-HashSet和LinkedHashSet" target="_blank">Java-Collections Framework学习与总结-HashSet和LinkedHashSet</a> <span class="text-muted">BrokenDreams</span> <a class="tag" taget="_blank" href="/search/linkedhashset/1.htm">linkedhashset</a> <div>        本篇总结一下两个常用的集合类HashSet和LinkedHashSet。         它们都实现了相同接口java.util.Set。Set表示一种元素无序且不可重复的集合;之前总结过的java.util.List表示一种元素可重复且有序</div> </li> <li><a href="/article/2042.htm" title="读《研磨设计模式》-代码笔记-备忘录模式-Memento" target="_blank">读《研磨设计模式》-代码笔记-备忘录模式-Memento</a> <span class="text-muted">bylijinnan</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/1.htm">设计模式</a> <div>声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/ import java.util.ArrayList; import java.util.List; /* * 备忘录模式的功能是,在不破坏封装性的前提下,捕获一个对象的内部状态,并在对象之外保存这个状态,为以后的状态恢复作“备忘” </div> </li> <li><a href="/article/2169.htm" title="《RAW格式照片处理专业技法》笔记" target="_blank">《RAW格式照片处理专业技法》笔记</a> <span class="text-muted">cherishLC</span> <a class="tag" taget="_blank" href="/search/PS/1.htm">PS</a> <div>注意,这不是教程!仅记录楼主之前不太了解的 一、色彩(空间)管理 作者建议采用ProRGB(色域最广),但camera raw中设为ProRGB,而PS中则在ProRGB的基础上,将gamma值设为了1.8(更符合人眼) 注意:bridge、camera raw怎么设置显示、输出的颜色都是正确的(会读取文件内的颜色配置文件),但用PS输出jpg文件时,必须先用Edit->conv</div> </li> <li><a href="/article/2296.htm" title="使用 Git 下载 Spring 源码 编译 for Eclipse" target="_blank">使用 Git 下载 Spring 源码 编译 for Eclipse</a> <span class="text-muted">crabdave</span> <a class="tag" taget="_blank" href="/search/eclipse/1.htm">eclipse</a> <div>使用 Git 下载 Spring 源码 编译 for Eclipse   1、安装gradle,下载 http://www.gradle.org/downloads 配置环境变量GRADLE_HOME,配置PATH  %GRADLE_HOME%/bin,cmd,gradle -v   2、spring4 用jdk8 下载 https://jdk8.java.</div> </li> <li><a href="/article/2423.htm" title="mysql连接拒绝问题" target="_blank">mysql连接拒绝问题</a> <span class="text-muted">daizj</span> <a class="tag" taget="_blank" href="/search/mysql/1.htm">mysql</a><a class="tag" taget="_blank" href="/search/%E7%99%BB%E5%BD%95%E6%9D%83%E9%99%90/1.htm">登录权限</a> <div>mysql中在其它机器连接mysql服务器时报错问题汇总 一、[running]root@192.168.9.136:~$mysql -uroot -h 192.168.9.108 -p   //带-p参数,在下一步进行密码输入 Enter password:    //无字符串输入 ERROR 1045 (28000): Access </div> </li> <li><a href="/article/2550.htm" title="Google Chrome 为何打压 H.264" target="_blank">Google Chrome 为何打压 H.264</a> <span class="text-muted">dsjt</span> <a class="tag" taget="_blank" href="/search/apple/1.htm">apple</a><a class="tag" taget="_blank" href="/search/html5/1.htm">html5</a><a class="tag" taget="_blank" href="/search/chrome/1.htm">chrome</a><a class="tag" taget="_blank" href="/search/Google/1.htm">Google</a> <div>Google 今天在 Chromium 官方博客宣布由于 H.264 编解码器并非开放标准,Chrome 将在几个月后正式停止对 H.264 视频解码的支持,全面采用开放的 WebM 和 Theora 格式。 Google 在博客上表示,自从 WebM 视频编解码器推出以后,在性能、厂商支持以及独立性方面已经取得了很大的进步,为了与 Chromium 现有支持的編解码器保持一致,Chrome</div> </li> <li><a href="/article/2677.htm" title="yii 获取控制器名 和方法名" target="_blank">yii 获取控制器名 和方法名</a> <span class="text-muted">dcj3sjt126com</span> <a class="tag" taget="_blank" href="/search/yii/1.htm">yii</a><a class="tag" taget="_blank" href="/search/framework/1.htm">framework</a> <div>1. 获取控制器名 在控制器中获取控制器名:  $name = $this->getId(); 在视图中获取控制器名:    $name = Yii::app()->controller->id;    2. 获取动作名  在控制器beforeAction()回调函数中获取动作名:  $name = </div> </li> <li><a href="/article/2804.htm" title="Android知识总结(二)" target="_blank">Android知识总结(二)</a> <span class="text-muted">come_for_dream</span> <a class="tag" taget="_blank" href="/search/android/1.htm">android</a> <div>明天要考试了,速速总结如下   1、Activity的启动模式        standard:每次调用Activity的时候都创建一个(可以有多个相同的实例,也允许多个相同Activity叠加。)        singleTop:可以有多个实例,但是不允许多个相同Activity叠加。即,如果Ac</div> </li> <li><a href="/article/2931.htm" title="高洛峰收徒第二期:寻找未来的“技术大牛” ——折腾一年,奖励20万元" target="_blank">高洛峰收徒第二期:寻找未来的“技术大牛” ——折腾一年,奖励20万元</a> <span class="text-muted">gcq511120594</span> <a class="tag" taget="_blank" href="/search/%E5%B7%A5%E4%BD%9C/1.htm">工作</a><a class="tag" taget="_blank" href="/search/%E9%A1%B9%E7%9B%AE%E7%AE%A1%E7%90%86/1.htm">项目管理</a> <div>高洛峰,兄弟连IT教育合伙人、猿代码创始人、PHP培训第一人、《细说PHP》作者、软件开发工程师、《IT峰播》主创人、PHP讲师的鼻祖! 首期现在的进程刚刚过半,徒弟们真的很棒,人品都没的说,团结互助,学习刻苦,工作认真积极,灵活上进。我几乎会把他们全部留下来,现在已有一多半安排了实际的工作,并取得了很好的成绩。等他们出徒之日,凭他们的能力一定能够拿到高薪,而且我还承诺过一个徒弟,当他拿到大学毕</div> </li> <li><a href="/article/3058.htm" title="linux expect" target="_blank">linux expect</a> <span class="text-muted">heipark</span> <a class="tag" taget="_blank" href="/search/expect/1.htm">expect</a> <div>1. 创建、编辑文件go.sh   #!/usr/bin/expect spawn sudo su admin expect "*password*" { send "13456\r\n" } interact    2. 设置权限   chmod u+x go.sh  3.</div> </li> <li><a href="/article/3185.htm" title="Spring4.1新特性——静态资源处理增强" target="_blank">Spring4.1新特性——静态资源处理增强</a> <span class="text-muted">jinnianshilongnian</span> <a class="tag" taget="_blank" href="/search/spring+4.1/1.htm">spring 4.1</a> <div>目录 Spring4.1新特性——综述 Spring4.1新特性——Spring核心部分及其他 Spring4.1新特性——Spring缓存框架增强 Spring4.1新特性——异步调用和事件机制的异常处理 Spring4.1新特性——数据库集成测试脚本初始化 Spring4.1新特性——Spring MVC增强 Spring4.1新特性——页面自动化测试框架Spring MVC T</div> </li> <li><a href="/article/3312.htm" title="idea ubuntuxia 乱码" target="_blank">idea ubuntuxia 乱码</a> <span class="text-muted">liyonghui160com</span> <div>  1.首先需要在windows字体目录下或者其它地方找到simsun.ttf 这个 字体文件。 2.在ubuntu 下可以执行下面操作安装该字体: sudo mkdir /usr/share/fonts/truetype/simsun sudo cp simsun.ttf /usr/share/fonts/truetype/simsun fc-cache -f -v </div> </li> <li><a href="/article/3439.htm" title="改良程序的11技巧" target="_blank">改良程序的11技巧</a> <span class="text-muted">pda158</span> <a class="tag" taget="_blank" href="/search/%E6%8A%80%E5%B7%A7/1.htm">技巧</a> <div>有很多理由都能说明为什么我们应该写出清晰、可读性好的程序。最重要的一点,程序你只写一次,但以后会无数次的阅读。当你第二天回头来看你的代码 时,你就要开始阅读它了。当你把代码拿给其他人看时,他必须阅读你的代码。因此,在编写时多花一点时间,你会在阅读它时节省大量的时间。   让我们看一些基本的编程技巧:   尽量保持方法简短 永远永远不要把同一个变量用于多个不同的</div> </li> <li><a href="/article/3566.htm" title="300个涵盖IT各方面的免费资源(下)——工作与学习篇" target="_blank">300个涵盖IT各方面的免费资源(下)——工作与学习篇</a> <span class="text-muted">shoothao</span> <a class="tag" taget="_blank" href="/search/%E5%88%9B%E4%B8%9A/1.htm">创业</a><a class="tag" taget="_blank" href="/search/%E5%85%8D%E8%B4%B9%E8%B5%84%E6%BA%90/1.htm">免费资源</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0%E8%AF%BE%E7%A8%8B/1.htm">学习课程</a><a class="tag" taget="_blank" href="/search/%E8%BF%9C%E7%A8%8B%E5%B7%A5%E4%BD%9C/1.htm">远程工作</a> <div>工作与生产效率:   A. 背景声音 Noisli:背景噪音与颜色生成器。 Noizio:环境声均衡器。 Defonic:世界上任何的声响都可混合成美丽的旋律。 Designers.mx:设计者为设计者所准备的播放列表。 Coffitivity:这里的声音就像咖啡馆里放的一样。 B. 避免注意力分散 Self Co</div> </li> <li><a href="/article/3693.htm" title="深入浅出RPC" target="_blank">深入浅出RPC</a> <span class="text-muted">uule</span> <a class="tag" taget="_blank" href="/search/rpc/1.htm">rpc</a> <div>深入浅出RPC-浅出篇 深入浅出RPC-深入篇   RPC Remote Procedure Call Protocol 远程过程调用协议   它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。RPC协议假定某些传输协议的存在,如TCP或UDP,为通信程序之间携带信息数据。在OSI网络通信模型中,RPC跨越了传输层和应用层。RPC使得开发</div> </li> </ul> </div> </div> </div> <div> <div class="container"> <div class="indexes"> <strong>按字母分类:</strong> <a href="/tags/A/1.htm" target="_blank">A</a><a href="/tags/B/1.htm" target="_blank">B</a><a href="/tags/C/1.htm" target="_blank">C</a><a href="/tags/D/1.htm" target="_blank">D</a><a href="/tags/E/1.htm" target="_blank">E</a><a href="/tags/F/1.htm" target="_blank">F</a><a href="/tags/G/1.htm" target="_blank">G</a><a href="/tags/H/1.htm" target="_blank">H</a><a href="/tags/I/1.htm" target="_blank">I</a><a href="/tags/J/1.htm" target="_blank">J</a><a href="/tags/K/1.htm" target="_blank">K</a><a href="/tags/L/1.htm" target="_blank">L</a><a href="/tags/M/1.htm" target="_blank">M</a><a href="/tags/N/1.htm" target="_blank">N</a><a href="/tags/O/1.htm" target="_blank">O</a><a href="/tags/P/1.htm" target="_blank">P</a><a href="/tags/Q/1.htm" target="_blank">Q</a><a href="/tags/R/1.htm" target="_blank">R</a><a href="/tags/S/1.htm" target="_blank">S</a><a href="/tags/T/1.htm" target="_blank">T</a><a href="/tags/U/1.htm" target="_blank">U</a><a href="/tags/V/1.htm" target="_blank">V</a><a href="/tags/W/1.htm" target="_blank">W</a><a href="/tags/X/1.htm" target="_blank">X</a><a href="/tags/Y/1.htm" target="_blank">Y</a><a href="/tags/Z/1.htm" target="_blank">Z</a><a href="/tags/0/1.htm" target="_blank">其他</a> </div> </div> </div> <footer id="footer" class="mb30 mt30"> <div class="container"> <div class="footBglm"> <a target="_blank" href="/">首页</a> - <a target="_blank" href="/custom/about.htm">关于我们</a> - <a target="_blank" href="/search/Java/1.htm">站内搜索</a> - <a target="_blank" href="/sitemap.txt">Sitemap</a> - <a target="_blank" href="/custom/delete.htm">侵权投诉</a> </div> <div class="copyright">版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved. <!-- <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">京ICP备09083238号</a><br>--> </div> </div> </footer> <!-- 代码高亮 --> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shCore.js"></script> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shLegacy.js"></script> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shAutoloader.js"></script> <link type="text/css" rel="stylesheet" href="/static/syntaxhighlighter/styles/shCoreDefault.css"/> <script type="text/javascript" src="/static/syntaxhighlighter/src/my_start_1.js"></script> </body> </html>