Skip to content

Instantly share code, notes, and snippets.

View yangl's full-sized avatar
🎯
Focusing

YANGLiiN yangl

🎯
Focusing
View GitHub Profile

目标:

在现有的Share的订阅模式之上,添加一种新的订阅模式Key_Failover。这种订阅模式,可以保证同一个订阅中的多个consumer可以共享订阅同一个partiton;同时又可以保证partiton中的每一个Key对应的消息只被发送到一个consumer。

现状和要解决的问题

现有的订阅模式中,share模式可以对同一个partition中的消息进行共享的消费,可以高效的清除partition的backlog。 但是在很多场景中,顺序性也是很常见的需求。在share模式中,我们不能保证同一个Key对应的消息会被发送到固定的某一个consumer中。每个consumer对消息的顺序性得不到保证。

我们想要在新的订阅模式Key_Failover中,保证同一个订阅中的多个consumer可以共享订阅同一个partiton;同时又可以保证partiton中的每一个Key对应的消息只被发送到一个consumer。

解决方法

apiVersion: v1
kind: Namespace
metadata:
name: elasticsearch
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: es-hq
namespace: elasticsearch
apiVersion: v1
kind: Namespace
metadata:
name: elasticsearch
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: es-kibana
namespace: elasticsearch
@Thakurvaibhav
Thakurvaibhav / es-client.yml
Last active September 28, 2019 19:47
Elasticsearch Client Node Deployment and External Service
apiVersion: v1
kind: Namespace
metadata:
name: elasticsearch
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: es-client
namespace: elasticsearch
@Thakurvaibhav
Thakurvaibhav / es-data.yml
Created September 3, 2018 10:22
Elasticsearch Data Node Stateful Set and Headless Service
apiVersion: v1
kind: Namespace
metadata:
name: elasticsearch
---
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
name: fast
provisioner: kubernetes.io/gce-pd
@Thakurvaibhav
Thakurvaibhav / es-master.yml
Last active November 8, 2018 07:34
Elasticsearch Master Node Deployment and Headless Service
apiVersion: v1
kind: Namespace
metadata:
name: elasticsearch
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: es-master
namespace: elasticsearch
@jolestar
jolestar / etcd_cluster.sh
Last active January 4, 2024 06:48
Run etcd cluster by docker with custom network
docker network create etcd --subnet 172.19.0.0/16
docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \
-name etcd0 \
-advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.19.1.10:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \
Escaper pathEscapers = UrlEscapers.urlPathSegmentEscaper();
Escaper queryEscapers = UrlEscapers.urlFormParameterEscaper();
Escaper fragmentEscaper= UrlEscapers.urlFragmentEscaper();
String path1 = "somePathWithSpace ";
String path2 = "somePathWith中文AndPlus+";
String someKeyword = "someKeywordWith中文AndPlus+AndSpace ";
String someFragment = "someFragmentWithSpace ";
String url = String.format(
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.