Redis的单机版安装更像是开箱即用的感觉,为了初步的使用Redis,我首先在本地安装了一个Redis以便练习一些基本语法^-^。
[root@master local]# tar -zxvf redis-3.0.0.tar.gz
[root@master local]# ls
bin etc games include lib lib64 libexec mysql redis-3.0.0 redis-3.0.0.tar.gz sbin share src
[root@master local]# cd redis-3.0.0
[root@master redis-3.0.0]# make
[root@master redis-3.0.0]# make install
[root@master redis-3.0.0]# cp redis.conf conf/
[root@master redis-3.0.0]# cd conf/
[root@master redis-3.0.0]# redis-server
63322:C 22 Jan 14:25:53.166 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.0 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 63322
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
63322:M 22 Jan 14:25:53.179 # Server started, Redis version 3.0.0
63322:M 22 Jan 14:25:53.183 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
63322:M 22 Jan 14:25:53.195 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
63322:M 22 Jan 14:25:53.195 * The server is now ready to accept connections on port 6379
登录Redis-cli测试
[root@master ~]# redis-cli
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]>
关闭Redis
[root@master redis-3.0.0]# redis-cli shutdown
63373:M 22 Jan 14:46:25.356 * DB loaded from disk: 0.000 seconds
63373:M 22 Jan 14:46:25.356 * The server is now ready to accept connections on port 6379
63373:M 22 Jan 14:46:43.833 # User requested shutdown...
63373:M 22 Jan 14:46:43.833 * Saving the final RDB snapshot before exiting.
63373:M 22 Jan 14:46:43.835 * DB saved on disk
63373:M 22 Jan 14:46:43.835 # Redis is now ready to exit, bye bye...
比较基础,希望对大伙有些帮助。
最后还有一点,可能有的机器安装时会缺少一些C语言编译环境,
yum -y install cpp
yum -y install binutils
yum -y install glibc
yum -y install glibc-kernheaders
yum -y install glibc-common
yum -y install glibc-devel
yum -y install gcc
yum -y install make
参考:http://xueliang1yi.blog.163.com/blog/static/1145570162012102114635764/