RedisKey-value nosql, dedicated to thoseSmall and hotData, typical "Lori control"
What is key-value? From the perspective of RDBMS, let alone one word:
Key: primary key column
Value: other columns
Redis has been very popular in recent years, and it has become very popular.
Looking forward to Foreign Countries: YouPorn, a famous adult website, uses 100% redis with 0.1 billion PV every day, solving the problem of countless diaosi YY
Looking down at China: Sina Weibo's redis Road is a bitter cry
Just a thousand miles, starting with installation, let's talk about a simple installation step
(I) install redis
# wget https://redis.googlecode.com/files/redis-2.6.13.tar.gz# tar -zxv -f redis-2.6.13.tar.gz# cd redis-2.6.13# cd src# make # mkdir /etc/redis/# cp redis.conf /etc/redis/redis.conf# echo "1" > /proc/sys/vm/overcommit_memory# make install
(Ii) set redis as the background daemon
# cat /etc/redis/redis.conf | grep -in --color=auto 'daemonize'16:# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.17:daemonize yes
(Iii) Start redis
# redis-server /etc/redis/redis.conf# ps aux | grep redisroot 32111 0.0 0.0 31496 1500 ? Ssl 16:38 0:00 redis-server /etc/redis/redis.confroot 32122 0.0 0.0 5128 676 pts/2 R+ 16:39 0:00 grep redis
(Iv) test redis
# redis-cliredis 127.0.0.1:6379> set name "David Lin"OKredis 127.0.0.1:6379> get name"David Lin"redis 127.0.0.1:6379> hset 192.168.1 David David@redis(integer) 1redis 127.0.0.1:6379> hget 192.168.1 David"David@redis"redis 127.0.0.1:6379> hset 192.168.1 root root@redis(integer) 1redis 127.0.0.1:6379> hget 192.168.1 root"root@redis"redis 127.0.0.1:6379> hkeys 192.168.11) "David"2) "root"redis 127.0.0.1:6379> hvals 192.168.11) "David@redis"2) "root@redis"redis 127.0.0.1:6379> hgetall 192.168.11) "David"2) "David@redis"3) "root"4) "root@redis"redis 127.0.0.1:6379> type namestringredis 127.0.0.1:6379> type 192.168.1hashredis 127.0.0.1:6379> quit
(V) Disable redis
# redis-cli shutdown
(Vi) Possible Errors
During the installation process, you may be lucky to meet:
Zmalloc. o: In function 'zmalloc _ used_memory ':/root/redis/redis-2.6.13/src/zmalloc. c: 223: Undefined reference to '_ sync_add_and_fetch_4' collect2: LD returns 1 make [1]: *** [redis-server] Error 1 make [1]: leaving directory '/root/redis/redis-2.6.13/src' Make: *** [all] Error 2
Probably the kernel is a little old and cannot keep up with the latest redis
[root@odd ~]# uname -r2.6.18-308.el5xen
Solution:
Install the latest version of TCL
# wget http://nchc.dl.sourceforge.net/project/tcl/Tcl/8.6.0/tcl8.6.0-src.tar.gz # tar -zxv -f tcl8.6.0-src.tar.gz # cd tcl8.6.0# cd unix# ./configure # make# make test# make install
Then let's do two more things:
① Add cflags =-March = i686 at the beginning of SRC/makefile
② Edit the OPT in src/. Make-settings and change it to OPT =-O2-March = i686.
This article is now, coming to an end, and the installation process is not complicated. As for the test commands, the next is more exciting.
Good luck
2013-05-30
By David Lin