[英]Why Rundeck redirect to ec2 private ip on aws if using public ip?
12.34.56.78
(fake)。 21.43.65.87
(fake)。 ip-21.43.65.87
(fake)。 何時訪問:
重定向到:
HTTP:// IP-21-34-65-87:4440 /菜單/家
從官方文檔中 ,有一個通知:
server.http.host Address/hostname to listen on, default is all addresses "0.0.0.0"
所以我嘗試使用該選項啟動rundeck:
java -XX:MaxPermSize=256m -Xmx1024m -jar -Dserver.http.host="12.34.56.78" rundeck-launcher-2.0.0.jar
它說不能使用那個地址。 為什么?
運行啟動命令后:
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)
2018-06-08 03:53:11.824:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.Server@6fc26fb1: java.net.BindException: Cannot assign requested address
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.server.Server.doStart(Server.java:303)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.server.Server.doStart(Server.java:303)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)
這可能是由於AWS EC2實例中的公共IPv4尋址 :
“每個接收到公共IP地址的實例也將獲得一個外部DNS主機名;例如ec2-203-0-113-25.compute-1.amazonaws.com。我們將外部DNS主機名解析為實例網絡外部的實例,以及從實例網絡內部實例的私有IPv4地址。通過網絡地址轉換(NAT)將公共IP地址映射到主要私有IP地址”
如文檔中所述,Rundeck可以偵聽的IP地址是為其網絡接口配置的地址,而不是通過NAT映射的IP地址。
此外,還可以通過在啟動jar時添加以下屬性來強制Rundeck僅使用IPv4套接字:-Djava.net.preferIPv4Stack = true。
希望能幫助到你。
在這兩個配置文件中編輯公共IP后,效果很好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.