1. Installing Redis:
Upload files to a fixed directory; version: redis-3.2.0
Tar xzvf redis-3.2.0.tar.gz
cd redis-3.2.0 make
&& make install
2. Start Redis
Redis-server redis.conf
3, generally will not be modified on the original configuration file, the original configuration file equivalent to backup. So create on the CENTOS7
mkdir /etc/redis
4. Copy the Redis original configuration file to/etc/redis
CP redis.conf /etc/redis/
Start with the latest configuration file:
Redis-server /etc/redis/redis.conf
If you close the command-line window directly after startup, Redis will run in the background, but you cannot press CTRL + C and if you press this to terminate Redis, you can simply turn off the window
[Root@localhost ~]# ps-ef |grep redis
root 30337 1 0 09:10? 00:00:00 redis-server 127.0.0.1:6379
root 32116 28120 0 09:18 pts/1 00:00:00 grep--color=auto Redis
The above Redis is started.
5. After startup, how to turn off Redis.
REDIS-CLI shutdown
[root@localhost ~]# redis-cli shutdown
[root@localhost ~]# ps-ef |grep redis
root< c4/>32257 28120 0 09:19 pts/1 00:00:00 grep--color=auto Redis
After execution, Redis shuts down.
6. Redis Add background boot
Daemonize Yes
7. Configure Redis log file location:
LogFile "/users/wang/documents/redis.log"
7. Add to
Boot-up configuration
echo "/usr/local/bin/redis-server/etc/redis/redis.conf &" >>/etc/rc.local
8. Add password
vi/etc/redis/redis.conf
require pass paas2016
Add Password paas2016
Redis is not allowed to connect to other clients by default:
need to release in config file: Bind 127.0.0.1 to allow other clients to operate
Client connections:
ss:~ wqp$ redis-cli-h hostname-p 6379-a paas2016 hostname:6379> set AA "AAAA" OK hostname:6 379> get AA "AAAA"