Create a Tomcat/Weblogic cluster using Docker

Source: Internet
Author: User
Tags node server

Create a Tomcat/Weblogic cluster using Docker

Install Tomcat Image

Prepare required software such as jdk and tomcat in the home directory and start 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/opt/data directory of the container. If the directory in the container does not exist, it is automatically created. The next step is the basic configuration of tomcat. After the jdk environment variable is set, put the tomcat program under/opt/apache-tomcat and edit/etc/supervisor/conf. d/supervisor. conf file to add tomcat items

[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 tomcat folder and create a Dockerfile.
FROM mk_tomcat
EXPOSE 22 8080
CMD ["/usr/bin/supervisord"]

Create an image based on Dockerfile.
Docker build tomcat

Install weblogic Image

The steps are basically the same as those of tomcat. paste the configuration file here
Supervisor. conf
[Supervisord]
Nodaemon = true

[Program: weblogic]
Command =/opt/Middleware/user_projects/domains/base_domain/bin/startWebLogic. sh

[Program: sshd]
Command =/usr/sbin/sshd-D
Dockerfile
FROM weblogic
EXPOSE 22 7001
CMD ["/usr/bin/supervisord"]

Use of tomcat/weblogic Images

Storage usage

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

The local disk is mapped to the container, which changes in real time between the host and the container. Therefore, you only need to update the directory of the physical host to update the program and upload code.

Implementation of tomcat and weblogic Clusters

You only need to enable multiple containers for tomcat.
Docker run-d-v-p 204:22-p 7003: 8080-v/home/data:/opt/data -- name tm1 tomcat/usr/bin/supervisord
Docker run-d-v-p 205:22-p 7004: 8080-v/home/data:/opt/data -- name tm2 tomcat/usr/bin/supervisord
Docker run-d-v-p 206:22-p 7005: 8080-v/home/data:/opt/data -- name tm3 tomcat/usr/bin/supervisord

Here we will talk about weblogic configuration. We all know that weblogic has a domain concept. If you want to deploy the service using the common administrator + node Method, you need to write the startup scripts of administartor server and node server in supervisord respectively. The advantages of this method are:

  • Weblogic clusters and synchronization can be used.
  • To deploy a cluster application, you only need to install the application once on the cluster.

Disadvantages:

  • Complicated Docker Configuration
  • There is no way to automatically expand the cluster's computing capacity. To add nodes, you need to create nodes on the administrator, configure the new container supervisor STARTUP script, and then start the container.

The other method is to install all programs on the adminiserver. When you need to expand the program, start multiple nodes. The advantages and disadvantages of this method are the opposite of those of the previous method. (We recommend that you use this method to deploy the development and test environments)
Docker run-d-v-p 20:22-p 7001: 7001-v/home/data:/opt/data -- name node1 weblogic/usr/bin/supervisord
Docker run-d-v-p 205:22-p 7002: 7001-v/home/data:/opt/data -- name node2 weblogic/usr/bin/supervisord
Docker run-d-v-p 206:22-p 7003: 7001-v/home/data:/opt/data -- name node3 weblogic/usr/bin/supervisord

In this way, the configuration can be completed by using nginx on the front end for load balancing.

This article permanently updates link: https://www.bkjia.com/Linux/2018-02/151086.htm

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.