redis的使用
屯昌網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),屯昌網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為屯昌上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的屯昌做網(wǎng)站的公司定做!
Redis的存儲(chǔ)形式是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
啟動(dòng)redis
默認(rèn)情況下,redis不是在后臺(tái)運(yùn)行,修改一下他的配置文件,讓他在后臺(tái)運(yùn)行
vi /usr/local/redis/etc/redis.conf
將daemonize 改為yes
啟動(dòng)命令:
[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