Windows Redis InstallationDownload Windows version redis or github download
Unzip the download of the compressed package is the following figure:
Three ways to start: Enter the Downloads folder to select the version you want to unzip into the folder: The first way does not add a profile: Double-click Redis-server.exe, or select "Open Command Window Here" in the current directory, CTRL + mouse clicks. Then drag the Redis-server.exe into the command window, or enter Redis-server.exe carriage return in the command window. The second way to apply a profile at startup: in the current directory Ctrl + mouse click to select "Open Command Window Here", and then drag redis-server.exe into the command window after entering a space, drag the redis.windows.conf into the command window to enter, or enter redis-server.exeredis.windows.conf carriage return in the command window.
The third way to create a Windows service: SC create Redis-master binpath= "\" D:\Java\redis\redissoftware\downloads\redis64-2.8.12\ Redis-server.exe\ "--service-rund:\java\redis\redissoftware\downloads\redis64-2.8.12\redis.windows.conf-- The loglevel verbose "blue" is the service name set and the green section to the corresponding directory. Delete Service: SC Delete the purple section of "Redis-master" instead of the service name you removed.
Linux under Redis installationDownload Linux version Redis This article takes the current latest version 3.2.1 as an example
TAR-ZXVF redis-3.2.1.tar.gz
CD redis-3.2.1
#直接make compile
make #可使用root用户执行 ' install ' to copy the executable file to the/usr/local/bin directory. So you can just hit the name and run the program. Make
Install
Three ways to start:
The first way to start by default:
Redis-server
The second way to start the background mode:
#加上 ' & ' can enable Redis to run in a background program
./redis-server &
or modify redis.conf daemonize No is yes
and then
Redis-server redis.conf
The third way to start is to add Linux services (start with script provided by Redis):
Start the Redis service in a production environment using a startup script. The startup script Redis_init_script is located in the/utils/directory located in Redis.
#大致浏览下该启动脚本, it is found that Redis habitually uses the listener's port name as a configuration file, and we follow this convention later.
#redis服务器监听的端口
redisport=6379
#服务端所处位置, the default storage after make install and '/usr/local/bin/redis-server ', if not make install need to modify the path, the same below.
exec=/usr/local/bin/redis-server
#客户端位置
cliexec=/usr/local/bin/redis-cli
#Redis的PID文件位置
Pidfile=/var/run/redis_${redisport}.pid
#配置文件位置, need to modify
conf= "/etc/redis/${redisport}.conf"
Copies the modified profile to the specified directory in the name of the port according to the startup script requirements. You need to use the root user.
Mkdir/etc/redis
CP redis.conf/etc/redis/6379.conf
Copy the startup script to the/ETC/INIT.D directory, and this example names the startup script as REDISD (usually at the end of D as the background self-boot service).
CP REDIS_INIT_SCRIPT/ETC/INIT.D/REDISD
Set to boot start Note: This is directly configured to turn on the Chkconfig REDISD on will report an error: Service REDISD does not support chkconfig reference solution, change the beginning of the script to this
#!/bin/sh
# chkconfig: 2345 #
Description: Redis is a persistent key-value database
#
You can then set it to success.
#设置为开机自启动服务器
chkconfig REDISD on
#打开服务
service REDISD start
#关闭服务
service REDISD stop
Additional: Redis Multi-Environment One-click Startup script