centos 7 redis-4.0.11 主从
redis-master:192.168.199.223
redis-slave: 192.168.199.224
cd /opt
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar zxvf redis-4.0..tar.gz
mv redis-4.0. redis
cd redis
make&&make install
redis-master配置文件
[root@test ~]# cat /opt/redis/redis.conf |grep -Ev '^$|^#'
bind 192.168.199.223
protected-mode yes
port
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile "/usr/local/log/redis-6379.log"
databases
always-show-logo yes
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
requirepass jason_zhang
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes
redis-slave配置文件
[root@jason opt]# cat /opt/redis/redis.conf|grep -Ev '^$|^#'
bind 127.0.0.1
protected-mode yes
port
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile "/usr/local/log/redis-6379.log"
databases
always-show-logo yes
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slaveof 192.168.199.223
masterauth jason_zhang
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
requirepass jason_zhang
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes
启动master和slave的redis服务(如果不能同步请重启redis服务或者重启主机)
cd /usr/local/bin
./redis-server /opt/redis/redis.conf
master


添加两个键值jason 、monday 键值为jason_test monday_test
语法 set jason jason_test

命令 INFO 查看redis信息

redis-slave
连上redis


测试写入

测试删除

配置启动脚本
vim redis
#!/bin/bash
#chkconfig:
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem. PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=
EXEC=/usr/local/bin/redis-server
REDIS_CLI=/usr/local/bin/redis-cli PIDFILE=/var/run/redis.pid
CONF="/opt/redis/redis.conf" case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${} stop
${} start
;;
*)
echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&
exit
esac
# 复制脚本文件到init.d目录下
cp redis /etc/init.d/ # 给脚本增加运行权限
chmod +x /etc/init.d/redis # 添加服务
chkconfig --add redis # 配置启动级别
chkconfig --level redis on
重启redis,kill掉进程,重新启动
或者连上客户端之后,执行shutdown命令,再启动服务
设置最大内存
CONFIG SET maxmemory 100MB
CONFIG GET maxmemory
参考:http://happyqing.iteye.com/blog/2348255
https://www.cnblogs.com/stulzq/p/9288401.html
https://www.ilanni.com/?p=11838#%E4%B8%80%E3%80%81redis%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85
centos 7 redis-4.0.11 主从的更多相关文章
- redis-4.0.11主从配置初步探究
redis-4.0.11相较于以前版本,新增了几个安全措施,稍稍研究了6379.conf配置文件,在这里记录一下. 实验环境: centos7.4 redis:redis-4.0.11 1. redi ...
- 配置redis 4.0.11 集群
配置redis 4.0.11 集群 准备redis 软件和redis配置文件 启动Redis服务 /data/soft/redis/src/redis-check-aof --fix /log/red ...
- redis(4.0.11)编译安装
一: redis数据库安装 系统环境:linux系统(centos/redhat):Red Hat Enterprise Linux Server release 6.8 (Santiago) red ...
- 在阿里云centOS7上部署Redis 5.0.5主从 + 哨兵模式
一.在两台服务器上分别安装.配置Redis 5.0.5 ,为一主一从 安装Redis关键命令: 将安装包上传至:/home 目录下解 压:.tar.gz 安装依赖:yum install gcc 安装 ...
- centos安装redis 5.0版本的集群
我在本地VM-Centos里安装5.0.5时安装遇到了些问题,参考了Blog:https://www.cnblogs.com/shawhe/p/9548620.html 顺利安装完成. 安装redis ...
- Redis-4.0.11集群配置
版本:redis-3.0.5 redis-3.2.0 redis-3.2.9 redis-4.0.11 参考:http://redis.io/topics/cluster-tutorial. 集群 ...
- centos7用docker安装单节点redis4.0.11
[root@localhost conf]# docker search redisINDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATEDdocker.io d ...
- CENTOS7下安装REDIS4.0.11
拷贝收藏私用,别无他意,原博客地址: https://www.cnblogs.com/zuidongfeng/p/8032505.html 1.安装redis 第一步:下载redis安装包 wget ...
- centos / Linux 服务环境下安装 Redis 5.0.3
原文:centos / Linux 服务环境下安装 Redis 5.0.3 1.首先进入你要安装的目录 cd /usr/local 2.下载目前最新稳定版本 Redis 5.0.3 wget http ...
随机推荐
- .Net MVC 身份验证
.Net身份验证主要是分为三种 Windows | Forms | Passport ,其中Froms在项目中用的最多. Windows 身份验证 Forms 验证 Passport 验证 1.Win ...
- RDD中的cache() persist() checkpoint()
cache只有一个默认的缓存级别MEMORY_ONLY ,而persist可以根据StorageLevel设置其它的缓存级别. cache以及persist都不是action. 被重复使用的(但是)不 ...
- hadoop动态添加删除节点datanode及恢复
1. 配置系统环境 主机名,ssh互信,环境变量等 本文略去jdk安装,请将datanode的jdk安装路径与/etc/hadoop/hadoop-evn.sh中的java_home保持一致,版本ha ...
- [转]講講 John Carmack 的快速反平方根演算法
講講 John Carmack 的快速反平方根演算法 原地址http://213style.blogspot.com/2014/07/john-carmack.html 本篇的主題很簡單,講講怎麼快 ...
- react-native-vector-icons 图标库使用
安装链接 yarn add react-native-vector-icons react-native link react-native-vector-icons 在项目工程中打开 .xcodep ...
- Git 全局配置查看修改
查看 git config --list git config --global --list 新增 git config --global user.emal=123 删除 git config - ...
- java byte[]与十六进制字符串相互转换
http://blog.csdn.net/worm0527/article/details/69939307 http://blog.csdn.net/androiddeveloper_lee/art ...
- Net操作Excel_NPOI
Npoi 简介 1.整个Excel表格叫做工作表:WorkBook(工作薄),包含的叫页(工作表):Sheet:行:Row:单元格Cell. 2.Npoi 下载地址:http://npoi.codep ...
- The Google File System 中文版
摘要 我们设计并实现了Google文件系统,一个面向分布式数据密集型应用的.可伸缩的分布式文件系统.虽然运行在廉价的日用硬件设备上,但是它依然了提供容错功能,为大量客户机提供了很高的总体性能. 虽然与 ...
- centos下同时启动多个tomcat
1.解压apache-tomcat-7.0.69.tar.gz到/usr/local目录 .tar.gz -C /usr/local 2.新建目录tomcat7_1和tomcat7_2 tomcat7 ...