Source: keenwon.com/1275.html
I have been remaking the home page of the company’s Intranet these days, and all the information was obtained from other systems. The product originally planned to directly upload static pages, and JSONP asynchronously fetch data. But on one hand, JSONP is a pit (always dislike), and on the other hand, if the data of the entire page is asynchronously retrieved, when the page is just opened, it will be blank, and the experience is extremely poor. So I decided to use Node.js + Express + Redis for a quick fix. I have been working on Redis this morning and I have read a lot of articles. Maybe it is the version or other reasons. They did not mention the problems I met, but they finally deployed it.
Download the Redis
There are various versions available on the Redis website download page. I deployed it on Windows this time and will download it on GitHub. The current version is 2.8.12, directly decompress, in\ bin\release directory there is a compressed package, this is what we need:
Start the Redis
Open a command window directly from the directory above and run:
redis-server redis.windows.conf
Copy the code
QForkMasterInit: System error caught. Error code= 0x000005AF, message=VirtualAllocEx failed.: unknown error. The reason is a memory allocation problem (which probably won’t happen if you have a tough computer). There are two solutions. First, use the –maxmemory command to limit the memory of Redis at startup:
redis-server redis.windows.conf --maxmemory 200m
Copy the code
The second method is to modify the configuration file redis.windows.conf:
maxmemory 209715200
Copy the code
Note that the unit is byte.
Redis.windows. conf (redis.windows.conf)
If you close CMD, Redis will be closed. Should Redis be open all the time? This is obviously unscientific, so here’s how to deploy it on the server.
The deployment of Redis
Redis can be installed as a Windows service, which starts automatically after startup (there is no DOS CMD window, which is a good idea).
redis-server --service-install redis.windows.conf
Copy the code
Once installed, you can see that Redis is already available as a Windows service:
However, after the installation, Redis does not start, and the startup command is as follows:
redis-server --service-start
Copy the code
Stop command:
redis-server --service-stop
Copy the code
You can also install multiple instances
Redis-server --service-install -- service-name redisService1 -- port 10001Redis-server --service-start -- service-name Redisservice1redis-server --service-install -- service-name redisService2 -- port 10002redis-server --service-start - service-name redisservice2redis-server --service-install - service-name redisService3 - port 10003Redis-server - service - start - service - name redisService3Copy the code
Uninstall command:
redis-server --service-uninstall
Copy the code
One final note: version 2.8 does not support 32-bit systems, so you need to download version 2.6 for 32-bit systems. Version 2.6 does not have the same ease of deployment. It provides a program called RedisWatcher that runs Redis Server and restarts automatically when Redis stops.
Also recommend a Redis visual management tool: Redis Desktop Manager, the official website download address is blocked, you can download v0.7.6 version on my web disk, put a screenshot:
\
\