From 33fd9a8c13a0ef140a75ed1f69c304188ecdbce0 Mon Sep 17 00:00:00 2001 From: spinlock Date: Thu, 10 Nov 2016 11:37:13 +0800 Subject: [PATCH] deploy: update scripts --- deploy/products/alpha/.gitignore | 1 + deploy/products/alpha/Makefile | 2 +- deploy/products/alpha/config.json | 24 +----- deploy/products/alpha/gen.py | 35 ++++++++ deploy/products/alpha/render.py | 7 +- deploy/products/beta/.gitignore | 1 + deploy/products/beta/Makefile | 2 +- deploy/products/beta/config.json | 43 ++-------- deploy/products/beta/gen.py | 41 +++++++++ deploy/products/beta/render.py | 7 +- .../codis_proxy_19002.service | 9 ++ .../codis/etc/10.2.16.200_19002/proxy.toml | 86 +++++++++++++++++++ .../codis/etc/10.2.16.200_19002/proxy_admin | 3 + .../codis_proxy_19002.service | 9 ++ .../codis/etc/10.2.16.201_19002/proxy.toml | 86 +++++++++++++++++++ .../codis/etc/10.2.16.201_19002/proxy_admin | 3 + .../codis_proxy_19002.service | 9 ++ .../codis/etc/10.2.16.202_19002/proxy.toml | 86 +++++++++++++++++++ .../codis/etc/10.2.16.202_19002/proxy_admin | 3 + .../codis/etc/10.4.10.100_18080/foreach_proxy | 5 ++ .../10.4.10.100_18080/foreach_proxy_online | 5 ++ .../10.4.10.100_18080/foreach_proxy_reinit | 5 ++ .../codis_proxy_19002.service | 9 ++ .../codis/etc/10.4.10.200_19002/proxy.toml | 86 +++++++++++++++++++ .../codis/etc/10.4.10.200_19002/proxy_admin | 3 + .../codis_proxy_19002.service | 9 ++ .../codis/etc/10.4.10.201_19002/proxy.toml | 86 +++++++++++++++++++ .../codis/etc/10.4.10.201_19002/proxy_admin | 3 + 28 files changed, 606 insertions(+), 62 deletions(-) create mode 100644 deploy/products/alpha/.gitignore create mode 100755 deploy/products/alpha/gen.py create mode 100644 deploy/products/beta/.gitignore create mode 100755 deploy/products/beta/gen.py create mode 100644 deploy/root/opt/codis/etc/10.2.16.200_19002/codis_proxy_19002.service create mode 100644 deploy/root/opt/codis/etc/10.2.16.200_19002/proxy.toml create mode 100755 deploy/root/opt/codis/etc/10.2.16.200_19002/proxy_admin create mode 100644 deploy/root/opt/codis/etc/10.2.16.201_19002/codis_proxy_19002.service create mode 100644 deploy/root/opt/codis/etc/10.2.16.201_19002/proxy.toml create mode 100755 deploy/root/opt/codis/etc/10.2.16.201_19002/proxy_admin create mode 100644 deploy/root/opt/codis/etc/10.2.16.202_19002/codis_proxy_19002.service create mode 100644 deploy/root/opt/codis/etc/10.2.16.202_19002/proxy.toml create mode 100755 deploy/root/opt/codis/etc/10.2.16.202_19002/proxy_admin create mode 100644 deploy/root/opt/codis/etc/10.4.10.200_19002/codis_proxy_19002.service create mode 100644 deploy/root/opt/codis/etc/10.4.10.200_19002/proxy.toml create mode 100755 deploy/root/opt/codis/etc/10.4.10.200_19002/proxy_admin create mode 100644 deploy/root/opt/codis/etc/10.4.10.201_19002/codis_proxy_19002.service create mode 100644 deploy/root/opt/codis/etc/10.4.10.201_19002/proxy.toml create mode 100755 deploy/root/opt/codis/etc/10.4.10.201_19002/proxy_admin diff --git a/deploy/products/alpha/.gitignore b/deploy/products/alpha/.gitignore new file mode 100644 index 000000000..a2f0e2e19 --- /dev/null +++ b/deploy/products/alpha/.gitignore @@ -0,0 +1 @@ +instance.json diff --git a/deploy/products/alpha/Makefile b/deploy/products/alpha/Makefile index 320fccfb8..ef7e83251 100644 --- a/deploy/products/alpha/Makefile +++ b/deploy/products/alpha/Makefile @@ -1,2 +1,2 @@ all: - ./render.py + ./gen.py && ./render.py diff --git a/deploy/products/alpha/config.json b/deploy/products/alpha/config.json index 1bcb0c192..f161418a9 100644 --- a/deploy/products/alpha/config.json +++ b/deploy/products/alpha/config.json @@ -10,25 +10,9 @@ "sentinel_quorum": 2 }, "proxy": { - "template": { - "min_cpu": 4, - "max_cpu": 8, - "max_clients": 10000, - "max_pipeline": 1024 - }, - "instance": [ - { - "admin_addr": "127.0.0.1:11080", - "proxy_addr": "127.0.0.1:19000" - }, - { - "admin_addr": "127.0.0.1:11081", - "proxy_addr": "127.0.0.1:19001" - }, - { - "admin_addr": "127.0.0.1:11082", - "proxy_addr": "127.0.0.1:19002" - } - ] + "min_cpu": 4, + "max_cpu": 8, + "max_clients": 10000, + "max_pipeline": 1024 } } diff --git a/deploy/products/alpha/gen.py b/deploy/products/alpha/gen.py new file mode 100755 index 000000000..5b5ce4033 --- /dev/null +++ b/deploy/products/alpha/gen.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import json + +proxy = { + "": [ + "127.0.0.1", + ] + } + +proxy_list = [] + +for dc, ip_list in proxy.items(): + for ip in ip_list: + for i in [0, 1, 2]: + proxy_list.append({ + "datacenter": dc, + "admin_addr": "{}:{}".format(ip, 11080 + i), + "proxy_addr": "{}:{}".format(ip, 19000 + i), + }) + +with open("instance.json", 'w+') as f: + f.write(json.dumps(proxy_list, indent=4)) + +for x in proxy: + print("[{}]:".format(x)) + proxy_addr = "" + for p in proxy_list: + if p["datacenter"] == x: + if len(proxy_addr) != 0: + proxy_addr += "," + proxy_addr += p["proxy_addr"] + print(proxy_addr) + print("\n") + diff --git a/deploy/products/alpha/render.py b/deploy/products/alpha/render.py index f272b864e..f6dd86c80 100755 --- a/deploy/products/alpha/render.py +++ b/deploy/products/alpha/render.py @@ -188,8 +188,8 @@ def __init__(self, config): self.proxylist = [] if "proxy" in config: - template = Template(config["proxy"].get("template", {})) - for p in config["proxy"].get("instance", []): + template = Template(config.get("proxy", {})) + for p in config.get("instance", []): self.proxylist.append(Proxy(self, template, p)) self.proxylist.sort(key=lambda p: p.datacenter + "|" + p.proxy_addr) @@ -204,5 +204,8 @@ def render(self): with open('config.json') as f: config = json.loads(f.read()) +with open('instance.json') as f: + config["instance"] = json.loads(f.read()) + product = Product(config) product.render() diff --git a/deploy/products/beta/.gitignore b/deploy/products/beta/.gitignore new file mode 100644 index 000000000..a2f0e2e19 --- /dev/null +++ b/deploy/products/beta/.gitignore @@ -0,0 +1 @@ +instance.json diff --git a/deploy/products/beta/Makefile b/deploy/products/beta/Makefile index 320fccfb8..ef7e83251 100644 --- a/deploy/products/beta/Makefile +++ b/deploy/products/beta/Makefile @@ -1,2 +1,2 @@ all: - ./render.py + ./gen.py && ./render.py diff --git a/deploy/products/beta/config.json b/deploy/products/beta/config.json index ea6f8619b..65671ed97 100644 --- a/deploy/products/beta/config.json +++ b/deploy/products/beta/config.json @@ -15,41 +15,12 @@ "sentinel_quorum": 2 }, "proxy": { - "template": { - "min_cpu": 4, - "max_cpu": 8, - "max_clients": 2000, - "max_pipeline": 512, - "log_level": "WARN", - "jodis_name": "zookeeper", - "jodis_addr": "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" - }, - "instance": [ - { - "datacenter": "dc1", - "admin_addr": "10.4.10.200:11080", - "proxy_addr": "10.4.10.200:19000" - }, - { - "datacenter": "dc1", - "admin_addr": "10.4.10.201:11080", - "proxy_addr": "10.4.10.201:19000" - }, - { - "datacenter": "dc2", - "admin_addr": "10.2.16.200:11080", - "proxy_addr": "10.2.16.200:19000" - }, - { - "datacenter": "dc2", - "admin_addr": "10.2.16.201:11080", - "proxy_addr": "10.2.16.201:19000" - }, - { - "datacenter": "dc2", - "admin_addr": "10.2.16.202:11080", - "proxy_addr": "10.2.16.202:19000" - } - ] + "min_cpu": 4, + "max_cpu": 8, + "max_clients": 2000, + "max_pipeline": 512, + "log_level": "WARN", + "jodis_name": "zookeeper", + "jodis_addr": "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" } } diff --git a/deploy/products/beta/gen.py b/deploy/products/beta/gen.py new file mode 100755 index 000000000..8c3b9319d --- /dev/null +++ b/deploy/products/beta/gen.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import json + +proxy = { + "dc1": [ + "10.4.10.200", + "10.4.10.201", + ], + "dc2":[ + "10.2.16.200", + "10.2.16.201", + "10.2.16.202", + ], + } + +proxy_list = [] + +for dc, ip_list in proxy.items(): + for ip in ip_list: + for i in [0, 2]: + proxy_list.append({ + "datacenter": dc, + "admin_addr": "{}:{}".format(ip, 11080 + i), + "proxy_addr": "{}:{}".format(ip, 19000 + i), + }) + +with open("instance.json", 'w+') as f: + f.write(json.dumps(proxy_list, indent=4)) + +for x in proxy: + print("[{}]:".format(x)) + proxy_addr = "" + for p in proxy_list: + if p["datacenter"] == x: + if len(proxy_addr) != 0: + proxy_addr += "," + proxy_addr += p["proxy_addr"] + print(proxy_addr) + print("\n") + diff --git a/deploy/products/beta/render.py b/deploy/products/beta/render.py index f272b864e..f6dd86c80 100755 --- a/deploy/products/beta/render.py +++ b/deploy/products/beta/render.py @@ -188,8 +188,8 @@ def __init__(self, config): self.proxylist = [] if "proxy" in config: - template = Template(config["proxy"].get("template", {})) - for p in config["proxy"].get("instance", []): + template = Template(config.get("proxy", {})) + for p in config.get("instance", []): self.proxylist.append(Proxy(self, template, p)) self.proxylist.sort(key=lambda p: p.datacenter + "|" + p.proxy_addr) @@ -204,5 +204,8 @@ def render(self): with open('config.json') as f: config = json.loads(f.read()) +with open('instance.json') as f: + config["instance"] = json.loads(f.read()) + product = Product(config) product.render() diff --git a/deploy/root/opt/codis/etc/10.2.16.200_19002/codis_proxy_19002.service b/deploy/root/opt/codis/etc/10.2.16.200_19002/codis_proxy_19002.service new file mode 100644 index 000000000..349fbefc7 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.200_19002/codis_proxy_19002.service @@ -0,0 +1,9 @@ +[Unit] +Description=Codis-[demo-beta]@19002 +[Service] +ExecStart=/opt/codis/bin/codis-proxy --ncpu=4 --max-ncpu=8 \ + --config=/opt/codis/etc/10.2.16.200:19002/proxy.toml --log=/opt/codis/log/10.2.16.200:19002/proxy.log --log-level=WARN +Restart=always +[Install] +WantedBy=default.target + diff --git a/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy.toml b/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy.toml new file mode 100644 index 000000000..74cedb3af --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy.toml @@ -0,0 +1,86 @@ +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "demo-beta" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "10.2.16.200:11082" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "10.2.16.200:19002" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "zookeeper" +jodis_addr = "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "dc2" + +# Set max number of alive sessions. +proxy_max_clients = 2000 + +# 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 = "50s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "50s" + +# 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 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/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy_admin b/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy_admin new file mode 100755 index 000000000..dc8ddb529 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.200_19002/proxy_admin @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/opt/codis/bin/codis-admin --proxy=10.2.16.200:11082 $@ diff --git a/deploy/root/opt/codis/etc/10.2.16.201_19002/codis_proxy_19002.service b/deploy/root/opt/codis/etc/10.2.16.201_19002/codis_proxy_19002.service new file mode 100644 index 000000000..fcb078752 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.201_19002/codis_proxy_19002.service @@ -0,0 +1,9 @@ +[Unit] +Description=Codis-[demo-beta]@19002 +[Service] +ExecStart=/opt/codis/bin/codis-proxy --ncpu=4 --max-ncpu=8 \ + --config=/opt/codis/etc/10.2.16.201:19002/proxy.toml --log=/opt/codis/log/10.2.16.201:19002/proxy.log --log-level=WARN +Restart=always +[Install] +WantedBy=default.target + diff --git a/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy.toml b/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy.toml new file mode 100644 index 000000000..d967a5809 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy.toml @@ -0,0 +1,86 @@ +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "demo-beta" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "10.2.16.201:11082" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "10.2.16.201:19002" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "zookeeper" +jodis_addr = "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "dc2" + +# Set max number of alive sessions. +proxy_max_clients = 2000 + +# 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 = "50s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "50s" + +# 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 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/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy_admin b/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy_admin new file mode 100755 index 000000000..17705ed90 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.201_19002/proxy_admin @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/opt/codis/bin/codis-admin --proxy=10.2.16.201:11082 $@ diff --git a/deploy/root/opt/codis/etc/10.2.16.202_19002/codis_proxy_19002.service b/deploy/root/opt/codis/etc/10.2.16.202_19002/codis_proxy_19002.service new file mode 100644 index 000000000..ad2510b35 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.202_19002/codis_proxy_19002.service @@ -0,0 +1,9 @@ +[Unit] +Description=Codis-[demo-beta]@19002 +[Service] +ExecStart=/opt/codis/bin/codis-proxy --ncpu=4 --max-ncpu=8 \ + --config=/opt/codis/etc/10.2.16.202:19002/proxy.toml --log=/opt/codis/log/10.2.16.202:19002/proxy.log --log-level=WARN +Restart=always +[Install] +WantedBy=default.target + diff --git a/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy.toml b/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy.toml new file mode 100644 index 000000000..23b4bee3a --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy.toml @@ -0,0 +1,86 @@ +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "demo-beta" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "10.2.16.202:11082" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "10.2.16.202:19002" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "zookeeper" +jodis_addr = "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "dc2" + +# Set max number of alive sessions. +proxy_max_clients = 2000 + +# 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 = "50s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "50s" + +# 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 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/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy_admin b/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy_admin new file mode 100755 index 000000000..e220f4d1f --- /dev/null +++ b/deploy/root/opt/codis/etc/10.2.16.202_19002/proxy_admin @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/opt/codis/bin/codis-admin --proxy=10.2.16.202:11082 $@ diff --git a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy index b2185145b..cf44d3d63 100755 --- a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy +++ b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy @@ -1,8 +1,13 @@ #!/usr/bin/env bash /opt/codis/bin/codis-admin --proxy=10.4.10.200:11080 $@ +/opt/codis/bin/codis-admin --proxy=10.4.10.200:11082 $@ /opt/codis/bin/codis-admin --proxy=10.4.10.201:11080 $@ +/opt/codis/bin/codis-admin --proxy=10.4.10.201:11082 $@ /opt/codis/bin/codis-admin --proxy=10.2.16.200:11080 $@ +/opt/codis/bin/codis-admin --proxy=10.2.16.200:11082 $@ /opt/codis/bin/codis-admin --proxy=10.2.16.201:11080 $@ +/opt/codis/bin/codis-admin --proxy=10.2.16.201:11082 $@ /opt/codis/bin/codis-admin --proxy=10.2.16.202:11080 $@ +/opt/codis/bin/codis-admin --proxy=10.2.16.202:11082 $@ diff --git a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_online b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_online index 06a8ff6cb..8c84d016b 100755 --- a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_online +++ b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_online @@ -1,8 +1,13 @@ #!/usr/bin/env bash /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.4.10.200:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.4.10.200:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.4.10.201:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.4.10.201:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.200:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.200:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.201:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.201:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.202:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --online-proxy --addr=10.2.16.202:11082 diff --git a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_reinit b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_reinit index a9d6865dd..e6ff32c72 100755 --- a/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_reinit +++ b/deploy/root/opt/codis/etc/10.4.10.100_18080/foreach_proxy_reinit @@ -1,8 +1,13 @@ #!/usr/bin/env bash /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.4.10.200:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.4.10.200:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.4.10.201:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.4.10.201:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.200:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.200:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.201:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.201:11082 /opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.202:11080 +/opt/codis/bin/codis-admin --dashboard=10.4.10.100:18080 --reinit-proxy --addr=10.2.16.202:11082 diff --git a/deploy/root/opt/codis/etc/10.4.10.200_19002/codis_proxy_19002.service b/deploy/root/opt/codis/etc/10.4.10.200_19002/codis_proxy_19002.service new file mode 100644 index 000000000..abaa2ced2 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.200_19002/codis_proxy_19002.service @@ -0,0 +1,9 @@ +[Unit] +Description=Codis-[demo-beta]@19002 +[Service] +ExecStart=/opt/codis/bin/codis-proxy --ncpu=4 --max-ncpu=8 \ + --config=/opt/codis/etc/10.4.10.200:19002/proxy.toml --log=/opt/codis/log/10.4.10.200:19002/proxy.log --log-level=WARN +Restart=always +[Install] +WantedBy=default.target + diff --git a/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy.toml b/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy.toml new file mode 100644 index 000000000..272d40aba --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy.toml @@ -0,0 +1,86 @@ +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "demo-beta" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "10.4.10.200:11082" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "10.4.10.200:19002" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "zookeeper" +jodis_addr = "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "dc1" + +# Set max number of alive sessions. +proxy_max_clients = 2000 + +# 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 = "50s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "50s" + +# 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 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/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy_admin b/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy_admin new file mode 100755 index 000000000..1c5b29786 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.200_19002/proxy_admin @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/opt/codis/bin/codis-admin --proxy=10.4.10.200:11082 $@ diff --git a/deploy/root/opt/codis/etc/10.4.10.201_19002/codis_proxy_19002.service b/deploy/root/opt/codis/etc/10.4.10.201_19002/codis_proxy_19002.service new file mode 100644 index 000000000..ae1347874 --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.201_19002/codis_proxy_19002.service @@ -0,0 +1,9 @@ +[Unit] +Description=Codis-[demo-beta]@19002 +[Service] +ExecStart=/opt/codis/bin/codis-proxy --ncpu=4 --max-ncpu=8 \ + --config=/opt/codis/etc/10.4.10.201:19002/proxy.toml --log=/opt/codis/log/10.4.10.201:19002/proxy.log --log-level=WARN +Restart=always +[Install] +WantedBy=default.target + diff --git a/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy.toml b/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy.toml new file mode 100644 index 000000000..3e1946f5e --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy.toml @@ -0,0 +1,86 @@ +################################################## +# # +# Codis-Proxy # +# # +################################################## + +# Set Codis Product Name/Auth. +product_name = "demo-beta" +product_auth = "" + +# Set bind address for admin(rpc), tcp only. +admin_addr = "10.4.10.201:11082" + +# Set bind address for proxy, proto_type can be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". +proto_type = "tcp4" +proxy_addr = "10.4.10.201:19002" + +# Set jodis address & session timeout, only accept "zookeeper" & "etcd". +jodis_name = "zookeeper" +jodis_addr = "10.4.10.101:2181,10.4.10.102:2181,10.4.10.103:2181,10.4.10.104:2181,10.4.10.105:2181" +jodis_timeout = "20s" +jodis_compatible = false + +# Set datacenter of proxy. +proxy_datacenter = "dc1" + +# Set max number of alive sessions. +proxy_max_clients = 2000 + +# 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 = "50s" + +# Set backend send buffer & timeout. +backend_send_bufsize = "128kb" +backend_send_timeout = "50s" + +# 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 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/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy_admin b/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy_admin new file mode 100755 index 000000000..d84fdbc1d --- /dev/null +++ b/deploy/root/opt/codis/etc/10.4.10.201_19002/proxy_admin @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/opt/codis/bin/codis-admin --proxy=10.4.10.201:11082 $@