Apache's Load Balancer MOD_JK module implementation

Source: Internet
Author: User


Apache 's Load balancer mod_jk module Implementation

Configure The MOD_JK agent function First,

[email protected] ~]# Yum install-y httpd-devel

[Email protected] ~]# RPM-QL httpd-devel

/usr/sbin/apxs

Apxs is required for httpd installation of external modules

[email protected] ~]# Yum groupinstall "Development Tools" "Server Platform Development"-y//required package group.

The environment required for compiling the installation.

[Email protected] ~]# tar xftomcat-connectors-1.2.40-src.tar.gz

[[email protected] ~]# ls

A Install.log Oracle

apache-tomcat-7.0.56.tar.gz Install.log.syslog Root20141030092112523.zip

apache-tomcat-8.0.20.tar.gz jdk-8u31-linux-i586.rpm TOMCAT-CONNECTORS-1.2.40-SRC

b Lamp tomcat-connectors-1.2.40-src.tar.gz

[Email protected] ~]# CD TOMCAT-CONNECTORS-1.2.40-SRC

[[email protected] tomcat-connectors-1.2.40-src]# ls

conf docs howto-release.txt jkstatus LICENSE native NOTICE README.txt Support Tools XDocs

[Email protected] tomcat-connectors-1.2.40-src]# cdnative/

[[email protected] native]# ls

ACLOCAL.M4 apache-2.0 BUILDING.txt Configure docs makefile.am Netscape Scripts TODO.txt

apache-1.3 buildconf.sh Common Configure.ac IIS makefile.in README.txt STATUS.txt

[Email protected] native]#./configure--with-apxs=/usr/sbin/apxs

[[email protected] native]# make && Makeinstall

----------------------------------------------------------------------

chmod 755/usr/lib64/httpd/modules/mod_jk.so

Sure to arrange/etc/httpd/conf/httpd.conf ...

MAKE[1]: Leaving directory '/root/tomcat-connectors-1.2.40-src/native/apache-2.0 '

MAKE[1]: Entering directory '/root/tomcat-connectors-1.2.40-src/native '

MAKE[2]: Entering directory '/root/tomcat-connectors-1.2.40-src/native '

MAKE[2]: Nothing to is done for ' install-exec-am '.

MAKE[2]: Nothing to is done for ' install-data-am '.

MAKE[2]: Leaving directory '/root/tomcat-connectors-1.2.40-src/native '

MAKE[1]: Leaving directory '/root/tomcat-connectors-1.2.40-src/native '


[Email protected] ~]# CD/ETC/HTTPD

[[email protected] httpd]# ls

Conf CONF.D logs modules run

[Email protected] httpd]# CD conf.d/

[[email protected] conf.d]# ls

php.conf README welcome.conf

[Email protected] conf.d]# vim mod_jk.conf

# Load The MOD_JK

LoadModule Jk_module modules/mod_jk.so

Jkworkersfile/etc/httpd/conf.d/workers.properties

Jklogfile Logs/mod_jk.log

Jkloglevel Debug

Jkmount/* Tomcata

Jkmount/status/stata

~

[Email protected] conf.d]# vim/etc/httpd/conf.d/workers.properties

Worker.list = Tomcata,stata

Worker. tomcata.port=8009

Worker. tomcata.host=192.168.1.116

Worker. Tomcata.type=ajp13

Worker. Tomcata.lbfactor=1

Worker.statA.type = Status

[Email protected] conf.d]# httpd-t

Syntax OK

[Email protected] conf.d]# service httpd restart

stopping httpd: [OK]

Starting httpd: [OK]

[Email protected] conf.d]#

At this point, the configuration of a worker communication based on the MOD_JK module and the back end named Tomcata has been completed, and restarting the HTTPD service will take effect.

650) this.width=650; "Src=" http://home.51cto.com/thumb.php?w=600&h=600&t=f&url=http://s3.51cto.com/ Wyfs02/m01/59/ff/wkiol1tzk2aqlnnsaalrg_e-qqu235.jpg "id=" Big_pic "alt=" Wkiol1tzk2aqlnnsaalrg_e-qqu235.jpg "/>

There is also status information

650) this.width=650; "Src=" http://home.51cto.com/thumb.php?w=600&h=600&t=f&url=http://s3.51cto.com/ Wyfs02/m00/5a/02/wkiom1tzklgxumfaaapizvlqjzq107.jpg "alt=" Wkiom1tzklgxumfaaapizvlqjzq107.jpg "/>

to achieve load balancing, you need at least two Tomcat to operate on this machine, configure another version of Tomcat, and access http://192.168.1.116:9080 after the configuration is complete

650) this.width=650; "Src=" http://home.51cto.com/thumb.php?w=600&h=600&t=f&url=http://s3.51cto.com/ Wyfs02/m02/5a/02/wkiom1tzkmat5124aapgzvdrbtq853.jpg "alt=" Wkiom1tzkmat5124aapgzvdrbtq853.jpg "/>

MOD_JK directly supports load balancing and requires a special type of worker:lb to be enabled.

[Email protected] conf.d]# vim mod_jk.conf

#Load the MOD_JK

LoadModule Jk_module modules/mod_jk.so

Jkworkersfile/etc/httpd/conf.d/workers.properties

Jklogfile Logs/mod_jk.log

Jkloglevel Debug

Jkmount/* Lbcluster1

Jkmount/status/stata

~

[Email protected] conf.d]# vim workers.properties

Worker.list = Lbcluster1,stata

Worker. tomcata.port=8009

Worker. tomcata.host=192.168.1.116

Worker. Tomcata.type=ajp13

Worker. Tomcata.lbfactor=1

Worker. tomcatb.port=9009

Worker. tomcatb.host=192.168.1.116

Worker. Tomcatb.type=ajp13

Worker. Tomcatb.lbfactor=1

Worker.lbcluster1.type = lb

sorker.lbcluster1.sticky_session = 0

Worker.lbcluster1.balance_workers =tomcata, TOMCATB

Worker.statA.type = Status

~

[Email protected] conf.d]# httpd-t

Syntax OK

[Email protected] bin]# service httpd restart

stopping httpd: [OK]

Starting httpd: [OK]

[Email protected] bin]#

The MOD_JK is configured for load balancing and is tested as follows.

Visit http://192.168.1.116

650) this.width=650; "Src=" http://home.51cto.com/thumb.php?w=600&h=600&t=f&url=http://s3.51cto.com/ Wyfs02/m01/59/ff/wkiol1tzk2aqlnnsaalrg_e-qqu235.jpg "alt=" Wkiol1tzk2aqlnnsaalrg_e-qqu235.jpg "/>

Refresh again

650) this.width=650; "Src=" http://home.51cto.com/thumb.php?w=600&h=600&t=f&url=http://s3.51cto.com/ Wyfs02/m00/5a/02/wkiom1tzlq3gjumbaamhlrwgnjm147.jpg "alt=" Wkiom1tzlq3gjumbaamhlrwgnjm147.jpg "/>


Apache's Load Balancer MOD_JK module implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.