进入官网http://redis.io/download 下载需要Redis版本
建立Redis的安装目录
[root@localhost application]# mkdir /application/redis-3.2
3. 解压下载的Redis源码包
[root@localhost ~]# tar -zxvf redis-3.2-rc1.tar.gz
4. 安装Redis
[root@localhost redis-3.2-rc1]# cd redis-3.2-rc1 [root@localhost redis-3.2-rc1]# make [root@localhost redis-3.2-rc1]# make PREFIX=/application/redis-3.2/ install cd src && make install make[1]: Entering directory `/root/redis-3.2-rc1/src‘ Hint: It‘s a good idea to run ‘make test‘ ;) INSTALL install INSTALL install INSTALL install INSTALL install INSTALL install make[1]: Leaving directory `/root/redis-3.2-rc1/src‘
5. 查看安装结果
[root@localhost redis-3.2]# ls -R /application/redis-3.2/ /application/redis-3.2/: bin /application/redis-3.2/bin: redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
6.启动Redis
Redis的安装目录中有一个redis.conf文件,是一个Redis的配置文件。
[root@localhost redis-3.2]# pwd /application/redis-3.2 [root@localhost redis-3.2]# mkdir conf [root@localhost redis-3.2]# cp /root/redis-3.2-rc1/redis.conf conf/
[root@localhost redis-3.2]# /application/redis-3.2/bin/redis-server conf/redis.conf 26786:M 10 Jan 18:22:26.674 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ‘‘-._ _.-`` `. `_. ‘‘-._ Redis 3.1.101 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ‘‘-._ ( ‘ , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|‘` _.-‘| Port: 6379 | `-._ `._ / _.-‘ | PID: 26786 `-._ `-._ `-./ _.-‘ _.-‘ |`-._`-._ `-.__.-‘ _.-‘_.-‘| | `-._`-._ _.-‘_.-‘ | http://redis.io `-._ `-._`-.__.-‘_.-‘ _.-‘ |`-._`-._ `-.__.-‘ _.-‘_.-‘| | `-._`-._ _.-‘_.-‘ | `-._ `-._`-.__.-‘_.-‘ _.-‘ `-._ `-.__.-‘ _.-‘ `-._ _.-‘ `-.__.-‘ 26786:M 10 Jan 18:22:26.682 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 26786:M 10 Jan 18:22:26.682 # Server started, Redis version 3.1.101 26786:M 10 Jan 18:22:26.682 # 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. 26786:M 10 Jan 18:22:26.682 * The server is now ready to accept connections on port 6379
服务端已经启动。此时你可以使用Redis工作了。
Redis提供了一个redis-cli客户端程序,用来连接Redis。
[root@localhost bin]# ./redis-cli 127.0.0.1:6379> SET name dinglq OK 127.0.0.1:6379> GET name "dinglq" 127.0.0.1:6379>
本文出自 “叮咚” 博客,请务必保留此出处http://lqding.blog.51cto.com/9123978/1733507
原文地址:http://lqding.blog.51cto.com/9123978/1733507