Glassfish 3.1 loadbalancing setup - glassfish

I am very new to server setup. I have a cluster with 2 instances in GF.
instance1:28081
instance2:28082
I am running my GF in Amazon Linux EC2 instance. What are the options to create a load balancer setup that directs traffic to these instances when I try to access my EC2 instance http 80 port?
1) Do I need to have a webserver to direct traffic to these instances?
2) Is there any options in Glass fish which can handle load balancing without a webserver on these instances? I couldn't find load balancing configuration on my admin console.
3) Is there a way to use Amazon Load balancing to distribute traffic to these cluster instances which resides in a single ec2 instance?
If some one can provide step by step instructions/link reference that would be helpful.

I did a nice write up on loadbalancing/failover and proxy options for GlassFish.
have a look: http://blog.eisele.net/2012/01/throwing-light-on-glassfish-webserver.html

Related

Azure Container Services Port Load Balancer

While trying to port my application which is running on docker Swarm locally to Azure Container Service I am struck on the load balancer part of the Azure.
Locally I have a container instance of HAproxy running on Swarm Master and multiple web containers running.
Web containers have just exposed the ports and they are not mapped to machines on which they are running.
HAproxy container has mapped port to the master and internally is talking to my web containers for load balancing.
This gives me the leverage to run any number of containers with limited number of workers in Docker Swarm.
In azure container service I see that Azure load balancer will talk to only ports that are mapped, that means that I can only run 1 container per agent or I keep an internal load balancer in my containers, which implies that users will be going through 2 load balancers before hitting my application.
Not an ideal scenario when my application uses sticky sessions.
So Apparently Microsoft's statement "Everything works same in Azure containers" goes for a toss ?
what are the solutions available or am I doing something wrong here?
Regards,
Harneet
The solution in ACS is almost identical. Use HAProxy and have the Azure LB talk to that. The only difference is that you will not be running the proxy on the master, you will have Swarm deploy it to an agent for you.
You shouldn't really be running workloads on your masters. What would you do if you have a DDoS attack and can't reach your masters, for example. Having Swarm deploy the proxy for you means that you can also have swarm monitor the health of the proxy.
You could, if you really wanted to, run the proxy on the master as you do now. The solution would be the same, have the Azure LB provide a public connection to the proxy just as you currently do.

Does EC2 Elastic Load Balancer remove the need for apache/nginx?

I am striving for a very simple cloud based architecture on Amazon AWS. I would like to have an app layer of several "elastic" EC2 instances where my application (and application servers) run, but I'm wondering what the load balancing will look like.
If I choose to use ELB, does it remove the need for Apache or Nginx?
No. All the loadbalancer does is just that, distributes load across instances. Whatever your stack is running on each instance will still need a nginx or apache or whatever service you want to respond back to the request routed through the load balancer.
I'm assuming you're running a web stack needing some type of server like nginx, apache, or java needing tomcat or something.
However, if you want AWS to take care of nginx and/or apache, look into running as a ElasticBeanstalk application: https://aws.amazon.com/elasticbeanstalk/

Google compute engine load balancing not routing properly

I am new to Google compute engine and I am try to setup network load balancing having 2 VMs for serving web pages.
For ex, I have 2 VMs - app1 and app2 - both having apache server and serves simple web page.
Both VMs are running with Red Hat Enterprise Linux Server release 7.0 (Maipo)
I am able to access both web pages through the IP in browser.
I created network load balancing setup and both apps are showing in green in target pool which means load balancer is able to connect to both VMs.
But, when I hit the IP of load balancer, it is rendering page from only one server. If I manually stop the server in the VM, load balancer IP redirects to other app. I believe load balancer is able to identify health of both VMs and able to redirect.
But it is not balancing the traffic. Can anyone help me to solve this issue?
I think that the network load balancer doesn't forward the traffic on a round-robin basis. I was able to test it with the load balancer setup that I have. As per the documentation:
By default, to distribute traffic to instances, Google Compute Engine picks an instance based on a hash of the source IP and port and the destination IP and port.
HTTP/S load balancing will proxy requests in a round-robin fashion. https://cloud.google.com/compute/docs/load-balancing/http/

Amazon EC2 cloud hosting

How do I host a http server at front, while multiple tomcat server behind it in EC2?
Do we need to do session and cookie management or does EC2 has it inbuild?
Can we stream images and static resources through some other server while dynamic content from tomcat?
Check out the Java support in AWS Elastic Beanstalk. It handles the load balancing, auto scaling, metrics and deployment for you. Deploy your static assets to S3 + CloudFront instead of keeping them inside your application bundle.
There are multiple ways to host a webserver in front and redirect requests to multiple tomcat servers in backend. Assuming you have webserver and multiple tomcat servers deployed over a EC2 and tomcat. Using ajp or mod_proxy or mod_jk, you can redirect requests hitting on your webserver to your backend tomcat servers.
By default, AWS does not provide cookie or session management. You can use AWS Elasticache for session management.
Yes, you can upload your images and other static content on Amazon S3 and deliver it from S3 itself or using CloudFront (CDN) while your dynamic requests are coming to your tomcat servers.
Your questions was too broad. If you provide more details, we can help more.
Thanks
Sanket

sshing in aws load balancer and configuring it for subdomain routing?

We want to use Amazon Elastic BeanStalk service for deployment in EC2 Boxes.
We want to deploy our Ruby on Rails Application in such a way that we can do sub-domain based routing to different rails app.
And we want to use single SSL Certificate for our load balancer and want to configure our load balancer in susch a away tha subdomain based routing takes place.
HA Proxy does this work well but when we are trying to use Amazon Elastic BeanStalk service for our deployment, aws creates a load balancer but didn't associate it with any Key-Pair.
So we are not able to ssh in load balancer and add our configuration for subdomain based routing.
Can someone please point me to some solution ?
Thanks,
Ankit.
You don't SSH into AWS load balancers, they are basically a black box that you have only a limited set of configuration options for. You probably need to look at the Route 53 services for DNS routing.
Your configuration would have routing based on domain DNS to different load balancers, one for each separate service you need. You can't have a single ELB route traffic to different EC2 instances based on domain or URI fragments.