First verify that GCC and TCL are installed
sudo Yum Install gcc-c++sudoyuminstall tcl
Unzip, compile and install
TarZXVF redis-3.0.5.Tar. GZsudo MVredis-3.0.5/usr/src/CD/usr/src/redis-3.0.5/sudo Makesudo MakeTestsudo Make Install# If you do not want to install to/usr/local/bin, with this statement will be installed to/opt/redis/redis-3.0. 5/bin, and then to/usr/bin to build the soft chain .sudo Makeprefix=/opt/redis/redis-3.0.5 Install
Installation is very free, where to compile all can be, useful is the last generation of the few binary. Redis consists of four executables: Redis-benchmark, Redis-cli, Redis-server, redis-stat four files, plus a redis.conf that forms the final available package for the entire redis. Their role is as follows:
- Redis-server:redis Server Daemon Startup program
- 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 tools to test the read and write performance of Redis in your system and in your configuration
- Redis-stat:redis Status Detection Tool to detect Redis current status parameters and delay status
Redis can now be started, and Redis has only one boot parameter, which is his profile path.
Redis-server/etc/redis.conf
The daemonize parameter for the default redis.conf file in the directory is no, so Redis does not run in the background. Modify to Yes to run Redis in the background. In addition, the configuration file specifies the address of the PID file, log file and data file, if necessary, the default log information is directed to stdout.
The following are the meanings of the main configuration parameters of redis.conf:
- 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, excluding directory)
- Dir: Save directory for Data snapshot (this is the directory)
- 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, Fsync per second, do not call Fsync wait for the system to synchronize itself)
Establish user and log directories for Redis
Useradd Redis mkdir -p/var/lib/redischown Redis.redis/var/lib/redis
To modify the Save directory for the data snapshot, you need to modify redis.conf
' Dbfilename ' file name. dir /var/lib/redis
Modify the log file location
mkdir -p/var/log/redischown redis.redis/var/log/file' StdOut'if for logging but daemonize, logs'll be sent to/dev/ NULL /var/log/redis/redislog
CENTOS6 Installing Redis