Redis is one of the most popular NoSQL databases today, and it is a key-value storage system. Similar to memcached, but largely compensates for the lack of memcached, which supports storing more value types, including string, list, set, Zset, and hash. These data types support Push/pop, Add/remove, and intersection sets and differences, and richer operations. Based on this, Redis supports sorting in a variety of different ways. Redis data is cached in the computer's memory and periodically writes the updated data to disk or writes the modification to the appended record file.
Below we install Redis on CentOS
Download the source code, unzip and compile the source code.
[Email protected] temp]# wget http://download.redis.io/releases/redis-2.8.3.tar.gz[[Email Protected] temp]# tar zxvf redis-2.8.3. tar.gz [[email protected] temp]# CD Redis-2.8.3[email Protected] Redis-2.8.3] #make
Note that there is no make install
The installation directory is/usr/local/software/redis-2.8.3
1. View the files in the installation directory
[Email protected] redis-2.8.3108 ... -rw-rw-r--. 1 root root 4401 Dec README-rw-rw-r--. 1 root root 29593 Dec redis.conf-rwxr Wxr-x. 1 root root 271 Dec runtest-rw-rw-r--. 1 root root 5661 Dec sentinel.conf DRWXRWXR-X 2 root root 4096 Mar 5 13:27 srcdrwxrwxr-x 8 root root 4096 Dec 1 1 testsdrwxrwxr-x 2 root root 4096 Dec one utils
Redis.conf:redis Main configuration file, configure the parameters of connection, password, port, persistence, etc. ~
2. After the compilation, in the SRC directory, there are several executable files Redis-server, Redis-benchmark, REDIS-CLI
[Email protected] redis-2.8.3]# CD src/[email protected] src]# lltotal23856-rw-rw-r--. 1 root root 9930 Dec 11 2013adlist.c.....-rw-rw-r--. 1 root root 2274 Dec 11 2013redisassert.h-rwxr-xr-x. 1 root root 4170559 Mar 5 13:27Redis-benchmark-rw-rw-r--. 1 root root 27418 Dec redis-benchmark.c-rw-r--r--. 1 root root 60456 Mar 5 13:27 redis-BENCHMARK.O-rw-rw-r--. 1 root root 118700 Dec 11 2013REDIS.C-rwxr-xr-x. 1 root root 22193 Mar 5 13:27 redis-check-aof-rw-rw-r--. 1 root root 6328 Dec redis-check-AOF.C-rw-r--r--. 1 root root 20688 Mar 5 13:27 redis-check-AOF.O-rwxr-xr-x. 1 root root 45427 Mar 5 13:27 redis-check-Dump-rw-rw-r--. 1 root root 22155 Dec redis-check-dump.c-rw-r--r--. 1 root root 45432 Mar 5 13:27 redis-check-DUMP.O-rwxr-xr-x. 1 root root 4243011 Mar 5 13:27redis-cli-rw-rw-r--. 1 root root 51412 Dec redis-CLI.C-rw-r--r--. 1 root root 144704 Mar 5 13:27 redis-CLI.O-rw-rw-r--. 1 root root 60143 Dec 11 2013Redis.h-rw-r--r--. 1 root root 210400 Mar 5 13:27REDIS.O-rwxr-xr-x. 1 root root 5641122 Mar 5 13:27 redis-Sentinel-rwxr-xr-x. 1 root root 5641122 Mar 5 13:27Redis-server-rw-rw-r--. 1 root root 2164 Mar 5 13:27release.c.....-rw-r--r--. 1 root root 30176 Mar 5 13:27Zmalloc.o[[email protected] src]#
The Daemon launcher for the Redis-server:redis server.
Redis-cli:redis command-line operation tool. Of course, you can also use Telnet to operate on its plain text protocol.
Redis-benchmark:redis Performance Testing tool to test the read and write performance of Redis in your system and in your configuration.
3. Start the Redis service.
1) execution./usr/redis/redis-2.8.13/src/redis-server
[[Email protected]src]#./redis-server. /redis.conf [34597] 13:39:43.338 * Max number of open files set to 10032 _._ _.-"__"-._ _.-`` `. `_. "-._ Redis 2.8.3 (00000000/0) 64bit.-`` .-```. "\ \ _.,_"-._ ( ',.-' | ', ') Running in stand alone mode | '-._ '-...-' __...-. '-._| ' ' _.-' | port:6379 | '-._ '. _/_.-' | pid:34597 '-._ '-._ '-./_.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | http//Redis.io'-._ '-._ '-.__.-' _.-' _.-' | '-._ '-._ '-.__.-' _.-' _.-' | | '-._ '-._ _.-' _.-' | `-._ '-._ '-.__.-' _.-' _.-'-._ '-.__.-' _.-' `-._ _.-'-.__.-'[34597] Mar 13:39:43.346 # Server started, Redis version 2.8.3[34597] 13:39:43.347 # WARNING Overcommit_memory is set to 0! Background save may fail under low memory condition.
To fix ThisIssue add ' vm.overcommit_memory = 1 ' to/etc/sysctl.conf and then reboot or run the command ' Sysctl Vm.overcommit_memory=1 ‘
for ThisTo take effect. [34597] 13:39:43.347 * The server is now a ready-to-accept connections on port 6379
2) View process
[[Email protected] ~]# PS aux| grep redisroot 34597 0.0 0.7 137344 7640 pts/0 sl+ 13:39 0:00./redis-server *:6379 Root 34608 0.0 0.0 103308 860 pts/1 s+ 13:41 0:00 grep redis
3) then test with the client to see if it started successfully.
[[email protected] src]#./redis-127.0.0.1:6379> set greet Hellook127.0.0.1:6379> get Greet
Note that the Redis service cannot run in the background at this point, and CTRL + C ends the Redis service
Need to configure the Redis service to run in the background, it's a little cumbersome, we don't deserve it.
Installation of Redis under Linux