Skip to content

Commit 1bed777

Browse files
authored
Support proxy to cassandra (#19)
* Add prometheus metrics to gobeansproxy (#15) * Add cassandra support (#17)
1 parent f425dd9 commit 1bed777

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5367
-338
lines changed

.doubanpde/Makefile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
SHELL := /bin/bash
2+
PROJECT_DIR := /home/project
3+
4+
env:
5+
dpi -y -D "-y"
6+
mkdir -p /tmp/gobeansproxy_prefix/proxy/
7+
8+
build:
9+
go build -o gobeansproxy_bin
10+
11+
start-proxy: build
12+
./gobeansproxy_bin -confdir .doubanpde/scripts/bdb/gobeansproxy/prefix-switch-cfg/conf/
13+
14+
start-riven-proxy: build
15+
./gobeansproxy_bin -confdir .doubanpde/scripts/bdb/rivenbeansproxy/conf/
16+
17+
start-proxy-gc-trace: build
18+
GODEBUG=gctrace=1 ./gobeansproxy_bin -confdir .doubanpde/scripts/bdb/gobeansproxy/prefix-switch-cfg/conf/
19+
20+
start-proxy-valgrind: build
21+
G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --error-limit=no --log-file=valgrind.log ./gobeansproxy_bin -confdir .doubanpde/scripts/bdb/gobeansproxy/prefix-switch-cfg/conf/
22+
23+
tail-log:
24+
tail -f /tmp/gobeansproxy_prefix/proxy/*.log
25+
26+
cqlsh:
27+
cqlsh -u cassandra -p cassandra

.doubanpde/pde.yaml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
labels:
5+
app: "gobeansproxy"
6+
createId: "{{ uuid }}"
7+
createdBy: pdectl
8+
createdByUser: wangqiang
9+
runByUser: '{{ .CliArgs.String "username" }}'
10+
runByPdectlVersion: "{{ .CliArgs.App.Version }}"
11+
runnerAddress: "{{ .RunnerAddress }}"
12+
createdTime: "{{ .CreatedTime }}"
13+
pdeVersion: "v0.1.4"
14+
useWebEditor: "false"
15+
webEditorPort: 0
16+
webEditorType: ""
17+
name: "gobeansproxy"
18+
annotations:
19+
pdectl.douban.com/cfg/exec-cmd: '{{ .CliArgs.String "exec-default-cmd" }}'
20+
spec:
21+
containers:
22+
- name: "main"
23+
env:
24+
- name: HOSTNAME
25+
value: "gobeansproxy-main"
26+
- name: SCRIBE_HOST
27+
value: 10.0.2.2
28+
image: "docker.douban/sa/pde-go-cli:latest-1.20-v2"
29+
ports:
30+
volumeMounts:
31+
# mount go path src to container go path
32+
- mountPath: /go/src/
33+
name: go-path-src
34+
# mount code folder
35+
- mountPath: /home/project/
36+
name: code
37+
- mountPath: /root/
38+
name: userhome
39+
- mountPath: '/home/{{ .CliArgs.String "username" }}'
40+
name: userhome
41+
- mountPath: /fuse:rslave
42+
name: fuse
43+
- mountPath: /etc/douban/
44+
name: etc-douban
45+
readOnly: true
46+
- mountPath: /etc/localtime
47+
name: etc-localtime
48+
readOnly: true
49+
- mountPath: /var/run/nscd/
50+
name: var-run-nscd
51+
readOnly: true
52+
workingDir: /home/project
53+
# - name: mc
54+
# image: docker.douban/memcached:latest
55+
# workingDir: /
56+
{{- range (mkSlice 57980 57981 57982 57983) }}
57+
- name: beansdb-{{ . }}
58+
image: docker.douban/platform/gobeansdb:latest
59+
workingDir: /data/
60+
volumeMounts:
61+
- mountPath: /data
62+
name: beansdb-{{ . }}-data-dir
63+
- mountPath: /gobeansdb/default_beansdb_cfg/
64+
name: beansdb-{{ . }}-cfg-dir
65+
{{- end }}
66+
- name: cassandra
67+
image: docker.douban/dba/cassandra:4.1.2
68+
workingDir: /
69+
volumeMounts:
70+
- mountPath: /var/lib/cassandra/
71+
name: cassandra-data-dir
72+
# - mountPath: /tmp/cassandra/
73+
# name: cassandra-cfg
74+
# command:
75+
# - "/bin/bash"
76+
# args:
77+
# - "-c"
78+
# - >
79+
# cp -rfv /tmp/cassandra/cassandra.yaml /etc/cassandra/ &&
80+
# /usr/local/bin/docker-entrypoint.sh cassandra -f
81+
restartPolicy: Never
82+
volumes:
83+
- hostPath:
84+
path: '{{ expandEnvVar "$GOPATH/src" }}'
85+
type: Directory
86+
name: go-path-src
87+
{{- $env := . }}
88+
{{- range (mkSlice 57980 57981 57982 57983) }}
89+
- hostPath:
90+
path: '{{ $env.CliArgs.String "project-dir" }}/.doubanpde/data/beansdb-{{ . }}/'
91+
type: DirectoryOrCreate
92+
name: beansdb-{{ . }}-data-dir
93+
- hostPath:
94+
path: '{{ $env.CliArgs.String "project-dir" }}/.doubanpde/scripts/bdb/gobeansproxy/{{ . }}/conf/'
95+
type: Directory
96+
name: beansdb-{{ . }}-cfg-dir
97+
{{- end }}
98+
- hostPath:
99+
path: '{{ .CliArgs.String "project-dir" }}/.doubanpde/data/cassandra/'
100+
type: DirectoryOrCreate
101+
name: cassandra-data-dir
102+
- hostPath:
103+
path: '{{ .CliArgs.String "project-dir" }}/.doubanpde/scripts/cassandra/'
104+
name: cassandra-cfg
105+
- hostPath:
106+
path: '{{ .CliArgs.String "project-dir" }}'
107+
type: Directory
108+
name: code
109+
- hostPath:
110+
path: '{{ expandEnvVar "$HOME/" }}'
111+
type: Directory
112+
name: userhome
113+
- hostPath:
114+
path: /fuse
115+
type: Directory
116+
name: fuse
117+
- hostPath:
118+
path: /etc/douban/
119+
name: etc-douban
120+
- hostPath:
121+
path: /etc/localtime
122+
name: etc-localtime
123+
- hostPath:
124+
path: /var/run/nscd/
125+
name: var-run-nscd
126+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
hstore:
2+
data:
3+
check_vhash: true
4+
datafile_max_str: 4000M
5+
flush_interval: 60
6+
flush_wake_str: 10M
7+
no_gc_days: 7
8+
hint:
9+
hint_index_interval_str: 32K
10+
hint_merge_interval: 5
11+
hint_no_merged: true
12+
hint_split_cap_str: 1M
13+
htree:
14+
tree_height: 3
15+
local:
16+
home: /data
17+
mc:
18+
body_big_str: 5M
19+
body_c_str: 0K
20+
body_max_str: 50M
21+
flush_max_str: 100M
22+
max_key_len: 250
23+
max_req: 16
24+
server:
25+
accesslog: /tmp/access.log
26+
errorlog: /tmp/error.log
27+
hostname: 127.0.0.1
28+
listen: 0.0.0.0
29+
port: 57980
30+
threads: 4
31+
webport: 57990
32+
zk: 'NO'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
backup:
2+
- 127.0.0.1:57983
3+
main:
4+
- addr: 127.0.0.1:57980
5+
buckets: &id001
6+
- '0'
7+
- '1'
8+
- '2'
9+
- '3'
10+
- '4'
11+
- '5'
12+
- '6'
13+
- '7'
14+
- '8'
15+
- '9'
16+
- a
17+
- b
18+
- c
19+
- d
20+
- e
21+
- f
22+
- addr: 127.0.0.1:57981
23+
buckets: *id001
24+
- addr: 127.0.0.1:57982
25+
buckets: *id001
26+
numbucket: 16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
hstore:
2+
data:
3+
check_vhash: true
4+
datafile_max_str: 4000M
5+
flush_interval: 60
6+
flush_wake_str: 10M
7+
no_gc_days: 7
8+
hint:
9+
hint_index_interval_str: 32K
10+
hint_merge_interval: 5
11+
hint_no_merged: true
12+
hint_split_cap_str: 1M
13+
htree:
14+
tree_height: 3
15+
local:
16+
home: /data
17+
mc:
18+
body_big_str: 5M
19+
body_c_str: 0K
20+
body_max_str: 50M
21+
flush_max_str: 100M
22+
max_key_len: 250
23+
max_req: 16
24+
server:
25+
accesslog: /tmp/access.log
26+
errorlog: /tmp/error.log
27+
hostname: 127.0.0.1
28+
listen: 0.0.0.0
29+
port: 57981
30+
threads: 4
31+
webport: 57991
32+
zk: 'NO'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
backup:
2+
- 127.0.0.1:57983
3+
main:
4+
- addr: 127.0.0.1:57980
5+
buckets: &id001
6+
- '0'
7+
- '1'
8+
- '2'
9+
- '3'
10+
- '4'
11+
- '5'
12+
- '6'
13+
- '7'
14+
- '8'
15+
- '9'
16+
- a
17+
- b
18+
- c
19+
- d
20+
- e
21+
- f
22+
- addr: 127.0.0.1:57981
23+
buckets: *id001
24+
- addr: 127.0.0.1:57982
25+
buckets: *id001
26+
numbucket: 16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
hstore:
2+
data:
3+
check_vhash: true
4+
datafile_max_str: 4000M
5+
flush_interval: 60
6+
flush_wake_str: 10M
7+
no_gc_days: 7
8+
hint:
9+
hint_index_interval_str: 32K
10+
hint_merge_interval: 5
11+
hint_no_merged: true
12+
hint_split_cap_str: 1M
13+
htree:
14+
tree_height: 3
15+
local:
16+
home: /data
17+
mc:
18+
body_big_str: 5M
19+
body_c_str: 0K
20+
body_max_str: 50M
21+
flush_max_str: 100M
22+
max_key_len: 250
23+
max_req: 16
24+
server:
25+
accesslog: /tmp/access.log
26+
errorlog: /tmp/error.log
27+
hostname: 127.0.0.1
28+
listen: 0.0.0.0
29+
port: 57982
30+
threads: 4
31+
webport: 57992
32+
zk: 'NO'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
backup:
2+
- 127.0.0.1:57983
3+
main:
4+
- addr: 127.0.0.1:57980
5+
buckets: &id001
6+
- '0'
7+
- '1'
8+
- '2'
9+
- '3'
10+
- '4'
11+
- '5'
12+
- '6'
13+
- '7'
14+
- '8'
15+
- '9'
16+
- a
17+
- b
18+
- c
19+
- d
20+
- e
21+
- f
22+
- addr: 127.0.0.1:57981
23+
buckets: *id001
24+
- addr: 127.0.0.1:57982
25+
buckets: *id001
26+
numbucket: 16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
hstore:
2+
data:
3+
check_vhash: true
4+
datafile_max_str: 4000M
5+
flush_interval: 60
6+
flush_wake_str: 10M
7+
no_gc_days: 7
8+
hint:
9+
hint_index_interval_str: 32K
10+
hint_merge_interval: 5
11+
hint_no_merged: true
12+
hint_split_cap_str: 1M
13+
htree:
14+
tree_height: 3
15+
local:
16+
home: /data
17+
mc:
18+
body_big_str: 5M
19+
body_c_str: 0K
20+
body_max_str: 50M
21+
flush_max_str: 100M
22+
max_key_len: 250
23+
max_req: 16
24+
server:
25+
accesslog: /tmp/access.log
26+
errorlog: /tmp/error.log
27+
hostname: 127.0.0.1
28+
listen: 0.0.0.0
29+
port: 57983
30+
threads: 4
31+
webport: 57993
32+
zk: 'NO'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
backup:
2+
- 127.0.0.1:57983
3+
main:
4+
- addr: 127.0.0.1:57980
5+
buckets: &id001
6+
- '0'
7+
- '1'
8+
- '2'
9+
- '3'
10+
- '4'
11+
- '5'
12+
- '6'
13+
- '7'
14+
- '8'
15+
- '9'
16+
- a
17+
- b
18+
- c
19+
- d
20+
- e
21+
- f
22+
- addr: 127.0.0.1:57981
23+
buckets: *id001
24+
- addr: 127.0.0.1:57982
25+
buckets: *id001
26+
numbucket: 16

0 commit comments

Comments
 (0)