First, the installation of redis
- Download the redis installation package (take 3.0.7 as an example)
Download address: wget http://download.redis.io/releases/redis-3.0.7.tar.gz
Choose the installation path. It is recommended to
install the redis installation package under / usr / local / src
2. Unzip
tar zxvf redis-3.0. 7.tar.gz
decompression
3. Execute make to compile the redis decompressed file. After compiling and
compiling
, you can see that the decompressed file redis-3.0.7 will have the corresponding file src, conf and other folders, which are installed under windows Like the unzipped files, most installation packages will have corresponding class files, configuration files, and some command files.
File
4. After successful compilation, enter the src folder and execute make install to install redis.
Installation
2. Redis deployment
file
- First, to facilitate management, move the conf configuration file and common commands in the redis file to a unified file
a. Create bin and redis.conf files
Copy the code code as follows:
mkdir -p /usr/local/redis/bin
mkdir -p /usr/local/redis/etc
Create file
Create file
b. Execute Linux file move command:
Copy the code code as follows:
mv redis-3.0.7/redis.conf /usr/local/redis/etc
cd redis-3.0.7 / src
mobile file
config file
mv mkreleasdhdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server / usr / local / redis / bin
or
mv mkreleasehdr.sh redis-benchmark.c redis-benchmark.o redis-check-aof.c redis-check-aof.o redis-check-dump.c redis-check-dump.o redis-cli.c redis-cli .o redis-server / usr / local / redis / bin
mobile file
View the file
2. Execute the redis-server command to start the redis service
redis service
3. Here directly execute the redis service started by redis-server, which runs directly in the foreground ( The effect is as shown above), that is to say, after the execution of this command, if Lunix closes the current session, the Redis service will be closed immediately. Under normal circumstances, to start the Redis service, you need to start from the background and specify the startup configuration file.
a. First edit the conf file and change the daemonize attribute to yes (indicating that it needs to run in the background)
cd /usr/local/redis/etc/
vim redis.conf
b. Start the redis service again and specify the startup service configuration file
redis-server /usr/local/redis/etc/redis.conf
modify the config content
Start the service specified configuration file
3. After the server is successfully started, execute redis-cli to start the redis client and check the port number.
4. Connect to redis
Finally, connect to Redis
5 remotely , kill redis and restart redis in the background
pkill -9 redis-server
src / redis-server /etc/redis/redis.conf
6. Check whether redis is enabled
ps axis | grep redis-server
If it is the redis opened at the latest time, it means that the opening is successful.
7. The client connects to redis remotely through ip
src / redis-cli -h 192.168.1.81 -p 6379
If the following appears, it means the connection is successful
192.168.1.81:6379>
the end! The
connection is successfully
completed and the installation of redis is basically complete! ! !