redis install
1. Install wget (skip already installed)
yum install wget
2. Download redis
wget http://download.redis.io/releases/ redis version, such as http://download.redis.io/releases/redis-4.0.2.tar.gz
3. Installation
tar xzf redis-4.0.2.tar.gz
make MALLOC=libc
make install
3. Test whether the installation is successful
cd src/ ./redis-server Specifies the configuration file to start./redis-server ../redis.conf
redis configuration
1. Run cd redis directory vi redis.conf in background process mode, and change daemonize no to daemonize yes
2. Configure the Redis command to copy the Redis startup script to the /etc/init.d directory cp redis/utils/redis_init_script /etc/init.d/redisd
Modify the Redis.conf specified by CONF= in /redis_init_script
Start: service redisd start Shut down: service redisd stop
3. Configure the redis-cli command path in the path
vim /etc/profile PATH=$PATH:$HOME/bin:/../redis目录/src/
export PATH
Start the client directly with redis-cli
4, configure the boot auto-start
Execute chkconfig redisd on, if Redis is a persistent key-value database error occurs, modify the Redis startup script
cd redis directory/utils vim redis_init_script
Write a comment at the top of the file
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
After saving, execute chkconfig redisd on again. The comment means that the redis service must be started or shut down at run levels 2, 3, 4, and 5. The startup priority is 90, and the shutdown priority is 10.
Basic use and introduction of Redis
1. Set a password
CONFIG SET requirepass "password" auth password
2. Set ip
Redis does not allow external network connections by default, you need to modify the bind ip address
bind 127.0.0.1 local
bind 195.165.1.10 external network
bind 192.165.42.2 LAN
3. Redis service program
redis-server : redis service
redis-cli : Provides a redis client for connecting to redis services
redis-sentinel: monitoring management, notification and instance failure backup service of redis instances
redis-benchmark : redis performance testing tool
redis-check-aof : If persisted in aof mode, it is used to quickly repair when an accident occurs
redis-check-rdb: if persisted in rdb mode, it is used for quick repair when an accident occurs