Installation
One, decompression source installation package, through TAR-ZXVF redis-3.0.2.tar.gz decompression source;
#cd/usr/local/software/
#tar-ZXVF redis-3.0.2.tar.gz
Second, enter the extracted directory, execute make compile source code;
When the make command is completed, 6 executables are generated in the SRC directory, namely Redis-server, REDIS-CLI, Redis-benchmark, redis-check-aof, Redis-check-dump, Redis-sentinel.
[email protected] redis-3.0.2]# make MALLOC=LIBC
Third, perform the Make install installation
Perform a make install installation, or specify the installation directory via make Prefix=/usr/local/redis install. The default installation, copy the previously generated executables to the/usr/local/bin directory. This is specified by prefix to the/usr/local/software/redis directory.
[[email protected] redis-3.0.2]# make Prefix=/usr/local/software/redis Install
Iv. Modifying configuration files
1, copy the source directory under the Redis configuration file redis.conf to the/usr/local/software/redis/directory.
CP redis.conf/usr/local/software/redis/
2, modify the configuration items, as required; If you do not modify, using the default configuration can also
The default installation of the path has been added to the environment variable, you can directly execute commands at the command line;
# Vi/etc/profile
Export Path=/usr/local/software/redis/bin: $PATH
Source/etc/profile
Six, start the service:
To see if the port is occupied: NETSTAT-NTLP |grep 6379
Start Redis
Nohup redis-server/usr/local/software/redis/redis.conf &
Vii. Test if Redis can connect
Redis-cli-p 6379
Adjusting the configuration file
To modify configuration parameters:
#vi/usr/local/software/redis/redis.conf
......
#修改守护进程为yes, the default is no
Daemonize Yes
#修改pid文件路径, this is optional and can be used with the default path.
Pidfile/usr/local/software/redis/redis.pid
#配置日志文件路径
LogFile "/usr/local/software/redis/logs/redis.log"
#新增redis密码
Requirepass Redis
......
Configure the Service
First, create the SYSTEMCTL management Redis configuration file:
Creating a configuration file
Touch/usr/lib/systemd/system/redis.service
Second, the configuration file sample:
[Unit]
Description=redis
After=syslog.target Network.target Remote-fs.target Nss-lookup.target
[Service]
Type=forking
Pidfile=/usr/local/software/redis/redis.pid
Execstart=/usr/local/software/redis/bin/redis-server/usr/local/software/redis/redis.conf
Execreload=/bin/kill-s HUP $PIDFile
Execstop=/bin/kill-s QUIT $PIDFile
Privatetmp=true
[Install]
Wantedby=multi-user.target
Third, through the systemctl to heavy-duty system services:
[Email protected] system]# Systemctl daemon-reload
Iv. starting Redis via Systemctl:
[[email protected] system]# systemctl start Redis
V. To set up MySQL boot by systemctl:
[[email protected] system]# Systemctl enable Redis
Redis Installation and Configuration