Skip to content

Instantly share code, notes, and snippets.

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@kevinclcn
kevinclcn / gophers.txt
Created February 3, 2019 07:25
golang gopher logos
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/7TH_BIRTHDAY.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/ASHLEY_STEVE.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Azure_Bit_Gopher.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Azure_Gophers.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/BATMAN_GOPHER.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/BELGIUM.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/BLUE_GLASSES_GOPHER.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/BLUE_GOPHER.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/BUFFALO_CASTS.png
https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Biker_Gopher.png
@kevinclcn
kevinclcn / LC_CTYPE.txt
Created February 22, 2019 10:28 — forked from ibrahimlawal/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@kevinclcn
kevinclcn / benchmark+go+nginx.md
Created July 26, 2019 05:18
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@kevinclcn
kevinclcn / shell_tips.sh
Last active October 11, 2019 14:11
shell使用技巧
# 遍历一个数字范围, https://stackoverflow.com/questions/169511/how-do-i-iterate-over-a-range-of-numbers-defined-by-variables-in-bash
for i in $(seq 1 $END); do echo $i; done
# 枚举多台机器上的java堆栈
for i in $(seq 204 231); do ssh 192.168.12.$i "ls -lh /opt/log/stash/customer/java_pid1.hprof"; done
# 使用sed做替换
gsed -i -e 's/\(FROM .*alpine-openjdk8[^:]*\)$/\1:8u221/g' */*/Dockerfile
# 使用ruby处理json行, 并设定encoding