Redis高级实用特性
1.安全性
设置客户端连接后进行任何其他指定前需要使用的密码
设置方法:
在配置文件中如下图设置
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203441089-1439011457.png)
授权方法:
【1】auth+密码
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203441386-59526670.png)
【2】登录时授权
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203441636-938936978.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203445526-1078405741.png)
2.主从复制
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203447042-784158092.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203449870-1145213179.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203453979-1492841944.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203457682-2031167843.png)
配置方法:
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203500026-425943358.png)
3.事务处理
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203504417-1144492784.png)
设置一个事务:multi....exec
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203505386-1119427080.png)
取消一个事务:multi....discard
使用discard命令,其实就是清空事务的命令队列并退出事务上下文,也就是我们常说的事务回滚
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203506917-1925637165.png)
乐观锁复杂事务控制
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203511714-465247414.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203516292-1152081327.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203519542-533390693.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203521292-388827938.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203522136-1701792680.png)
事务回滚
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203523792-1552102477.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203526261-347555642.png)
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203533417-1217026640.png)
4.持久化机制
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203536339-547869194.png)
Snapshotting方式:
配置文件配置方法
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203540573-1910826824.png)
Append-only file方式:
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203544542-304739337.png)
配置文件配置方法
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203548761-1164218661.png)
5.发布订阅消息
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203553917-1507566379.png)
6.虚拟内存的使用
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203559182-1523979116.png)
配置方法
![](https://images2015.cnblogs.com/blog/1085906/201612/1085906-20161224203600854-1495303734.png)
只言片语任我说,提笔句句无需忖。落笔不知寄何人,唯有邀友共斟酌。