Set up MySQL Tomcat and mysqltomcat

Source: Internet
Author: User
Tags redis cluster

Set up MySQL Tomcat and mysqltomcat

Overview

The Tomcat server is a free open-source Web application server, which is a lightweight application server. It is widely used in small and medium systems and concurrent users, is the first choice for developing and debugging JSP programs.

Test environment: redhat 6.0

 

Procedure

Install JDK

Download and decompress the jdk package

: Http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html

Decompress the Jdk package

Tar-xvf jdk-8u20-linux-x64.gz

Move the decompressed jdk package to the/usr/local directory.

Mv jdk1.8.0 _ 20/usr/local/

Configure Environment Variables

Vim/etc/profile

Add

JAVA_HOME =/usr/local/jdk1.8.0 _ 20

JAVA_BIN =/usr/local/jdk1.8.0 _ 20/bin

PATH = $ PATH: $ JAVA_BIN

CLASSPATH = $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar

Export JAVA_HOME JAVA_BIN PATH CLASSPATH

 

Execute the command to make the modification take effect immediately

Source/etc/profile

Test whether the java environment is successfully installed.

Java-version

Install tomcat

:Http://tomcat.apache.org/latest version 9.0

I tested version 8.0 here.

Decompress the downloaded package

Mv apache-tomcat-8.0.30/usr/local/tomcat1

Cd/usr/local/bin

Vim catalina. sh

Add a line: CATALINA_HOME =/usr/local/tomcat1/

Grant file executable permissions

Chmod + x *. sh

 

StartTomcat

/Usr/local/tomcat1/bin/catalina. sh start

 

 

Enter:Http: // localhost: 8080/

YesTomcatPage,The installation is successful.

 

 

Deploy multiple tomcat servers on the Current Machine

To deploy multiple tomcat servers on one machine, you only need to modify the http and ajp ports.

Copy tomcat1

Cp-r extends AT1 tomcat2

 

Go to the tomcat2 folder and modify the server. xml file.

Cd

/Usr/local/tomcat2/conf

Vim server. xml

    <Connector port="8081" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8444" />  <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />

The default http port is 8080. If you do not need to repeat it, change the port to 8081. If you want to connect to the http port through the AJP protocol, change the AJP protocol port, I will change it to 8010 here, because tomcat1 uses 8009

 

You also need to modify it.Catalina. sh File

Vim catalina. sh

Add a line: CATALINA_HOME =/usr/local/tomcat2/

Grant file executable permissions

Chmod + x *. sh

 

StartTomcat2

/Usr/local/tomcat2/bin/catalina. sh start

 

Enter the following in the browser:Http: // localhost: 8081/

If the tomcat page appears, the configuration is successful.

 

 

Summary

If the test page does not appear, check whether tomcat is started. You can use netstat-an | grep 8080 to check the port. You can also disable the firewall because of the firewall, use service iptabls status to check whether the firewall is enabled or add the port vim/etc/sysconfig/iptables to the firewall.

In the next chapter, we will build Apache to achieve tomcat load balancing.

Later articles will explain one after another: Use Ngins to build tomcat load balancing, set up redis cluster cache, and set up a mycat cluster.

 

 

If the article is helpful to you, please recommend it. Thank you !!!

 

Note:

Author: pursuer. chen

Blog: http://www.cnblogs.com/chenmh

All essays on this site are original. You are welcome to repost them. However, you must indicate the source of the article and clearly provide the link at the beginning of the article. Otherwise, you will be held accountable.

Welcome to discussion

 

--- Restore content end ---

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.