https://blog.csdn.net/qq_40667143/article/details/83278724
A, redis Introduction
Redis is a completely free open source, is a high-performance key-value database.
Redis and other key - value caching product has the following three characteristics:
Redis supports data persistence, data in memory can be saved to disk, reboot to load when you can be reused.
Redis only supports simple key-value data types, while also providing a storage list, set, zset, hash and other data structures.
Redis data backup data backup support, i.e., master-slave mode,
Two, Redis installation
1, Redis official download site is: http: //redis.io/download (here to download the Linux version of Redis source package)
The Redis source package uploaded from the windows to the Linux system directory / opt / redis
2. Extract
tar -zxvf uploaded package redis
3. Switch to the unpacked directory.
cd-repeat 4.0.0
4. compiled using the make command (Note that the compiler needs to support C language compiler gcc, and if not, you need to install gcc. You can use rpm -q gcc gcc installed to see whether, if the compiler error, use make clean to clear temporary files. after that, find the cause of the error, solve the problem and then re-install.)
5, after the completion of the translation into the src directory and installed using make install
Three, Redis deployment
To facilitate the management, the configuration file conf Redis files and frequently used commands move to unified file
1, the first switch to the first cd / usr / local
2, copy the code as follows:
mkdir -p / usr / local / redis / (subdirectories mkdir -p parameter is to create a directory that does not exist directly) bin
mkdir -p /usr/local/redis/etc
3, the implementation of mobile Linux file command
First switch to cd /opt/redis/redis-4.0.0
Perform the following to copy:
cp redis.conf /usr/local/redis/etc
cp mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server redis-sentinel /usr/local/redis/bin
Here direct execution of Redis Redis-server start service is run directly (results shown above) at the front desk that is, after you execute the command, if Lunix close the current session, the Redis service will be shutdown. Under normal circumstances, start the Redis service need to start from the background,
4, configuration daemon start redis service
First, enter the cd etc directory editor vi redis.conf
Note: If you are using RedisClient need to turn off the firewall to start report Connection refused: connect
Then need vim redis.conf 1, Note bind 127.0.0.1 2, the protected-mode to protected mode and then no ./redis-server /usr/local/redis/etc/redis.conf
Then test the database to add a string.
The following is redis common configuration.
The more important three executable files:
redis-server: Redis server program
redis-cli: Redis client program, which is a command-line tool operation. It may also be used according to its plain text telnet protocol.
redis-benchmark: read and write performance Redis performance testing tools, test Redis in your system and configuration.
Modify redis.conf file
daemonize yes --- yes amended as backgrounding
requirepass 123456 ---- Comment cancel the account password settings
ps aux | grep '6379' --- query port
kill kill -15 9886 --- Reset
kill -9 9886 --- forced to kill
stop service iptables stop firewall
redis command connection
./redis-cli -h 127.0.0.1 -p 6379 -a "123456 " --- redis use the account password to connect
PING result indicates success
Stop Redis
pid Redis or kill redis-cli the shutdown process
----------------
Disclaimer: This article is CSDN blogger "dream destined to be lonely journey" of the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/qq_40667143/article/details/83278724