etcd-spring-app is a Spring Boot 3.4.2 application that integrates with etcd for distributed key-value storage. It uses Docker for containerization and includes a docker-compose configuration for easy setup.
- Spring Boot 3.4.2
- etcd for distributed key-value storage
- Docker & Docker Compose for containerized deployment
- OpenJDK 24 (Slim Bookworm)
Run the build script to package the application:
./build.shStart the application and its dependencies:
./run.sh- Swagger UI: http://localhost:5076/swagger-ui.html
- Actuator HTTP Exchanges: http://localhost:6076/actuator/httpexchanges
The application runs inside Docker containers using docker-compose. Below is the configuration:
services: etcdapp: image: etcdappbuild: ./etcdappcontainer_name: etcdappports: - "5076:5076" - "6076:6076"depends_on: - etcdenvironment: - ETCD_HOST=etcd - ETCD_PORT=2379etcd: image: quay.io/coreos/etcd:v3.5.0command: etcd --advertise-client-urls=http://0.0.0.0:2379 --listen-client-urls=http://0.0.0.0:2379volumes: - ~/volumes/data/etcd:/data.etcdports: - "2379:2379"curl -X 'POST' \ 'http://localhost:5076/api/v2/customers/create' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -d '{ "key": "x", "value": "400"}'curl -X 'GET' \ 'http://localhost:5076/api/v2/customers/find/x' \ -H 'accept: */*'etcd is a distributed key-value store designed for high availability and consistency. It is widely used for:
- Service Discovery – Keeping track of available services and their metadata
- Distributed Locking – Ensuring safe concurrent operations across nodes
- Leader Election – Managing consensus in distributed environments
- Strong Consistency – Uses the Raft consensus algorithm
- Highly Available – Fault-tolerant with cluster replication
- Scalable – Supports distributed deployments
etcd is a powerful tool for managing configurations and coordinating services in microservices architectures.
This project is licensed under MIT License.