Sei sulla pagina 1di 5

Open In App

1
Home Answer Notifs

Quora uses cookies to improve your experience. Read more

Apache Tomcat +2

How do I run multiple microservices on a single Tomcat container


with the same port?
3

Answer Follow Request More

Ad by Amazon India
Amazon Freedom Sale.
Have you bought the new OnePlus 7 series yet? Buy it now on #AmazonFreedomSale and get
amazing discounts.

Shop Now

3 ANSWERS

Gautam Gupta, Microservices Architecture Expert


Answered May 19, 2017

You can simply implement each Microservice as a separate endpoint and deploy within same
Tomcat container. But this will essentially defeat the main purpose of Microservices architecture.

You want to use Microservices architecture so that you can scale it independently of any other
Microservice.

Therefore, it is best to run separate Microservices in different Tomcat containers.

3.4k views · View Upvoters

Upvote · 3 Share

Comment... Recommended All

Sponsored by upGrad.com

417% rise in demand for data scientists in India (source: ET).


Data science is the algorithm for your success. Learn it online. View our industry-relevant
curriculum.
Open In App
Apply Now
1
Home Answer Notifs

Amaresh Kumar, studied Computer Engineering at University of Pune, India


Answered May 12, 2017

You don't .

Define port no as 0 in config file,while starting up it will take random ports.all the instance will be
available with Eureka Server.
2.5k views

Upvote Share

Comment... Recommended All

RELATED QUESTIONS (MORE ANSWERS BELOW)

How does Apache Tomcat work internally?


61,016 Views

What is the difference between SOA and microservices?


84,325 Views

How is Docker used with microservices?


35,456 Views

 Ask New Question

OTHER ANSWERS

Joseph Cooper
Answered Mar 12, 2018

Firstly - you shouldn’t do this. I had the same idea, but containers are fairly lightweight and with
the resources of the cloud today (unless you care about kb’s in memory) - take a peek here to see
What is the runtime performance cost of a Docker container

When it comes to scaling a specific app or ensuring resources are avail for your apps needs - one
container per app is the way and IMO should be a microservice principle.

Now - If you’re trying to run a quick proof of concept. This is possible with Kubernetes if you’re
planning on using it.
1. Create a deployment definition and deploy your container, but inside your container, run
Open In App
each application with a unique port.
1
2. CreateHome Answer
a K8s service per app and that maps Notifs
to the specific port of that app. Ensure your
service has its own IP or domain name mapped to is with ingress.

Now the above may sound extremely foreign to you if you're not using k8s. But I skimmed through
the docker portion and spent 10 hours on Scalable Microservices with Kubernetes | Udacity which
will help you make sense of the above. Continue Reading

Oth i I hi hl d i l l DNS t l ith d k ith


Upvote · 2 Share

Comment... Recommended All

Sponsored by Gartner Summit

Make security & risk matter to the organization.


Get the latest insights, research and advise to help you embed security culture in your organization.

Learn More

RELATED QUESTIONS & ANSWERS

What are microservices?


Ranga Karanam, Best Selling Udemy Instructor : Microservices & Spring Boot
Answered Nov 17, 2018
What is a Monolith Application? Have you ever worked in a project * Which is released
Open (taken
In App to
production) once every few months * Which has a wide range of features and functionality...
Read More
1
17 Home
2 0 Answer Notifs

How does Apache Tomcat work internally?

Shoukri Kattan, Works at a leading Telecommunication Software and Consulting


services firm
Answered Feb 25, 2014

This is a very high level question and there are many internals and complexities but if we are to
focus on what Tomcat is : A Servlet Container then it works as follows : Tomcat mainly hasRead
a Cla...
More
100+ 0 1

How is Docker used with microservices?

Bill William, M.C.A Software and Applications & Java, SRM University, Kattankulathur
(2006)
Answered Jan 19, 2018

The development of server-side web applications has changed greatly since Docker’s debut.
Thanks to Docker, it’s now easier to construct scalable and manageable applications built of
microservices.... Read More
14 1 2

What is the difference between SOA and microservices?

Matt McLarty, Co-author of Microservice Architecture from O'Reilly


Answered Mar 22
Open In App
For a longer answer, please see my article in InfoWorld here: Learn from SOA: 5 lessons for the1
Home
microservices era When trying to compare Answer Notifsto determine the
SOA and microservices, you first need
contex... Read More
14 0 0

How do I run two Tomcat servers with the same port at the same time?

Steve Jacobs, worked at High Performance Computing


Updated Jun 8, 2017

Use a virtual IP or a separate NIC for one of them, or run an instance on two computers and put
them behind a load balancer. Two processes can’t listen on the same port of the same interface.
When I... Read More
1 0 0

How can I learn and use microservices?

Henri Koppen, Creating API's FTW


Updated Jun 8

RESTful webservice or REST API is basically the most common form of microservices. Learn all you
need to know about API’s (building and consuming) on Learn to code and help nonprofits for free
and g... Read More
18 0 0

How do you run several microservices locally?

Piotr Mińkowski, Msc Telecommunications, Warsaw University of Technology (2009)


Answered Jun 19, 2018

It is important to be sure if there is no conflicts in port numbers between locally running instances
of your microservices. For example, if you use Spring Boot you can override port number using p...
Read More
1 0 0

Is it correct for a single team to own multiple microservices?

Gautam Gupta, Microservices Architecture Expert


Answered Apr 29, 2017

As per Industry standards, a team can develop a Microservice in 2 weeks to 2 months duration. Let
say a team develops a Microservice in 2 months, what would they do afterwards? Will they be
occupie... Read More
6 0 0

Potrebbero piacerti anche