Redis 集群部署
# redis 集群 python 部署
环境
10.10.10.48
10.10.10.49
10.10.10.50
1
2
3
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
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
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
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
2
3
4
5
6
上次更新: 8/28/2024
← 安装配置 redis大key分析→
- 01
- GPT分区使用 parted 扩展分区的操作流程 原创08-28
- 02
- VictoriaMetrics 集群版安装与配置 原创08-24
- 03
- Kubernetes (k8s) 相关名词详解 原创06-27