您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。