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 ...
随机推荐
- iOS基础知识之排序
1.字符串比较 - (NSComparisonResult)compare:(NSString *)str; 例如: NSString *str1 = @"zhangsan"; N ...
- windows定时关机命令
at 11:00 shutdown.exe -s -t 120 https://jingyan.baidu.com/article/574c52191ea9996c8c9dc17a.html?st=2 ...
- 阿里巴巴开源项目: canal
参考:https://www.cnblogs.com/duanxz/p/5062833.html docker 部署canal : https://blog.csdn.net/u013705066/ ...
- c# sql等微型代码工具LinqPad
- Mycat 水平拆分
一致性Hash理解 https://blog.csdn.net/cywosp/article/details/23397179?utm_source=blogxgwz1 十种 水平拆分 https:/ ...
- Spring boot 启动配置原理
配置在META-INF/spring.factories 有几个主要的类 ApplicationContextInitializer 创建SpringAplication SpringAppli ...
- self, super理解
self是方法参数列表中的第一个参数,是运行时决定的. super是编译器符号,是编译时决定的.super的含义为从父类开始寻找相应的方法,父类在编译的时候就已经决定了. 一个关键点:super并不代 ...
- cordova- cordova-plugin-splashscreen启动页面和图标的设置
https://www.cnblogs.com/a418120186/p/5856371.html
- webpack 引用vconsole
1.npm install -vconsole --save-dev 2.npm install -vconsele-webpack-plugin --save-dev 3.webpack.base. ...
- pandas 笔记
删除: del df["A"] # 原地修改 df.drop("a") # 返回修改后的新对象 df.drop(["a", " ...