Docker Create tomcat/weblogic Cluster

Source: Internet
Author: User
Tags node server docker run

Installing the Tomcat image

Prepare the required JDK, Tomcat and other software into the home directory, launch a container

docker run -t -i -v /home:/opt/data  --name mk_tomcat ubuntu /bin/bash

This command mounts the local home directory to the container's/opt/data directory, which is automatically created if the directory does not exist in the container. Next is the basic configuration of Tomcat, after the JDK environment variable is set up, put the Tomcat program under/opt/apache-tomcat Edit the/etc/supervisor/conf.d/supervisor.conf file, add TOMC At item

[supervisord]nodaemon=true[program:tomcat]command=/opt/apache-tomcat/bin/startup.sh[program:sshd]command=/usr/sbin/sshd -D
docker commit  ac6474aeb31d  tomcat

Create a new Tomcat folder and create a new Dockerfile.

FROM mk_tomcatEXPOSE  22 8080CMD ["/usr/bin/supervisord"]

Create a mirror based on Dockerfile.

docker build tomcat tomcat
Installing WebLogic Mirroring

The steps are basically consistent with Tomcat, where the configuration file is posted

supervisor.conf[supervisord]nodaemon=true[program:weblogic]command=/opt/Middleware/user_projects/domains/base_domain/bin/startWebLogic.sh[program:sshd]command=/usr/sbin/sshd -DdockerfileFROM weblogicEXPOSE  22 7001CMD ["/usr/bin/supervisord"]
Use of tomcat/weblogic images for use with storage

When you start, use the -v parameters

--volume=[]            Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)

The local disk is mapped to the inside of the container, it changes in real time between the host and the container, so we update the program, upload the code only need to update the physical host directory to be able to

The implementation of Tomcat and WebLogic clusters

Tomcat can only open multiple containers

docker run -d -v -p 204:22 -p 7003:8080 -v /home/data:/opt/data --name tm1 tomcat /usr/bin/supervisorddocker run -d -v -p 205:22 -p 7004:8080 -v /home/data:/opt/data --name tm2 tomcat /usr/bin/supervisorddocker run -d -v -p 206:22 -p 7005:8080 -v /home/data:/opt/data --name tm3 tomcat /usr/bin/supervisord

Here's the WebLogic configuration, and you know that WebLogic has a domain concept. If you are deploying using a regular administrator +node, you will need to write out the startup scripts for Administartor Server and node server separately in Supervisord, with the following advantages:

    • Can use WebLogic clustering, synchronization and other concepts
    • Deploy a clustered application that only needs to be installed once to the cluster

The disadvantages are:

    • Docker configuration is complicated.
    • There is no way to automatically expand the compute capacity of the cluster, if you want to add nodes, you need to create a node on administrator, then configure the new container Supervisor startup script, and then start the container

Another way is to install all the programs on the Adminiserver, need to expand the time, to start multiple nodes, its advantages and disadvantages and the previous method is the opposite. (This is the recommended way to deploy development and test environments)

docker run -d -v -p 204:22 -p 7001:7001 -v /home/data:/opt/data --name node1 weblogic /usr/bin/supervisorddocker run -d -v -p 205:22 -p 7002:7001 -v /home/data:/opt/data --name node2 weblogic /usr/bin/supervisorddocker run -d -v -p 206:22 -p 7003:7001 -v /home/data:/opt/data --name node3 weblogic /usr/bin/supervisord

This allows the front-end use of Nginx to do load balancing can be configured to complete

Docker Create tomcat/weblogic Cluster

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.