Skip to content

Commit 1941982

Browse files
committed
Makefile: generate default config files
1 parent c85acdc commit 1941982

File tree

6 files changed

+122
-4
lines changed

6 files changed

+122
-4
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ export GO15VENDOREXPERIMENT=1
55
build-all: codis-server codis-dashboard codis-proxy codis-admin codis-ha codis-fe
66

77
codis-deps:
8-
@mkdir -p bin && bash version
8+
@mkdir -p bin config && bash version
99
@make --no-print-directory -C vendor/github.com/spinlock/jemalloc-go/
1010

1111
codis-dashboard: codis-deps
1212
go build -i -o bin/codis-dashboard ./cmd/dashboard
13+
@./bin/codis-dashboard --default-config > config/dashboard.toml
1314

1415
codis-proxy: codis-deps
1516
go build -i -o bin/codis-proxy ./cmd/proxy
17+
@./bin/codis-proxy --default-config > config/proxy.toml
1618

1719
codis-admin: codis-deps
1820
go build -i -o bin/codis-admin ./cmd/admin

config/dashboard.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
##################################################
3+
# #
4+
# Codis-Dashboard #
5+
# #
6+
##################################################
7+
8+
# Set Coordinator, only accept "zookeeper" & "etcd".
9+
coordinator_name = "zookeeper"
10+
coordinator_addr = "127.0.0.1:2181"
11+
12+
# Set Codis Product Name/Auth.
13+
product_name = "codis-demo"
14+
product_auth = ""
15+
16+
# Set bind address for admin(rpc), tcp only.
17+
admin_addr = "0.0.0.0:18080"
18+
19+
# Set configs for redis sentinel.
20+
sentinel_quorum = 2
21+
sentinel_parallel_syncs = 1
22+
sentinel_down_after = "30s"
23+
sentinel_failover_timeout = "5m"
24+
sentinel_notification_script = ""
25+
sentinel_client_reconfig_script = ""
26+

config/proxy.toml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
##################################################
3+
# #
4+
# Codis-Proxy #
5+
# #
6+
##################################################
7+
8+
# Set Codis Product Name/Auth.
9+
product_name = "codis-demo"
10+
product_auth = ""
11+
12+
# Set bind address for admin(rpc), tcp only.
13+
admin_addr = "0.0.0.0:11080"
14+
15+
# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
16+
proto_type = "tcp4"
17+
proxy_addr = "0.0.0.0:19000"
18+
19+
# Set jodis address & session timeout, only accept "zookeeper" & "etcd".
20+
jodis_name = ""
21+
jodis_addr = ""
22+
jodis_timeout = "20s"
23+
jodis_compatible = false
24+
25+
# Set datacenter of proxy.
26+
proxy_datacenter = ""
27+
28+
# Set max number of alive sessions.
29+
proxy_max_clients = 1000
30+
31+
# Set max offheap memory size. (0 to disable)
32+
proxy_max_offheap_size = "1024mb"
33+
34+
# Set heap placeholder to reduce GC frequency.
35+
proxy_heap_placeholder = "256mb"
36+
37+
# Proxy will ping backend redis in a predefined interval. (0 to disable)
38+
backend_ping_period = "5s"
39+
40+
# Set backend recv buffer size & timeout.
41+
backend_recv_bufsize = "128kb"
42+
backend_recv_timeout = "30s"
43+
44+
# Set backend send buffer & timeout.
45+
backend_send_bufsize = "128kb"
46+
backend_send_timeout = "30s"
47+
48+
# Set backend pipeline buffer size.
49+
backend_max_pipeline = 1024
50+
51+
# Set backend never read replica groups, default is false
52+
backend_primary_only = false
53+
54+
# Set backend parallel connections per server
55+
backend_primary_parallel = 1
56+
backend_replica_parallel = 1
57+
58+
# Set backend tcp keepalive period. (0 to disable)
59+
backend_keepalive_period = "75s"
60+
61+
# If there is no request from client for a long time, the connection will be closed. (0 to disable)
62+
# Set session recv buffer size & timeout.
63+
session_recv_bufsize = "128kb"
64+
session_recv_timeout = "30m"
65+
66+
# Set session send buffer size & timeout.
67+
session_send_bufsize = "64kb"
68+
session_send_timeout = "30s"
69+
70+
# Make sure this is higher than the max number of requests for each pipeline request, or your client may be blocked.
71+
# Set session pipeline buffer size.
72+
session_max_pipeline = 512
73+
74+
# Set session tcp keepalive period. (0 to disable)
75+
session_keepalive_period = "75s"
76+
77+
# Set session to be sensitive to failures. Default is false, instead of closing socket, proxy will send an error response to client.
78+
session_break_on_failure = false
79+
80+
# Set metrics server (such as http://localhost:28000), proxy will report json formatted metrics to specified server in a predefined period.
81+
metrics_report_server = ""
82+
metrics_report_period = "1s"
83+
84+
# Set influxdb server (such as http://localhost:8086), proxy will report metrics to influxdb.
85+
metrics_report_influxdb_server = ""
86+
metrics_report_influxdb_period = "1s"
87+
metrics_report_influxdb_username = ""
88+
metrics_report_influxdb_password = ""
89+
metrics_report_influxdb_database = ""
90+

example/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _open_config(admin_port, product_name, product_auth=None):
4444
children = []
4545
atexit.register(kill_all, children)
4646

47-
product_name = "demo_test"
47+
product_name = "demo-test"
4848
product_auth = None
4949

5050
children.append(CodisDashboard(18080, product_name, product_auth))

example/proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _open_config(admin_port, proxy_port, product_name, product_auth=None):
4747
children = []
4848
atexit.register(kill_all, children)
4949

50-
product_name = "demo_test"
50+
product_name = "demo-test"
5151
product_auth = None
5252

5353
for i in range(0, 4):

example/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def codis_admin_proxy(admin_port, args=None):
2525
children = []
2626
atexit.register(kill_all, children)
2727

28-
product_name = "demo_test"
28+
product_name = "demo-test"
2929
product_auth = None
3030

3131
# step 1. setup etcd & codis-server & codis-sentinel

0 commit comments

Comments
 (0)