Skip to content

Instantly share code, notes, and snippets.

@kevinz
kevinz / ha_compare.org
Created July 4, 2012 23:03
just a simple table in org-mode,about open source HA solutions.

Comparison between 2 HA solutions

Sloutin 1Slution 2
Compare ItemSUSE LINUX HA EXTENSIONKeepAlived
@kevinz
kevinz / lvs_transp.seq
Created July 5, 2012 14:25
mscgen script for lvs
#MSC for lvs in DR transparent mode
msc{
hscale = "2";
Client,LB,RS,OS;
Client=>Client [ label = "req(oip:oport)"];
Client=>Client [ label = "routeto(LB)"];
Client->LB [ label = "(cip:cport)->(oip:oport)"];
LB=>LB [ label = "iptable->fwmark(dst==oip,dst_port=oport)"];
LB=>LB [ label = "(cip:cport)->(oip:oport)+fwmark"];
@kevinz
kevinz / hello.c
Created July 7, 2012 15:12
hello world netfilter module
#define __KERNEL__
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter_ipv4.h>
#include <linux/skbuff.h>
#include <linux/udp.h>
#include <linux/ip.h>
@kevinz
kevinz / Makefile
Created July 7, 2012 15:13
hello world netfilter module make file
obj-m := hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
//sniffer.c
//To compile : gcc -o sniffer sniffer.c -lpcap
//To run : ./sniffer [interface-name]
#include <pcap.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
@kevinz
kevinz / orgmode example
Created July 19, 2012 07:21
orgmode example
#+AUTHOR: Kevin Zeng
#+Email: kevin.zeng@ericsson.com
#+TODO: TODO(t) IN-PROGRESS(p) WAIT(r) SUSPEND(s) | DONE(d)
#+TAGS: Kevin(k) Tom(o) Laurence(l) Gavin(g)
LVS performance test environment overview
* Purpose
- Make a simple overview page for performance test.
- For better communication.
* Deployment
** LVS in NAT mode
//’Hello World’ v2 netfilter hooks example
//For any packet, get the ip header and check the protocol field
//if the protocol number equal to UDP (17), log in var/log/messages
//default action of module to let all packets through
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/skbuff.h>
@kevinz
kevinz / gist:b027d4c0656a29ea472b
Last active November 13, 2015 08:21
codis 2.8.21 diff
diff -bur /home/vagrant/redis-2.8.21/redis.conf /home/vagrant/redis-2.8.21_codis/redis.conf
--- /home/vagrant/redis-2.8.21/redis.conf 2015-06-04 09:32:24.000000000 +0000
+++ /home/vagrant/redis-2.8.21_codis/redis.conf 2015-11-11 02:45:49.550199788 +0000
@@ -34,7 +34,7 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize no
+daemonize yes