codis配置_redis集群方案之Codis-proxy变更

本文介绍了如何配置Codis-proxy作为Redis集群的代理转发应用。内容包括增加proxy的步骤,需要修改的配置参数如product_auth和session_auth,以及如何通过codis-dashboard添加和删除proxy的流程。确保在操作过程中,产品名(product_name)和相关验证信息的一致性,以正确管理 Codis 集群。
摘要由CSDN通过智能技术生成

简介

codis-proxy 是 codis 集群的代理转发的应用,可以通过dashboard对codis-proxy进行操作,codis-proxy上不存储数据,数据都在zookeeper上,。

decba83ffbf189a0b7cb579afff348b1.png

增加 proxy

如果集群设置了密码,需要对应修改的配置文件参数是 product_auth,集群名称 product_name 要一致。session_auth 是 proxy 节点的验证,可以跟其他密码不一样。

配置

使用 codis-proxy 生成默认配置文件

./codis-proxy  --default-config   | tee etc/proxy.toml

修改 product_name 和 product_auth,整个集群的 product 相关信息要保持一致。session_auth 是用于连接的验证,可以跟集群的验证不一样。如果短连接比较多可以调整一下 proxy_max_clients 参数。

###################################################                                                ##                  Codis-Proxy                   ##                                                #################################################### Set Codis Product Name/Auth.product_name = "codis3"product_auth = "h6oewuoaudPgCJRzYg0Uo"# Set auth for client session#   1. product_auth is used for auth validation among codis-dashboard,#      codis-proxy and codis-server.#   2. session_auth is different from product_auth, it requires clients#      to issue AUTH  before processing any other commands.session_auth = "L5SqVOieIOk7IyfYscCJcCdQBtHlK5Uq"# 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#   1. jodis_name is short for jodis_coordinator_name, only accept "zookeeper" & "etcd".#   2. jodis_addr is short for jodis_coordinator_addr#   3. jodis_auth is short for jodis_coordinator_auth, for zookeeper/etcd, "user:password" is accepted.#   4. proxy will be registered as node:#        if jodis_compatible = true (not suggested):#          /zk/codis/db_{PRODUCT_NAME}/proxy-{HASHID} (compatible with Codis2.0)#        or else#          /jodis/{PRODUCT_NAME}/proxy-{HASHID}jodis_name = ""jodis_addr = ""jodis_auth = ""jodis_timeout = "20s"jodis_compatible = false# Set datacenter of proxy.proxy_datacenter = ""# Set max number of alive sessions.proxy_max_clients = 10000# 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 (and clear 'MASTERDOWN' state) 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 = 20480# Set backend never read replica groups, default is falsebackend_primary_only = false# Set backend parallel connections per serverbackend_primary_parallel = 1backend_replica_parallel = 1# Set backend tcp keepalive period. (0 to disable)backend_keepalive_period = "75s"# Set number of databases of backend.backend_number_databases = 16# 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 = 10000# 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 = ""# Set statsd server (such as localhost:8125), proxy will report metrics to statsd.metrics_report_statsd_server = ""metrics_report_statsd_period = "1s"metrics_report_statsd_prefix = ""

启动命令

nohup ./codis-proxy --ncpu=2 --config=./etc/proxy.toml --log=/data/codis/logs/proxy.log --log-level=WARN &
--ncpu 可以指定使用几个 CPU--config 指定配置文件的路径--log 指定日志文件路径--log-devel 指定日志级别
3a82fe2780586a16bc51d1a30ff110a8.png

添加的集群

通过 codis-fe 操作 codis-dashboard 添加 proxy,proxy admin address 的默认地址是:[IP]:11080。

删除 proxy

删除 proxy 的时候,需要先将对应的请求切走了,然后通过 codis-fe 操作 codis-dashboard,点击对应 proxy 后面的减号进行删除,删除后proxy进程就会被关闭掉。

a92c0e7479fece4f7feeff326d2dee3c.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值