Redis的使用
Redis的存储形式是key-values
安装redis
wget http://download.redis.io/releases/redis-3.0.7.tar.gz
tar xzf redis-3.0.7.tar.gz
cd redis-3.0.7
make
cd src && make install
拷贝配置文件和程序便于管理
[root@nosql src]# mkdir -p /usr/local/redis/bin
[root@nosql src]# mkdir -p /usr/local/redis/etc
[root@nosql src]# mv /usr/local/src/redis-3.0.7/redis.conf /usr/local/redis/etc
[root@nosql src]# pwd
/usr/local/src
[root@nosql src]# cd redis-3.0.7/src
[root@nosql src]# mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server /usr/local/redis/bin
[root@nosql src]# ll /usr/local/redis/bin /usr/local/redis/etc
/usr/local/redis/bin:
total 15464
-rwxrwxr-x 1 root root 566 Jan 25 09:57 mkreleasehdr.sh
-rwxr-xr-x 1 root root 4587323 Mar 26 01:33 redis-benchmark
-rwxr-xr-x 1 root root 22185 Mar 26 01:33 redis-check-aof
-rwxr-xr-x 1 root root 45395 Mar 26 01:33 redis-check-dump
-rwxr-xr-x 1 root root 4696538 Mar 26 01:33 redis-cli
-rwxr-xr-x 1 root root 6469287 Mar 26 01:33 redis-server
/usr/local/redis/etc:
total 44
-rw-rw-r-- 1 root root 41560 Jan 25 09:57 redis.conf
启动redis
默认情况下,redis不是在后台运行,修改一下他的配置文件,让他在后台运行
vi /usr/local/redis/etc/redis.conf
将daemonize 改为yes
启动命令:
[root@nosql redis-3.0.7]# redis-server /usr/local/redis/etc/redis.conf
[root@nosql redis-3.0.7]# lsof -i :6379
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 12693 root 4u IPv6 25154 0t0 TCP *:6379 (LISTEN)
redis-ser 12693 root 5u IPv4 25156 0t0 TCP *:6379 (LISTEN)
停止:
redis-cli shutdown
客户端连接
[root@nosql redis-3.0.7]# redis-cli
127.0.0.1:6379> help
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。