Carry の Blog Carry の Blog
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Carry の Blog

好记性不如烂键盘
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • MySQL

  • Redis

    • 安装配置
    • Redis 集群部署
    • redis大key分析
    • Redis手动进行主从切换
    • Redis集群添加节点之后数据重新均匀分配
    • Redis槽位slot解读
    • redis新增节点slot迁移报错故障修复
    • Redis集群的创建、剔除节点与新增节点操作过程
    • redis抓包分析脚本
    • Redis配置文件解读
    • redis cluster压测
    • redis慢查询告警脚本
    • Redis 的可用内存过高时的自动驱逐 key 策略详解
  • Keydb

  • TiDB

  • MongoDB

  • Elasticsearch

  • Kafka

  • victoriametrics

  • BigData

  • Sqlserver

  • 数据库
  • Redis
Carry の Blog
2022-03-10

Redis 集群部署

# redis 集群 python 部署

环境

10.10.10.48
10.10.10.49
10.10.10.50
1
2
3

安装

yum install python-pip -y
pip install --upgrade pip
pip install tqdm
wget http://download.redis.io/releases/redis-5.0.9.tar.gz -P /opt
openssl rand -base64 20  	#随机生成密码
python rediscluster_install.py  -a passwdxxx -p 7001,7002 -h 10.10.10.48 
systemctl status redis7001.service
systemctl status redis7002.service
1
2
3
4
5
6
7
8

配置文件

egrep -v "^$|^#" redis7001.conf 
port 7001
bind 10.10.10.48
cluster-enabled yes
cluster-config-file /data/redis7001/redis_nodes.conf
cluster-node-timeout 15000
appendonly yes
maxclients 100000
maxmemory 0
dir /data/redis7001
repl-backlog-size 200m
tcp-backlog 1024
logfile /data/redis7001/redis_server_7001.log
pidfile /data/redis7001/redis_7001.pid
daemonize yes
rename-command CONFIG "ADMIN_CONFIG"
rename-command SHUTDOWN "ADMIN_SHUTDOWN"
rename-command FLUSHALL "ADMIN_FLUSHALL"
rename-command FLUSHDB "ADMIN_FLUSHDB"
rename-command KEYS ""
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave  0 0 0
client-output-buffer-limit pubsub 32mb 8mb 60
masterauth passwdxxx
requirepass passwdxxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

检查集群

redis-cli -c -a passwdxxx -h 10.10.10.50 -p 7001 cluster nodes
redis-cli -c -a passwdxxx -h 10.10.10.50 -p 7001 admin_config get maxclients
redis-cli -c -a passwdxxx -h 10.10.10.50 -p 7001 --cluster check 10.10.10.49:7002
1
2
3

集群登录:

/usr/local/redis/src/redis-cli -a passwdxxx -h 172.16.17.80 -p 8002 -c
1

加入集群:

redis-cli -a passwdxxx --cluster create 10.10.10.48:7001 10.10.10.49:7001 10.10.10.50:7001 10.10.10.48:7002 10.10.10.49:7002 10.10.10.50:7002 --cluster-replicas 1
1

新增节点:

/usr/local/redis/bin/redis-cli  -a xxxxxxxxxxxxxxxxx -p 7001 --cluster add-node  10.10.12.149:7002  10.10.12.151:7001  --cluster-slave 
1

剔除节点:

redis-cli --cluster del-node 10.10.10.48:7001 f24b935a50a788692479c6beaf7c556f6d082253
1

检查集装状态:

/usr/local/redis/src/redis-cli -c -h10.10.10.48:7002 -p 8001 -a passwdxxx --cluster check 172.16.17.80:8002
1

布隆过滤器

  yum install git
 cd /data
 git clone https://github.com/RedisBloom/RedisBloom.git
 cd RedisBloom
 make
 echo "loadmodule /data/RedisBloom/redisbloom.so" >>/data/redis7001/redis7001.conf
1
2
3
4
5
6
上次更新: 4/24/2025

← 安装配置 redis大key分析→

最近更新
01
tidb fast ddl
04-04
02
TiDB配置文件调优 原创
04-03
03
如何移除TiDB中的表分区 原创
04-03
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式