平台:亚马逊AWS
EC2
出现状况:
我创建了弹性平衡负载,也注册了实例,但是实例的状态一直是outofservice。为什么?
为什么会出现这个问题呢?
1:实例有问题;
2:负载平衡器创建的有问题;
3:协议端口没开;
我首先想到的是协议端口没开,但是,当我把http的80端口打开之后,依然是那样,所以,不太可能是这个原因了
然后,我用YuPPT连接实例
一:在AWS的EC2实例中查看自己的公用DNS。
二:打开Putty,在host_name中填入上图红色框中的内容。
三:点开Putty的SSH,然后选取自己的密码。
三:登录之后,就是下边这个情况。
然后,安装httpd服务。
Apache在Linux系统中,其实叫“httpd”
AWS中的实例可以使用yum命令,非常简单和容易的安装Apache,下面演示一下步骤:
1、安装Apache
sudo yum install httpd
2、设置Apache服务的启动级别
sudo chkconfig --levels 235 httpd on
Apache是一个服务,可以通过设置服务的启动级别来启动。2,3,5三个级别分别表示。
3、设置开机启动。
sudo /etc/init.d/httpd start
安装好之后,可以重启一下实例。
如果问题还没有解决,请按照官方文档,进一步修改。
官方解决方法:
http://docs.amazonaws.cn/en_us/elasticloadbalancing/latest/classic/ts-elb-register-instance.html
Best Practices for Your Instances
-
Install a web server, such as Apache or Internet Information Services (IIS), on all instances that you plan to register with your load balancer.
-
For HTTP and HTTPS listeners, we recommend that you enable the keep-alive option in your EC2 instances, which enables the load balancer to re-use the connections to your instances for multiple client requests. This reduces the load on your web server and improves the throughput of the load balancer. The keep-alive timeout should be at least 60 seconds to ensure that the load balancer is responsible for closing the connection to your instance.
-
Elastic Load Balancing supports Path Maximum Transmission Unit (MTU) Discovery. To ensure that Path MTU Discovery can function correctly, you must ensure that the security group for your instance allows ICMP fragmentation required (type 3, code 4) messages. For more information, see Path MTU Discovery in the Amazon EC2 User Guide for Linux Instances.