Redis是一个开源,高级的键值存储和一个适用的解决方案,用于构建高性能,可扩展的Web应用程序。Redis有三个主要特点,使它优越于其它键值数据存储系统:
Redis将其数据库完全保存在内存中,仅使用磁盘进行持久化。与其它键值数据存储相比,Redis有一组相对丰富的数据类型。Redis可以将数据复制到任意数量的从机中。注:6379为Redis 默认端口。
redis 127.0.0.1:6379> ping PONG安装完成!
ubuntu 下Redis配置文件位于:/etc/redis/redis.conf
定位 requirepass
修改密码 requirepass yourpassword
################################## SECURITY ################################### # Require clients to issue AUTH <PASSWORD> before processing any other # commands. This might be useful in environments in which you do not trust # others with access to the host running redis-server. # # This should stay commented out for backward compatibility and because most # people do not need auth (e.g. they run their own servers). # # Warning: since Redis is pretty fast an outside user can try up to # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # requirepass redis通过一下命令行测试修改结果:
$ redis-cli 127.0.0.1:6379> config get requirepass (error) NOAUTH Authentication required.提示无权访问。
$ redis-cli -h 127.0.0.1 -p 6379 -a redispass 127.0.0.1:6379> config get requirepass 1) "requirepass" 2) "redispass"通过密码登陆可以正确访问。
注:redispass 为你设置的密码。127.0.0.1为本机Ip地址
将bind 0.0.0.0这一行解除注释
# By default Redis listens for connections from all the network interfaces # available on the server. It is possible to listen to just one or multiple # interfaces using the "bind" configuration directive, followed by one or # more IP addresses. # # Examples: # # bind 192.168.1.100 10.0.0.1 bind 0.0.0.0通过ip地址访问redis
$ redis-cli -h xxx.xxx.xxx.xxx -p 6379 -a redispass xxx.xxx.xxx.xxx:6379>注意:xxx.xxx.xxx.xxx为服务器IP地址。
下载安装 Redis Desktop Manager(https://redisdesktop.com/download)
下面是Redis Desktop Manager的配置界面:
连接成功: