VMware安装Redis遇到的几个问题
- bind绑定,默认时127.0.0.1,因为还不确定哪些机器访问,故设置为0.0.0.0
- 防火墙需要配置一下
iptables -N REDIS iptables -A REDIS -s 192.168.2.13 -j ACCEPT iptables -A REDIS -s 192.168.2.14 -j ACCEPT iptables -A REDIS -s 192.168.2.12 -j ACCEPT iptables -A REDIS -j LOG --log-prefix "unauth-redis-access" iptables -A REDIS -j REJECT --reject-with icmp-port-unreachable iptables -I INPUT -p tcp --dport 6379 -j REDIS iptables -I INPUT -p tcp --dport 6380 -j REDIS
- 集群模式先打开cluster-enabled属性开放出来
- 建立集群时,节点有数据,先删除数据,包括失败的集群配置
- 集群节点等待
>>> Performing hash slots allocation on 6 nodes... Master[0] -> Slots 0 - 5460 Master[1] -> Slots 5461 - 10922 Master[2] -> Slots 10923 - 16383 Adding replica 192.168.2.13:6380 to 192.168.2.12:6379 Adding replica 192.168.2.14:6380 to 192.168.2.13:6379 Adding replica 192.168.2.12:6380 to 192.168.2.14:6379 M: 1b05665e8d472c210a53881581fc27b7261a1f3d 192.168.2.12:6379 slots:[0-5460] (5461 slots) master M: d16da53edac632cce3e6e364f81eabe24bca015f 192.168.2.13:6379 slots:[5461-10922] (5462 slots) master M: 6392f404f314d66bda6ed6bcb779f62986410584 192.168.2.14:6379 slots:[10923-16383] (5461 slots) master S: 42a3f1c68a95c6d7b2e31606a3f737b8c043ad92 192.168.2.12:6380 replicates 6392f404f314d66bda6ed6bcb779f62986410584 S: fbc5f5d98fb44587fd65cbbe52e6ce633918935d 192.168.2.13:6380 replicates 1b05665e8d472c210a53881581fc27b7261a1f3d S: e316fa37321f825edc079f20ba687a727ed4908d 192.168.2.14:6380 replicates d16da53edac632cce3e6e364f81eabe24bca015f Can I set the above configuration? (type 'yes' to accept): yes >>> Nodes configuration updated >>> Assign a different config epoch to each node >>> Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
开放redis集群总线端口,集群总线端口是redis客户端连接的端口+10000。命令如下
iptables -I INPUT -p tcp --dport 16379 -j REDIS iptables -I INPUT -p tcp --dport 16380 -j REDIS
- redis dir 文件路径会导致启动失败