我是在阿里云和腾讯云各买了一台centos部署的rancher

在rancher里添加eureka服务

、eureka已处于Active状态,

端口也在部署前映射过了。

但是通过公网ip:8761 访问不到eureka的网页,后来我发现在rancher-agent里部署的eureka被分配了一个内网ip

ssh上我的agent,然后输入

[root@www ~]# curl http://10.42.202.4:8761/

就可以打开网页的html

 <head>
    <base href="/">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Eureka</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="eureka/css/wro.css">

  </head>

  <body id="one">
<nav class="navbar navbar-default" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <a class="navbar-brand" href=""><span></span></a>
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li>
          <a href="">Home</a>
        </li>
        <li>
          <a href="/lastn">Last 1000 since startup</a>
        </li>
      </ul>
    </div>
  </div>
</nav>


    <div class="container-fluid xd-container">
<h1>System Status</h1>
<div class="row">
  <div class="col-md-6">
    <table id='instances' class="table table-condensed table-striped table-hover">
            <tr>
        <td>Environment</td>
        <td>test</td>
      </tr>
      <tr>
        <td>Data center</td>
        <td>default</td>
      </tr>
    </table>
  </div>
  <div class="col-md-6">
    <table id='instances' class="table table-condensed table-striped table-hover">
      <tr>
        <td>Current time</td>
        <td>2018-11-07T02:35:32 +0000</td>
      </tr>
      <tr>
        <td>Uptime</td>
        <td>00:15</td>
      </tr>
      <tr>
        <td>Lease expiration enabled</td>
        <td>true</td>
      </tr>
      <tr>
        <td>Renews threshold</td>
        <td>1</td>
      </tr>
      <tr>
        <td>Renews (last min)</td>
        <td>0</td>
      </tr>
    </table>
  </div>
</div>

        <h4 id="uptime"><font size="+1" color="red"><b>RENEWALS ARE LESSER THAN THE THRESHOLD. THE SELF PRESERVATION MODE IS TURNED OFF.THIS MAY NOT PROTECT INSTANCE EXPIRY IN CASE OF NETWORK/OTHER PROBLEMS.</b></font></h4>

<h1>DS Replicas</h1>
<ul class="list-group">
    <li class="list-group-item"><a href="http://47.107.151.66:8761/eureka/">47.107.151.66</a></li>
</ul>

      <h1>Instances currently registered with Eureka</h1>
      <table id='instances' class="table table-striped table-hover">
        <thead>
          <tr><th>Application</th><th>AMIs</th><th>Availability Zones</th><th>Status</th></tr>
        </thead>
        <tbody>
            <tr><td colspan="4">No instances available</td></tr>

        </tbody>
      </table>

      <h1>General Info</h1>

      <table id='generalInfo' class="table table-striped table-hover">
        <thead>
          <tr><th>Name</th><th>Value</th></tr>
        </thead>
        <tbody>
            <tr>
              <td>total-avail-memory</td><td>83mb</td>
            </tr>
            <tr>
              <td>environment</td><td>test</td>
            </tr>
            <tr>
              <td>num-of-cpus</td><td>1</td>
            </tr>
            <tr>
              <td>current-memory-usage</td><td>46mb (55%)</td>
            </tr>
            <tr>
              <td>server-uptime</td><td>00:15</td>
            </tr>
            <tr>
              <td>registered-replicas</td><td>http://47.107.151.66:8761/eureka/</td>
            </tr>
            <tr>
              <td>unavailable-replicas</td><td>http://47.107.151.66:8761/eureka/</td>
            </tr>
            <tr>
              <td>available-replicas</td><td></td>
            </tr>
        </tbody>
      </table>

      <h1>Instance Info</h1>

      <table id='instanceInfo' class="table table-striped table-hover">
        <thead>
          <tr><th>Name</th><th>Value</th></tr>
        <thead>
        <tbody>
            <tr>
              <td>ipAddr</td><td>10.42.202.4</td>
            </tr>
            <tr>
              <td>status</td><td>UP</td>
            </tr>
        </tbody>
      </table>
    </div>
    <script type="text/javascript" src="eureka/js/wro.js" ></script>
    <script type="text/javascript">
       $(document).ready(function() {
         $('table.stripeable tr:odd').addClass('odd');
         $('table.stripeable tr:even').addClass('even');
       });
    </script>
  </body>
</html>

 

可以通过查看html,来了解其他微服务的是否注册到eureka上

 


 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐