Redis is a high-performance, open-source key-value database. is the perfect solution for building high-performance, scalable Web applications that can be stored in memory as well as persisted. Because you want to use cross-process, data caching across service levels, after comparing multiple scenarios, you decide to use Redis. By the way, make the Redis installation process available for review.
- Download Redis
- Unzip Redis
- Compiling and installing Redis
- Configure Redis
- Start Redis
- Add Boot entry
- Redis Configuration Parameters
1. Download Redis
Currently, the latest Redist version is 3.0, using wget
the download command as follows:
# wget http://download.redis.io/releases/redis-3.0.4.tar.gz
2. Unzip the Redis
When the download is complete, use the tar
command to extract the downloaded file:
# TAR-XZVF Redis-3.0.4.tar.gz
3. Compiling and installing Redis
Switch to the program directory and perform the make
command compilation:
# CD redis-3.0.4# make
Execute the Install command
# make Install
make install
After the installation is complete, the /usr/local/bin
following executables are generated under the directory, which are:
redis-server
: Redis Server-side startup program
redis-cli
: Redis Client Operations tool. You can also use Telnet to manipulate it based on its plain text protocol.
redis-benchmark
: Redis Performance Test Tool
redis-check-aof
: Data Repair Tool
redis-check-dump
: Check the Export tool
Note
Some machines will appear similar to the following error:
MAKE[1]: Entering directory '/root/redis/src ' you need TCL 8.5 or newer on order to run the Redis test ...
This is because no installation is tcl
causing the installation to be yum
:
Yum Install Tcl
4. Configure Redis
To copy a configuration file to a /etc/
directory:
# CP redis.conf/etc/
In order for Redis to run in the background, it is generally necessary to modify the redis.conf file:
Vi/etc/redis.conf
Modify the daemonize
configuration entry to yes
enable the Redis process to run in the background:
Daemonize Yes
5. Start Redis
When the configuration is complete, start Redis:
# cd/usr/local/bin#./redis-server/etc/redis.conf
Check the startup situation:
# Ps-ef | grep Redis
See a line similar to the following to indicate a successful start:
Root 18443 1 0 13:05?
6. Add Boot entry
Let the power on Redis
run to add it to a rc.local
file, or add it as a system service service
. This article uses rc.local
the way that is added service
please refer to: Redis Configuration for service system services.
In order for Redis to start automatically after the server restarts, the startup command needs to be written to the boot entry:
echo "/usr/local/bin/redis-server/etc/redis.conf" >>/etc/rc.local
7. Redis Configuration Parameters
In the previous operation, we used the parameters to make the Redis process run in the background, and here are some other common Redis boot parameters:
- Daemonize: Whether to run daemon mode later
- Pidfile:pid File Location
- Port: Port number for listening
- Timeout: Request time-out
- Loglevel:log Information level
- Logfile:log File Location
- Databases: number of open databases
- Save *: How often the snapshot is saved, the first * indicates how long, and the third * indicates how many times the write operation is performed. Snapshots are automatically saved when a certain number of writes are performed within a certain amount of time. You can set multiple conditions.
- Rdbcompression: Whether to use compression
- Dbfilename: Data Snapshot file name (only file name)
- Dir: Save directory for data snapshots (directory only)
- AppendOnly: If the appendonlylog is turned on, each write will record a log, which will improve the data anti-risk ability, but affect the efficiency.
- Appendfsync:appendonlylog How to sync to disk. Three options, each write is forced to call Fsync, enable Fsync per second, do not call Fsync wait for the system to synchronize itself
Article turned from: 1.http://itbilu.com/linux/management/4kb2ninp.html
2.http://itbilu.com/linux/management/nkbxg9kol.html
Go: centos6.5_x86 install Redis.