编辑
2023-11-14
Redis源码阅读
00

整个Redis启动过程为以下几个步骤

1.基本初始化(随机种子和时区设置)

2.哨兵模式设置,R

编辑
2023-11-14
redis
00

Redis Server是一个高性能的键值存储系统,它提供了一系列的启动参数,用于配置和控制Redis服务器的行为。

  1. --bind <ip_address>:指定Redis服务器绑定的IP地址,默认为127.0.0.1,表示只能本地访问。可以使用0.0.0.0来允许所有IP地址访问[1]

  2. --port <port_number>:指定Redis服务器监听的端口号,默认为6379。可以根据需要修改为其他端口号[1]

  3. --daemonize yes/no:指定是否以守护进程方式运行Redis服务器。如果设置为yes,Redis将在后台运行;如果设置为no,Redis将在前台运行[1]

编辑
2023-11-14
redis
00
编辑
2023-11-14
redis
00

模版文件

yaml
port 6379 bind 0.0.0.0 protected-mode no daemonize no appendonly yes cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 15000 cluster-announce-ip 172.19.0.1${NO} cluster-announce-port 6379 cluster-announce-bus-port 16379

生成脚本

yaml
for no in `seq 1 6`; do \ mkdir -p redis-${no}/conf \ && NO=${no} envsubst < redis-cluster.tmpl > redis-${no}/conf/redis.conf \ && mkdir -p redis-${no}/data;\ done

docker-compose.yaml文件

yaml
# 描述 Compose 文件的版本信息 version: "3.8" # 定义服务,可以多个 services: redis-cluster: image: redis:latest networks: redis: ipv4_address: 172.19.0.2 command: redis-cli --cluster create 172.19.0.11:6379 172.19.0.12:6379 172.19.0.13:6379 172.19.0.14:6379 172.19.0.15:6379 172.19.0.16:6379 --cluster-replicas 1 --cluster-yes depends_on: - redis-1 - redis-2 - redis-3 - redis-4 - redis-5 - redis-6
编辑
2023-11-14
SpringBoot
00
xml
<dependency> <groupId>o