平台:亞馬遜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.