Environment under Windows 1. Set up hosts
set duapphosts=127.0.0.1 sqld.duapp.comset redisduapphosts=127.0.0.1 redis.duapp.comecho %duapphosts% >> C:\Windows\System32\drivers\etc\hostsecho %redisduapphosts% >> C:\Windows\System32\drivers\etc\hosts
2. Download Redis-windows version
Redis official website download page: http://redis.io/download
Windows under Redis Project: Https://github.com/MSOpenTech/redis
Find and download the latest ZIP package on the releases page: https://github.com/MSOpenTech/redis/releases
3. Unzip the installation
Compress the downloaded file redis-2.8.17.zip
to the redis-2.8.17 directory. For example: D:\DevlopPrograms\redis-2.8.17
.
If you need a simple test, the mouse can double-click redis-server.exe
, if yes, a command-line window will appear later to display the execution status.
If you are not a administrator user, you may need to run as an administrator. or refer to the N method for Windows 7 to enable the Super Admin Administrator account
Simple test, you can use it redis-cli.exe
and automatically connect to the local server when you open it. You may enter to info
view server information.
If you want to benchmark, you can start the server after you cmd中
run the redis-benchmark.exe
program.
4. Startup and Registration Services
If you are ready for long-term use, you need to register as a system service.
Go to cmd and switch directories:
D:cd D:\DevlopPrograms\redis-2.8.17
The registration service can be saved as a service-install.bat
file:
redis-server.exe --service-install redis.windows.conf --loglevel verboseredis-server --service-start
The uninstall service can be saved as a uninstall-service.bat
file.:
redis-server --service-stopredis-server --service-uninstall
When registering a service, you can –service-name redisService1
specify the service name directly by parameters, which is suitable for installing multiple instances, and the same is true for uninstallation.
You can also specify a profile directly when starting a Redis server, which can be saved as a startup.bat
file:
redis-server.exe redis.windows.conf
Of course, after you specify a profile, you may encounter problems with startup failures. At this point, modify the configuration file to specify the maxheap
parameters.
5. Modify the configuration file
Modify the configuration file redis.windows.conf
and save as encoding if you have Chinese UTF-8
.
# 修改端口号# port 6379port 80# 指定访问密码# requirepass foobaredrequirepass 6EhSiGpsmSMRyZieglUImkTr-eoNRNBgRk397mVyu66MHYuZDsepCeZ8A-MHdLBQwQQVQiHBufZbPa# 设置最大堆内存限制,两者设置一个即可# maxheap <bytes>maxheap 512000000# 设置最大内存限制, 两者设置一个即可# maxmemory <bytes># maxmemory 512000000
At this point, if you use the client to access, using the following cmd command, you can save as a client.bat
file:
redis-cli.exe -h redis.duapp.com -p 80 -a 6EhSiGpsmSMRyZieglUImkTr-eoNRNBgRk397mVyu66MHYuZDsepCeZ8A-MHdLBQwQQVQiHBufZbPa
6. Other additional
Management tools: Redisstudio:https://github.com/cinience/redisstudio
Of course, there are some Word documents in the catalogue that are interesting to read.
For more information, please refer to: Renfufei's Column-redis:http://blog.csdn.net/renfufei/article/category/2470713
Redis Local Environment Setup