在本章中,您将了解和学习redis的环境安装设置。
要在ubuntu上安装redis,打开终端并键入以下命令 -
[h3@ubuntu:~]$ sudo apt-get update
[h3@ubuntu:~]$ sudo apt-get install redis-server
这将在ubuntu机器上安装redis。
启动redis
[h3@ubuntu:~]$ redis-server
[2988] 07 feb 17:09:42.485 # warning: no config file specified, using the default config. in order to specify a config file use redis-server /path/to/redis.conf
[2988] 07 feb 17:09:42.488 # unable to set the max number of files limit to 10032 (operation not permitted), setting the max clients configuration to 3984.
[2988] 07 feb 17:09:42.490 # warning: 32 bit instance detected but no memory lim
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ redis 2.8.4 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| port: 6379
| `-._ `._ / _.-' | pid: 2988
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[2988] 07 feb 17:09:42.581 # server started, redis version 2.8.4
[2988] 07 feb 17:09:42.582 # warning overcommit_memory is set to 0! background s ' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_m
[2988] 07 feb 17:09:42.582 * the server is now ready to accept connections on po
检查redis是否正在工作
[h3@ubuntu:~]$ redis-cli
这将打开一个redis提示,如下所示 -
redis 127.0.0.1:6379>
在上面的提示中,127.0.0.1
是计算机的ip地址,6379
是运行redis服务器的端口。 现在键入以下ping
命令。
redis 127.0.0.1:6379> ping
pong
这表明redis已成功在您的计算机上安装了。
在ubuntu上安装redis桌面管理
要在ubuntu上安装redis桌面管理器,可从 http://redisdesktop.com/download 下载该软件包,安装即可。
打开下载的软件包并安装。
redis桌面管理器将提供用于管理redis的键和数据的ui。