cherryETCD

package module
v1.3.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

etcd组件

  • 基于etcd实现发服务和节点集群

Install

Prerequisites
  • GO >= 1.17
Using go get
go get github.com/cherry-game/cherry/components/etcd@latest

Quick Start

import cherryETCD "github.com/cherry-game/cherry/components/etcd"
// 注册etcd组件到discovery
func main() {
    cherryDiscovery.RegisterDiscovery(cherryETCD.New())
}

// 配置profile文件
// 设置"cluster"->"discovery"->"mode"为"etcd"模式
// 设置“cluster”->"etcd"节点相关的参数

{
    "cluster": {
        "discovery": {
            "mode": "etcd",
        },
        "nats": {
        },
        "etcd": {
            "end_points": "dev.com:2379",
            "@end_points": "dev.com:2379,dev1.com:2379",
            "prefix" : "cherry",
            "ttl": 5,
            "dial_timeout": 3,
            "dial_keep_alive_time": 1,
            "dial_keep_alive_timeout": 1,
            "user": "",
            "password": ""
        }
    }
}

example

  • 示例代码待补充

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ETCD

type ETCD struct {
	cdiscovery.DiscoveryDefault
	// contains filtered or unexported fields
}

ETCD etcd方式发现服务

func New

func New() *ETCD

func (*ETCD) Load added in v1.3.4

func (p *ETCD) Load(app cfacade.IApplication)

func (*ETCD) Name

func (p *ETCD) Name() string

func (*ETCD) OnStop

func (p *ETCD) OnStop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL