consul-cache

module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: LGPL-2.1

README

consul-cache

golang-ci

consul-cache is a local cache disguised as consul agent and has stronger performance.

Purpose

In the consul cluster, when the app initiates a watch request, the consul agent will forward the request to the consul server, which will put a huge burden on the consul server. The purpose of consul-cache is to separate this burden from the consul server.

Architecture

consul-cache has 2 components.

fetcher

Discover service changes from consul and build all instances corresponding to the service in Redis

cache

cache disguises itself as a consul agent to facilitate service discovery by business programs

Architecture

Quick Start with Docker compose

Switch to directory docker_compose

cd docker_compose
start
docker-compose up -d
stop
docker-compose down
Register and Discover

refer to this document

Register through consul client
curl -X PUT --data @payload.json \
http://localhost:18550/v1/agent/service/register
Discover through consul-cache
curl 'http://localhost:18500/v1/health/service/web?dc=dc1&passing=true'

Directories

Path Synopsis
cmd
internal
biz
log

Jump to

Keyboard shortcuts

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