Redis是常用基于内存的Key-Value数据库,比Memcache更先进,支持多种数据结构,高效,快速。
在ubuntu 14.04下安装步骤:
在ubuntu 14.04下安装步骤:
1、
安装Redis服务器端
~ sudo apt-get install redis-server
安装完成后,Redis服务器会自动启动,我们检查Redis服务器程序
# 检查Redis服务器系统进程
~ ps -aux|grep redis
redis 4162 0.1 0.0 10676 1420 ? Ss 23:24 0:00 /usr/bin/redis-server /etc/redis/redis.conf
conan 4172 0.0 0.0 11064 924 pts/0 S+ 23:26 0:00 grep --color=auto redis
# 通过启动命令检查Redis服务器状态
~ netstat -nlt|grep 6379
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
2、通过命令行客户端访问Redis安装Redis服务器,会自动地一起安装Redis命令行客户端程序。
在本机输入redis-cli命令就可以启动,客户端程序访问Redis服务器。
~ redis-cli
redis 127.0.0.1:6379>
# 命令行的帮助
redis 127.0.0.1:6379> help
redis-cli 2.2.12
Type: "help @" to get a list of commands in
"help " for help on
"help " to get a list of possible help topics
"quit" to exit
3、设置访问密码
默认情况下,访问Redis服务器是不需要密码的,为了增加安全性我们需要设置Redis服务器的访问密码。设置访问密码为redisredis。
打开Redis服务器的配置文件redis.conf
~ sudo nano /etc/redis/redis.conf
#取消注释requirepass
requirepass redisredis
登陆Redis服务器,输入密码
~ redis-cli -a redisredis
4、
让Redis服务器被远程访问
默认情况下,Redis服务器不允许远程访问,只允许本机访问,所以我们需要设置打开远程访问的功能。
打开Redis服务器的配置文件redis.conf
~ sudo nano /etc/redis/redis.conf #注释bind #bind 127.0.0.1
修改后,重启Redis服务器。
sudo service
redis-server restart
redis客户端管理ide可以用redisdeskopmanager,各种系统版本都有。
https://github.com/uglide/RedisDesktopManager/releases/download/0.8.3/redis-desktop-manager_0.8.3-120_amd64.deb
一些常用操作可以参考:
http://www.yiibai.com/redis/redis_commands.html
本篇文章转自:http://www.linuxidc.com/Linux/2014-05/101544.htm