1. Redis Download
Download the appropriate package according to your operating system platform: Https://github.com/MSOpenTech/redis
2. The Redis installation (1) is extracted and then placed in any directory. This example: D:\Program Files\redis. (2) Start Redis under cmd:
- To create a new run-redis.bat in D:\Program Files\redis, open it with Notepad and edit the following: Redis-server.exe redis.conf, save, double-click Run.
- The following results show that the execution succeeded:
You can see that the Redis service port is 6379.
(3) configuration file for Redis: D:\Program files\redis\redis.conf
#是否以后台守护进程运行, default is no, value Yes, no daemonize no #pid文件存放路径pidfile/var/run/redis.pid #配置redis端口, default 6379port6379#绑定ip. Default binding all native IP, generally used in the server multi-IP, can only listen to the intranet server IP, ensure service security bind127.0.0.1#sock文件 Unixsocket/tmp/Redis.sock #客户端超时时间, per second timeout300#log级别, supports four levels, debug,notice,verbose,warning loglevel verbose #log文件路径logfile #log输出到标准设备, logs do not write files, output to the empty device,/deb/NULLlogfile stdout #保存快照的频率, you can set multiple conditions for how often you save a snapshot when you perform a certain amount of write operations. If both are commented out, memory data persistence is not done. If you only use Redis as the cache, do not turn on persistence save<seconds> <changes>Save900 1#是否使用压缩rdbcompression #快照数据库名称 dbfilename #数据库存放路径 dir #redis主从 procedure in the Fill in the master's IP and port number the Lord does not have to make any settings slaveof<masterip> <masterport>#主库服务器口令, this is not required if the primary server does not have Requirepass open Masterauth<master-password>#在master服务器挂掉或者同步失败时, whether the service continues to be served from the server slave-serve-stale-Data Yes #设置redis服务密码, if enabled, the client will need to connect-a specifies the password, otherwise the operation will prompt no permission requirepass foobared #命令改名, equivalent to Linux alias, you can use the change function to shield some dangerous commands rename-command #最大连接数;0indicates no limit maxclients128#最大使用内存 (allocated memory), the recommended production environment to make appropriate adjustments, we use only to do cache, limit 2G. By default, Redis consumes all available memory MaxMemory<bytes>#过期策略, six strategies are available maxmemory-policyvolatile-LRUvolatile-lru//Delete expired and LRU keys (default)Allkeys-lru//remove the key for the LRU algorithmvolatile-random//randomly delete expiring keyAllkeys->random//Random Deletevolatile-ttl//Delete the expiringNoeviction//never expires, returns an error#是否开启appendonlylog, when on, each write will record a log. The equivalent of MySQL binlog, the difference is that each Redis boot reads this file to build the full data. Even if you delete an Rdb file, the data is also secure AppendOnly #日志文件的名称, the default appendonly.aofappendfilename appendonly.aof #异步写append file policy. Like the MySQL thing log write way. Three kinds of Appendfsync Appendfsync always//synchronization, each write to flush to disk, security, slow. Appendfsync everysec//Write per second (default value, recommended value) with MySQLAppendfsync No//give the operating system the flush action .#虚拟内存开关 VMs-enabled no #swap文件, different Redis swap files cannot be shared. Also in production environments, it is not recommended to place the TMP directory VM-swap-file/tmp/Redis.swap #vm大小限制. 0: No limit, recommended 60-80%available memory size VMS-max-memory 0#根据缓存内容大小调整, default 32-byte VM-page-size 32#page数. Every8 page, which consumes 1 bytes of memory. Vm-page-size * vm-pages equals swap file size VM-pages 134217728#vm Maximum number of IO threads. Note:0flag prohibit VM VM use-max-threads 4
Source: http://blog.csdn.net/java2000_wl/article/details/8520593.
3. Test the installation Results
Start cmd, enter the directory where the Redis server is located, and execute each
- Redis-cli.exe
- Set UserName LYC
- Get UserName LYC
Redis (i)----configuration and installation