redis 安装使用笔记

什么是redis数据库
redis是一个速度非常快的非关系数据库。它是以键值对关系存储数据的,并且持久化到硬盘上。之后需要在使用过程中继续学习。
安装redis
1. 我要在自己的测试服务器上安装redis 数据库。
2. 我们去官网下载安装包。我使用的手动安装的方法。
3. 解压之后启动的时候会出现 You need tcl 8.5 or newer in order to run the Redis test 是告诉我们环境需要tcl 8.5 才能运行。
4. 下载tcl 8.5 http://downloads.sourceforge.net/tcl/tcl8.6.4-src.tar.gz
./unix/./configure
sudo make & make install
5. 以上需要c编辑器 yum -y install gcc
6. 之后 cd redis 
7. make & make install
8. ./src/redis-server 启动服务
9. ./src/redis-cli 启动客户端
10. shutdown 关闭客户端
11. 设置密码登陆reids /home/test/local/redis/redis.conf 文件中修改 requirepass youpwd
12. 使用密码登陆 redis-cli -h localhost -p 6379 -a youpasswd
13. 上述为基本操作细节操作参考[菜鸟教程|redis](http://www.runoob.com/redis/redis-tutorial.html)(注意jdk版本)
14. 设置远程登陆 在redis.conf中将bind 127.0.0.1 注释掉
15. 设置后台运行 在redis.conf中设置 daemonize yes
16. 切换数据库 select xx
17. 配置数据库数量 redis.conf databases
18. flushall会清空所有数据库数据;flushdb只清空当前数据库数据
19. 遇到connection timed out,解决方法是修改redis.conf里面timed out 时间
20. 遇到read timed out,则在   pool = new JedisPool(config, ip, port,100000); 时加入读超时时间100000,第四个参数。

猜你喜欢

转载自blog.csdn.net/xuzz94/article/details/79656725
今日推荐