egg-eureka
v1.0.2
Published
fetch eureka registry and register egg app to eureka
Downloads
2
Maintainers
Readme
egg-eureka
Polling fetch Eureka registry and get instance info
This plugin runs on agent worker
and will send registry data to app worker when updated
then you could use ctx.app.getInstancesByAppId(appId)
to get instances by certain appId
Install
$ npm i egg-eureka --save
Usage
// {app_root}/config/plugin.js
exports.eureka = {
enable: true,
package: 'egg-eureka'
}
Configuration
// {app_root}/config/config.default.js
exports.eureka = {
instance: {
hostName: 'egg-eureka-app.local',
// secureVipAddress: '',
// vipAddress: '',
homePageUrl: '/', // just path, will automatically join with ip and port or hostname if given
statusPageUrl: '/info', // just path, will automatically join with ip and port or hostname if given
healthCheckUrl: '/health' // just path, will automatically join with ip and port or hostname if given
},
registry: {
server: 'http://localhost:32768/eureka/v2/apps/', // if use eureka cluster, then pass an (Array<url>, or String split by ',') eg: ['eureka1host/path','eureka2/path] or 'eureka1host/path, eureka2host/path'
heartbeatInterval: 5000,
registryFetchInterval: 1000,
//... other config follow eureka-js-client https://github.com/jquatier/eureka-js-client#advanced-configuration-options
}
}
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.