redis最新版本:redis-6.2.1.tar.gz

安装的版本是redis-6.0.3

采用的主机:

djz-server-001 192.168.2.163 7001,7002,Admin@135

djz-server-002 192.168.2.164 7001,7002,Admin@135

djz-server-003 192.168.2.165 7001,7002,Admin@135

$ sudo mkdir -p /app/{server,soft}
$ sudo yum -y install centos-release-scl
$ sudo yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
# scl enable devtoolset-9 bash
# cd /app/soft
# wget http://download.redis.io/releases/redis-6.0.3.tar.gz
# tar zxf redis-6.0.3.tar.gz
# cd redis-6.0.3
# make
# make install PREFIX=/app/server/redis-cluster
$ cd /app/server/redis-cluster
$ sudo cp bin/redis-server .
$ sudo cp bin/redis-cli .
$ sudo mkdir -p /app/var/logs/redis
$ sudo mkdir -p /app/server/redis-cluster/run
$ sudo vim redis7001.conf protected-mode yes
port 7001
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /app/server/redis-cluster/run/redis_7001.pid
loglevel notice
logfile "/app/var/logs/redis/redis7001.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump7001.rdb
dir /app/server/redis-cluster/
masterauth Admin@135
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
requirepass Admin@135
maxclients 30000
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-config-file nodes_7001.conf
cluster-node-timeout 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
sudo vim /etc/init.d/redis7001

#!/bin/bash
#
# redis startup script for the redis7001 server
#
#
# chkconfig: 345 80 20
# description: start the redis7001 deamon
#
# Source function library
#. /etc/rc.d/init.d/functions app_user=dzfp
export app_user
prog=redis7001
RDPATH_HOME=/app/server/redis-cluster
export RDPATH_HOME
CONF_FILE=redis7001.conf
export CONF_FILE
NODE_FILE=nodes_7001.conf
export NODE_FILE
REDIS_AUTH="Admin@135"
export REDIS_AUTH
P_PORT=7001
export P_PORT if [ "$(whoami)" != "root" ] && [ "$(whoami)" != "${app_user}" ]; then
echo "please run this script as root or ${app_user} ."
exit 1
fi case "$1" in
start)
echo "Starting " ${prog} "..."
cd ${RDPATH_HOME}
if [[ "$(whoami)" = "root" ]]; then
if [ -f ${NODE_FILE} ];then
CLUSTER_MYSELF=`su - ${app_user} -c "cat ${RDPATH_HOME}/${NODE_FILE} |grep myself"`
su - ${app_user} -c "echo ${CLUSTER_MYSELF} > ${RDPATH_HOME}/${NODE_FILE}"
fi
su - ${app_user} -c "${RDPATH_HOME}/redis-server ${RDPATH_HOME}/${CONF_FILE}"
elif [[ "$(whoami)" = "${app_user}" ]]; then
if [ -f ${NODE_FILE} ];then
CLUSTER_MYSELF=`cat ${RDPATH_HOME}/${NODE_FILE} |grep myself`
echo ${CLUSTER_MYSELF} > ${RDPATH_HOME}/${NODE_FILE}
fi
${RDPATH_HOME}/redis-server ${RDPATH_HOME}/${CONF_FILE}
fi
;; stop)
echo "Stopping " ${prog} "..."
cd ${RDPATH_HOME}
if [[ "$(whoami)" = "root" ]]; then
su - ${app_user} -c "${RDPATH_HOME}/redis-cli -a ${REDIS_AUTH} -p ${P_PORT} shutdown"
elif [[ "$(whoami)" = "${app_user}" ]]; then
${RDPATH_HOME}/redis-cli -a ${REDIS_AUTH} -p ${P_PORT} shutdown
fi
;; restart)
echo "Stopping " ${prog} "..."
cd ${RDPATH_HOME}
if [[ "$(whoami)" = "root" ]]; then
su - ${app_user} -c "${RDPATH_HOME}/redis-cli -a ${REDIS_AUTH} -p ${P_PORT} shutdown"
elif [[ "$(whoami)" = "${app_user}" ]]; then
${RDPATH_HOME}/redis-cli -a ${REDIS_AUTH} -p ${P_PORT} shutdown
fi
sleep 2
echo
echo "Starting " ${prog} "..."
cd ${RDPATH_HOME}
if [[ "$(whoami)" = "root" ]]; then
su - ${app_user} -c "${RDPATH_HOME}/redis-server ${RDPATH_HOME}/${CONF_FILE}"
elif [[ "$(whoami)" = "${app_user}" ]]; then
${RDPATH_HOME}/redis-server ${RDPATH_HOME}/${CONF_FILE}
fi
;; *)
echo "Usage: $prog {start|stop|restart}"
;;
esac
exit 0
# chown -R dzfp.dzfp /app/server/redis-cluster /app/var/logs/redis/
# chmod 755 /etc/init.d/redis7001
# chkconfig --add redis7001
# /etc/init.d/redis7001 start
# ps -ef|grep redis
# 根据redis7001配置redis7002服务
# cd /app/server/redis-cluster
# cp -a redis7001.conf redis7002.conf # cp -a /etc/init.d/redis7001 /etc/init.d/redis7002
# sed -i 's/7001/7002/g' redis7002.conf
# sed -i 's/7001/7002/g' /etc/init.d/redis7002 # 服务启动
# chkconfig --add redis7002
# /etc/init.d/redis7002 start

其他主机上也做上述同样的操作

$ cd /app/server/redis-cluster
# 在一台主机上执行 (ip换成实际主机ip)
$ ./redis-cli -a Admin@135 --cluster create 192.168.2.163:7001 192.168.2.164:7001 192.168.2.165:7001 192.168.2.163:7002 192.168.2.164:7002 192.168.2.165:7002 --cluster-replicas 1
$ cd /app/server/redis-cluster
$ ./redis-cli -c -h 192.168.2.163 -p 7001 -a "Admin@135"
192.168.2.163:7001> cluster info
192.168.2.163:7001> cluster nodes 192.168.2.163:7001> set name andy
-> Redirected to slot [5798] located at 192.168.2.164:7001
OK
192.168.2.163:7001> 在其他的节点验证是否成功
$ ./redis-cli -c -h 192.168.2.164 -p 7001 -a "Admin@135" 192.168.2.164:7001> get name
"andy"
192.168.2.164:7001> $ ./redis-cli -c -h 192.168.2.165 -p 7001 -a "Admin@135"
192.168.2.165:7001> get name
-> Redirected to slot [5798] located at 192.168.2.164:7001
"andy"
192.168.2.164:7001>

redis cluster 6.2集群的更多相关文章

  1. Redis Cluster高可用集群在线迁移操作记录【转】

    之前介绍了redis cluster的结构及高可用集群部署过程,今天这里简单说下redis集群的迁移.由于之前的redis cluster集群环境部署的服务器性能有限,需要迁移到高配置的服务器上.考虑 ...

  2. Redis Cluster高可用集群在线迁移操作记录

    之前介绍了redis cluster的结构及高可用集群部署过程,今天这里简单说下redis集群的迁移.由于之前的redis cluster集群环境部署的服务器性能有限,需要迁移到高配置的服务器上.考虑 ...

  3. 近千节点的Redis Cluster高可用集群案例:优酷蓝鲸优化实战(摘自高可用架构)

    (原创)2016-07-26 吴建超 高可用架构导读:Redis Cluster 作者建议的最大集群规模 1,000 节点,目前优酷在蓝鲸项目中管理了超过 700 台节点,积累了 Redis Clus ...

  4. 【docker】【redis】2.docker上设置redis集群---Redis Cluster部署【集群服务】【解决在docker中redis启动后,状态为Restarting,日志报错:Configured to not listen anywhere, exiting.问题】【Waiting for the cluster to join...问题】

    参考地址:https://www.cnblogs.com/zhoujinyi/p/6477133.html https://www.cnblogs.com/cxbhakim/p/9151720.htm ...

  5. 部署Redis Cluster 6.0 集群并开启密码认证 和 Redis-cluster-proxy负载

    部署Redis Cluster集群并开启密码认证 如果只想简单的搭建Redis Cluster,不需要设置密码和公网访问,可以参考官方文档. 节点介绍 Cluster模式推荐最少有6个节点,本次实验搭 ...

  6. redis cluster 设置密码做集群时gem下client.rb文件修改

    redis节点有设置密码,然后在创建集群的时候没有设置密码的命令 ./redis-trib.rb create --replicas 1 127.0.0.1:6381 127.0.0.1:6382 1 ...

  7. Redis(十)集群:Redis Cluster

    一.数据分布 1.数据分布理论 2.Redis数据分区 Redis Cluser采用虚拟槽分区,所有的键根据哈希函数映射到0~16383整数槽内,计算公式:slot=CRC16(key)&16 ...

  8. Redis 3.0.5 集群的命令、使用、维护

    cluster命令 CLUSTER INFO 打印集群的信息 CLUSTER NODES 列出集群当前已知的所有节点(node),以及这些节点的相关信息. //节点 CLUSTER MEET < ...

  9. 分布式缓存技术redis学习系列(四)——redis高级应用(集群搭建、集群分区原理、集群操作)

    本文是redis学习系列的第四篇,前面我们学习了redis的数据结构和一些高级特性,点击下面链接可回看 <详细讲解redis数据结构(内存模型)以及常用命令> <redis高级应用( ...

随机推荐

  1. 编译安装Python出现“pip is configured with locations that require TLS/SSL, however the ssl.....”

    ubuntu: sudo apt-get install libssl-dev Cenos: sudo yum install openssl-devel 重新编译: ./configure --en ...

  2. idea 错误: 找不到或无法加载主类 xx.xxx.Application

    原因module 里面缺少iml文件 生成iml文件方法二:(建议):刷新一下Maven Project就会自动生成.iml文件.点击下图红框标记的按钮即可 完成后就会自动生成.iml文件. 方法二: ...

  3. [ERROR] Another process with pid 914 is using unix socket file.

    mysql启动报错 1.首先到mysql的配置文件中,确定socket文件路径 vim /etc/my.cnf 2.删除mysql.sock.lock 3.启动mysql

  4. 1.9. 触摸按钮(touch pad)测试

    1.9.1. 基础 Esp32部分GPIO内置了touch按钮功能(电容式),具体有touch功能的引脚在配置为touchpad后,单片机读入的电容值随是否被触碰发生变化,系统根据电容值的变化判断判断 ...

  5. uniapp调用jar

    前言 此方法为使用uniapp开发前端资源,然后继承进安卓原生项目,达到调用uniapp调用jar的效果. 基于Android Studio进行开发. 本人不懂安卓以及gradle,只是基于搜索引擎以 ...

  6. 【web自动化测试】Playwright快速入门,5分钟上手

    我喜欢Playwright! 这是微软开源的一款非常强大的自动化工具,再过几年,他很有可能取代Selenium在浏览器自动化的通知地位.使用过一段时间,我没有找到很好的中文资料可以参考,导致很多问题无 ...

  7. java-循环

    1.循环:反复执行一段相同或相似的代码(逻辑相似或者相同)2.循环三要素: 1.循环变量的初始化 2.循环的条件(以循环变量为基础) 3.循环变量的改变(向着循环的结束变)循环变量:在整个循环过程中所 ...

  8. 老梗新玩「GitHub 热点速览 v.22.34」

    作者:HelloGitHub-小鱼干 不知道你是否和我有一样的烦恼,最近的流行梗当自己要用拿来造词时,就陷入了不知道咋"换壳"的尴尬地步.sao-gen-gen 大大减少了你老梗新 ...

  9. Tablesaw——Java统计、机器学习库

    资源 java二维数组处理可可视化库 https://github.com/jtablesaw/tablesaw plotly JS库的Java封装 https://github.com/jtable ...

  10. CF-1675D. Vertical Paths

    题意:每次可以选择一条路径,要求这条路径中每个点都是上一个点的子节点,求最少需要几条路径将所有点走完 思路:将每个点有没有子节点判断出来,因为只有没有子节点的点需要新增一条路,所以需要路径的最小数目就 ...