1.2.4 • Published 8 months ago

egg-etcd-discovery v1.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

egg-etcd-discovery

provides egg bindings for the etcd.

npm download NPM version GitHub issues GitHub

Install

$ npm i egg-etcd-discovery --save

Usage

// {app_root}/config/plugin.ts
{
  enable: true,
  package: 'egg-etcd-discovery',
}

/** 
 * get server
 * @param string serverName
 * @return {name: string, ip: string, weight: number}
 * /
this.app.etcd.getNextServer(serverName);

see lib/discovery/controller.ts for more detail.

Configuration

// {app_root}/config/config.default.ts
exports.eggEtcdDiscovery = {

    options:{
        hosts: [
            '172.17.0.1:2379', '172.17.0.2:2379', '172.17.0.3:2379'
        ],
        dialTimeout: 5000
    },

    leaseTTL: 5,

    projectName: 'etcd',
    serverName: 'accountServer',
    nodeName: 'node-01',
    protocol: 'http',
    
    serverIp: 'localhost:8080',
    serverWeight: 1,
};

see config/config.default.ts for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

1.2.4

8 months ago

1.2.0

9 months ago

1.2.3

9 months ago

1.2.1

9 months ago

1.1.10-pre2

11 months ago

1.1.10

11 months ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago