标签:redis
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
本文出自 “比尔linux运维笔记” 博客,请务必保留此出处http://chenshoubiao.blog.51cto.com/6159058/1884410
标签:redis
原文地址:http://chenshoubiao.blog.51cto.com/6159058/1884410