又想让Redis自启动的时候

时间:2022-06-06 08:28:07

https://github.com/MicrosoftArchive/redis/releases

下载Redis-x64-3.2.100.zip

设置暗码

redis.windows.conf:

################################## SECURITY ################################### # Require clients to issue AUTH <PASSWORD> before processing any other # commands. This might be useful in environments in which you do not trust # others with access to the host running redis-server. # # This should stay commented out for backward compatibility and because most # people do not need auth (e.g. they run their own servers). # # Warning: since Redis is pretty fast an outside user can try up to # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # # requirepass foobared requirepass 123456 这就是暗码

解压到你的目录下;

2:

D:\soft\Redis>redis-server.exe redis.windows.conf

又想让Redis自启动的时候

3:

再新打开一个cmd(不要*之前打的Cmd窗口),启动Redis客户端:

D:\soft\Redis>redis-cli.exe

4 :获取Redis中某个key的值,提示无权限。

127.0.0.1:6379> get name (error) NOAUTH Authentication required. 127.0.0.1:6379>

5:

通过暗码进入访谒,使用 auth + 暗码,如下:

127.0.0.1:6379> get name (error) NOAUTH Authentication required. 127.0.0.1:6379> auth 123456 OK 127.0.0.1:6379> get name "ok" 127.0.0.1:6379>

6、Spring整合Redis的一些配置(JedisPool单机版): Spring.xml文件配置的JedisPool池: Java代码 保藏代码 <bean> <constructor-arg ref="jedisPoolConfig"></constructor-arg> <constructor-arg value="${redis.host}" /> <constructor-arg value="${redis.port}" type="int" /> <constructor-arg value="${redis.timeout}" type="int" /> <constructor-arg value="#{‘${redis.password}‘!=‘‘?‘${redis.password}‘:null}" /> <!-- <constructor-arg value="${redis.db.index}" type="int" /> --> </bean> redis.properties配置文件 Java代码 保藏代码 #*****************jedis连接参数设置*********************# #redis处事器ip# redis.host=192.168.100.66 #redis处事器端标语# redis.port=6379 #超不时间:单位ms# redis.timeout=3000 #授权暗码,没有暗码则不设置,但属性要保存# redis.password=123456 7、如果不是安置版的Redis,又想让Redis自启动的时候,可以向Windows添加自启动处事:   1、进入到Redis的安置目录 D:\soft\Redis>   2、执行命令: redis-server --service-install redis.windows.conf --loglevel notice --service-name Redis   3、完整示例: D:\soft\Redis>redis-server --service-install redis.windows.conf --loglevel notice --service-name Redis --service-install redis.windows.conf 指定redis配置文件 --loglevel notice 指定日志级别 --service-name Redis 指定处事名称 运行功效如下( Redis successfully installed as a service.): D:\soft\Redis>redis-server --service-install redis.windows.conf --loglevel notice --service-name Redis [7176] 12 Jul 09:34:50.730 # Granting read/write access to ‘NT AUTHORITY\NetworkService‘ on: "D:\soft\Redis" "D:\soft\Redis\" [7176] 12 Jul 09:34:50.730 # Redis successfully installed as a service.   4、安置处事后,默认不是顿时启动的,,但启动类型是自启动,如果想顿时启动,请执行命令:
redis-server --service-start 处事告成启动显示如下: [9876] 12 Jul 09:57:41.251 # Redis service successfully started. 或者重启电脑。 遏制处事: redis-server --service-stop 5、删除Redis处事: redis-server --service-uninstall

windows 安置 Redis