spring-boot-etcd


License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

org.zalando
ArtifactId

ArtifactId

spring-boot-etcd
Last Version

Last Version

1.5
Release Date

Release Date

Type

Type

jar
Description

Description

spring-boot-etcd
Project Organization

Project Organization

Zalando SE
Source Code Management

Source Code Management

https://github.com/zalando/spring-boot-etcd

Download spring-boot-etcd

How to add to project

<!-- https://jarcasting.com/artifacts/org.zalando/spring-boot-etcd/ -->
<dependency>
    <groupId>org.zalando</groupId>
    <artifactId>spring-boot-etcd</artifactId>
    <version>1.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.zalando/spring-boot-etcd/
implementation 'org.zalando:spring-boot-etcd:1.5'
// https://jarcasting.com/artifacts/org.zalando/spring-boot-etcd/
implementation ("org.zalando:spring-boot-etcd:1.5")
'org.zalando:spring-boot-etcd:jar:1.5'
<dependency org="org.zalando" name="spring-boot-etcd" rev="1.5">
  <artifact name="spring-boot-etcd" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.zalando', module='spring-boot-etcd', version='1.5')
)
libraryDependencies += "org.zalando" % "spring-boot-etcd" % "1.5"
[org.zalando/spring-boot-etcd "1.5"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-autoconfigure Optional jar
org.springframework.boot : spring-boot-configuration-processor Optional jar
org.springframework : spring-web jar
com.fasterxml.jackson.core : jackson-databind jar

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.8

test (3)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar
org.springframework : spring-test jar
junit : junit jar

Project Modules

There are no modules declared in this project.

spring-boot-etcd

Maven Central Build Status

Purpose

Spring-boot-etcd is a Spring Boot library that provides an etcd client to access and manage key-value pairs stored in an etcd cluster. It's useful out-of-the-box.

Spring-boot-etcd Features

  • provides an interface that includes all the functions featured by the etcd API v2
  • uses either a list of addresses or a DNS SRV record to help you discover the nodes of your etcd cluster
  • includes an automatic update mechanism so that the client can easily connect to nodes in the etcd cluster
  • provides auto-configuration so that you can get started without having to write any code

Inspiration

We created zalando-boot-etcd after discovering that current implementations of the etcd client API don’t provide an automatic update mechanism, or use other libraries like Netty to communicate with the etcd cluster. Also, these implementations are not compatible the version of Netty used by the Cassandra driver.

Getting Started

Use the following Maven dependency to add this library:

<dependency>
  <groupId>org.zalando</groupId>
  <artifactId>zalando-boot-etcd-starter</artifactId>
  <version>RELEASE</version>
</dependency>

You can find the latest version at Maven Central.

Configuration

Configure one of these:

  • the addresses of at least one etcd node, OR
  • the DNS SRV record name for auto-discovery

Do:

zalando.etcd.location=http://etcd-cluster.example.org:2379
zalando.etcd.serviceName=etcd-cluster.example.com

Running It

Then, auto-wire the client into your code:

@Autowired
private EtcdClient etcdClient;

Usage

Start an etcd cluster:

docker run -d -p 2379:2379 -p 2380:2380 \
  --name etcd quay.io/coreos/etcd:v2.0.8 -name etcd0 \
  -advertise-client-urls http://10.170.0.10:2379,http://127.0.0.1:2379 \
  -listen-client-urls http://0.0.0.0:2379,http://127.0.0.1:2379 \
  -initial-advertise-peer-urls http://10.170.0.10:2380 \
  -listen-peer-urls http://0.0.0.0:2380 \
  -initial-cluster-token etcd-cluster \
  -initial-cluster etcd0=http://10.170.0.10:2380 \
  -initial-cluster-state new

Write a small Spring Boot application and add this project as a dependency. Use an autowired field of type EtcdService to inject the service into your bean. Call the methods to retrieve key-value pairs from etcd.

Building

mvn clean install

Deployment

mvn release:prepare release:perform

Contributing

This project accepts contributions from the open-source community, including bug fixes and feature adds.

Before making a contribution, please let us know by posting a comment to the relevant issue. And if you would like to propose a new feature, do start a new issue explaining the feature you’d like to contribute.

Licensing

The MIT License (MIT)

Copyright (c) 2015 Compose, Zalando SE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

org.zalando

Zalando SE

The org page for Zalando, Europe's leading online fashion platform. Visit opensource.zalando.com for project stats.

Versions

Version
1.5
1.4
1.3