From 19419829c1b3dbfefdd5f5616f571e3c78138131 Mon Sep 17 00:00:00 2001 From: spinlock Date: Wed, 14 Dec 2016 17:49:56 +0800 Subject: [PATCH] Makefile: generate default config files --- Makefile | 4 +- config/dashboard.toml | 26 +++++++++++++ config/proxy.toml | 90 +++++++++++++++++++++++++++++++++++++++++++ example/dashboard.py | 2 +- example/proxy.py | 2 +- example/setup.py | 2 +- 6 files changed, 122 insertions(+), 4 deletions(-) create mode 100644 config/dashboard.toml create mode 100644 config/proxy.toml diff --git a/Makefile b/Makefile index 0d242d007..e1b9116ea 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,16 @@ export GO15VENDOREXPERIMENT=1 build-all: codis-server codis-dashboard codis-proxy codis-admin codis-ha codis-fe codis-deps: - @mkdir -p bin && bash version + @mkdir -p bin config && bash version @make --no-print-directory -C vendor/github.com/spinlock/jemalloc-go/ codis-dashboard: codis-deps go build -i -o bin/codis-dashboard ./cmd/dashboard + @./bin/codis-dashboard --default-config > config/dashboard.toml codis-proxy: codis-deps go build -i -o bin/codis-proxy ./cmd/proxy + @./bin/codis-proxy --default-config > config/proxy.toml codis-admin: codis-deps go build -i -o bin/codis-admin ./cmd/admin diff --git a/config/dashboard.toml b/config/dashboard.toml new file mode 100644 index 000000000..d2b3298c6 --- /dev/null +++ b/config/dashboard.toml @@ -0,0 +1,26 @@ + +################################################## +# # +# Codis-Dashboard # +# # +################################################## + +# Set Coordinator, only accept "zookeeper" & "etcd". +coordinator_name = "zookeeper" +coordinator_addr = "127.0.0.1:2181" + +# Set Codis Product Name/Auth. +product_name = "codis-demo" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "0.0.0.0:18080" + +# Set configs for redis sentinel. +sentinel_quorum = 2 +sentinel_parallel_syncs = 1 +sentinel_down_after = "30s" +sentinel_failover_timeout = "5m" +sentinel_notification_script = "" +sentinel_client_reconfig_script = "" + diff --git a/config/proxy.toml b/config/proxy.toml new file mode 100644 index 000000000..72ec2b28c --- /dev/null +++ b/config/proxy.toml @@ -0,0 +1,90 @@ + +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "codis-demo" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "0.0.0.0:11080" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "0.0.0.0:19000" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "" +jodis_addr = "" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "" + +# Set max number of alive sessions. +proxy_max_clients = 1000 + +# Set max offheap memory size. (0 to disable) +proxy_max_offheap_size = "1024mb" + +# Set heap placeholder to reduce GC frequency. +proxy_heap_placeholder = "256mb" + +# Proxy will ping backend redis in a predefined interval. (0 to disable) +backend_ping_period = "5s" + +# Set backend recv buffer size & timeout. +backend_recv_bufsize = "128kb" +backend_recv_timeout = "30s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "30s" + +# Set backend pipeline buffer size. +backend_max_pipeline = 1024 + +# Set backend never read replica groups, default is false +backend_primary_only = false + +# Set backend parallel connections per server +backend_primary_parallel = 1 +backend_replica_parallel = 1 + +# Set backend tcp keepalive period. (0 to disable) +backend_keepalive_period = "75s" + +# If there is no request from client for a long time, the connection will be closed. (0 to disable) +# Set session recv buffer size & timeout. +session_recv_bufsize = "128kb" +session_recv_timeout = "30m" + +# Set session send buffer size & timeout. +session_send_bufsize = "64kb" +session_send_timeout = "30s" + +# Make sure this is higher than the max number of requests for each pipeline request, or your client may be blocked. +# Set session pipeline buffer size. +session_max_pipeline = 512 + +# Set session tcp keepalive period. (0 to disable) +session_keepalive_period = "75s" + +# Set session to be sensitive to failures. Default is false, instead of closing socket, proxy will send an error response to client. +session_break_on_failure = false + +# Set metrics server (such as http://localhost:28000), proxy will report json formatted metrics to specified server in a predefined period. +metrics_report_server = "" +metrics_report_period = "1s" + +# Set influxdb server (such as http://localhost:8086), proxy will report metrics to influxdb. +metrics_report_influxdb_server = "" +metrics_report_influxdb_period = "1s" +metrics_report_influxdb_username = "" +metrics_report_influxdb_password = "" +metrics_report_influxdb_database = "" + diff --git a/example/dashboard.py b/example/dashboard.py index d57d2e810..8b9e37140 100644 --- a/example/dashboard.py +++ b/example/dashboard.py @@ -44,7 +44,7 @@ def _open_config(admin_port, product_name, product_auth=None): children = [] atexit.register(kill_all, children) - product_name = "demo_test" + product_name = "demo-test" product_auth = None children.append(CodisDashboard(18080, product_name, product_auth)) diff --git a/example/proxy.py b/example/proxy.py index 9f1aa10c8..99532e2cc 100644 --- a/example/proxy.py +++ b/example/proxy.py @@ -47,7 +47,7 @@ def _open_config(admin_port, proxy_port, product_name, product_auth=None): children = [] atexit.register(kill_all, children) - product_name = "demo_test" + product_name = "demo-test" product_auth = None for i in range(0, 4): diff --git a/example/setup.py b/example/setup.py index 7ef5a168d..4a616eade 100644 --- a/example/setup.py +++ b/example/setup.py @@ -25,7 +25,7 @@ def codis_admin_proxy(admin_port, args=None): children = [] atexit.register(kill_all, children) - product_name = "demo_test" + product_name = "demo-test" product_auth = None # step 1. setup etcd & codis-server & codis-sentinel