React / Node Js客户端未注册到Eureka

时间:2020-03-17 14:18:15

标签: node.js reactjs configuration netflix-eureka

我有个奇怪的问题。我在节点应用程序上添加了配置,但是我的微服务仍未注册到eureka服务器。

这是我的配置:

<pre>'use strict';

const express = require('express');
const Eureka = require('eureka-js-client').Eureka;

// Constants
const PORT = 3000;
const HOST = '0.0.0.0';
const app = express();

// example configuration
const client = new Eureka({
    // application instance information
    instance: {
        app: 'a-node-service',
        hostName: 'localhost',
        instanceId: 'a-node-service',
        ipAddr: '192.168.137.1',
        //statusPageUrl: 'http://localhost:3000/actuator/info',
        //homePageUrl: 'http://localhost:3000',
        port: {
            $: PORT,
            '@enabled': 'true',
        },
        vipAddress: 'a-node-service',
        statusPageUrl: 'http://localhost:3000/info',
        dataCenterInfo: {
            '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
            name: 'MyOwn',
        },
        registerWithEureka: true,
        fetchRegistry: true,
    },
    eureka: {
        // eureka server host / port
        host: 'localhost',
        port: 8761,
        servicePath: '/eureka/apps/',
    },
});



client.logger.level('debug');
client.start(error => {
    console.log(error || 'NodeJS Eureka Started!');


    // APP
    app.get('/', (req, res) => {
        res.send('Hello from NodeJS Eureka Client\n');
        res.end();
    });

    app.listen(PORT, HOST);
    console.log(`Running on http://${HOST}:${PORT}`);});
 <code>

我想念什么吗?有什么建议吗?或者也许我可以在调试中检查它,看看问题出在哪里?。

0 个答案:

没有答案
相关问题