GithubHelp home page GithubHelp logo

universal-it-systems / go-etcd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coreos/go-etcd

0.0 3.0 1.0 3.01 MB

DEPRECATED - please use the official client at https://github.com/coreos/etcd/tree/master/client

License: Apache License 2.0

Go 100.00%

go-etcd's Introduction

go-etcd

GoDoc

DEPRECATED

etcd now has an official Go client, which has a nicer API and better support.

We strongly suggest you use the official Go client instead of go-etcd in your new projects. For existing projects, we suggest you migrate to the official Go client.

Usage

The current version of go-etcd supports etcd v2.0+, if you need support for etcd v0.4 please use go-etcd from the release-0.4 branch.

package main

import (
    "log"

    "github.com/coreos/go-etcd/etcd"
)

func main() {
    machines := []string{"http://127.0.0.1:2379"}
    client := etcd.NewClient(machines)

    if _, err := client.Set("/foo", "bar", 0); err != nil {
        log.Fatal(err)
    }
}

Install

go get github.com/coreos/go-etcd/etcd

Caveat

  1. go-etcd always talks to one member if the member works well. This saves socket resources, and improves efficiency for both client and server side. It doesn't hurt the consistent view of the client because each etcd member has data replication.

  2. go-etcd does round-robin rotation when it fails to connect the member in use. For example, if the member that go-etcd connects to is hard killed, go-etcd will fail on the first attempt with the killed member, and succeed on the second attempt with another member. The default CheckRetry function does 2*machine_number retries before returning error.

  3. The default transport in go-etcd sets 1s DialTimeout and 1s TCP keepalive period. A customized transport could be set by calling Client.SetTransport.

  4. Default go-etcd cannot handle the case that the remote server is SIGSTOPed now. TCP keepalive mechanism doesn't help in this scenario because operating system may still send TCP keep-alive packets. We will improve it, but it is not in high priority because we don't see a solid real-life case which server is stopped but connection is alive.

  5. go-etcd is not thread-safe, and it may have race when switching member or updating cluster.

  6. go-etcd cannot detect whether the member in use is healthy when doing read requests. If the member is isolated from the cluster, go-etcd may retrieve outdated data. We will improve this.

License

See LICENSE file.

go-etcd's People

Contributors

xiang90 avatar derekchiang avatar yichengq avatar philips avatar jonboulle avatar bcwaldon avatar polvi avatar barakmich avatar crackcomm avatar mischief avatar kelseyhightower avatar fgrzadkowski avatar eyakubovich avatar ccding avatar burke avatar bbickerton avatar benbjohnson avatar abourget avatar alberts avatar nemosupremo avatar bi1bfr avatar wojtek-t avatar vaijab avatar tedb avatar shafreeck avatar rjeczalik avatar pquerna avatar patrickbcullen avatar mmlb avatar juliusv avatar

Watchers

James Cloos avatar Antony Ingram avatar  avatar

Forkers

vrosnet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.