Windows安装Redis、配置密码、远程访问和自启动

2018-11-13 10:32
8868
31824

突然发现西部数码云服务器(Windows server 2008)停机了,说是安全问题,并且无法启动。提交工单后反馈才知道是redis没有设置密码,并且“protected-mode”,存在严重的安全隐患,所以给停机了。

下面主要说下redis安装配置的步骤:

1.安装环境

      安装环境为Windows10和Windows server 2008;

2.下载redis

      redis官方没有Windows版本的redis,需要到GitHub去下载,下载地址为: 快速传送

3.解压安装包

       解压后文件目录如下:

4.修改配置文件

        redis 3.2具有保护模式(protected-mode),为了服务器安全,不建议关闭保护模式(protected-mode = no);

        如果只是本机访问,那么把bind设置为127.0.0.1就可以;如果需要远程访问,则需要设置密码,requirepass  password(你的密码);

        本人需要远程访问,所以配置文件“redis.windows-service.conf”(注意不要选错哟)修改如下:

5.注册服务

        为了不每次启动redis都要开启个黑框口,误关后redis就停止了,要注册redis服务,让redis后台运行。

a.使用管理员命令进入redis解压目录:

b.使用命令“redis-server --service-install redis.windows-service.conf --loglevel verbose”注册服务:

c.使用“redis-server --service-start”启动服务 :

d.redis的其他命令:

卸载服务:redis-server --service-uninstall

停止服务:redis-server --service-stop

6.配置环境变量

        为了不每次启动redis都需要进到redis的安装目录才能执行命令,我们需要配置redis的环境变量,步骤如下:

       右键桌面“我的电脑”——>“属性”——>“高级系统设置”——>“环境变量”:添加变量“REDIS_HOME=D:\Redis-x64-3.2.100”,然后再path变量后加上“;%REDIS_HOME%”就好,这样使用管理员进入命令窗口就可以执行redis命令了,如下图:

7.设置开机启动

        需要设置开机启动的童鞋可以看这里,win+r快捷键,输入services.msc回车打开服务窗口:

       找到redis服务,双击将启动类型改为自动,如下:

至此,Windows安装redis 3.2已经完成!

全部评论

2020-10-25 12:20:58.0
Yes, I love it! <a href="http://trans-america.ca/prednisolone-acetate-ophthalmic-suspension-cats">prednisolone side effects feline</a> Friday's gathering at the interfaith center - a former Jewish synagogue near downtown Los Angeles with Stars of David etched into the stained glass windows - aims to encourage women to participate fully in Muslim prayer and education.
2020-10-25 12:20:57.0
The United States <a href="http://asoupar.ir/?order-finasteride-online-uk">where can you get finasteride</a> They never wanted to make this movie in the first place," Mike Paul, crisis management consultant and president of Reputation Doctor LLC, told Reuters Insider.
2020-10-25 12:20:57.0
I'd like to apply for this job <a href="http://asoupar.ir/?order-finasteride-online-uk">buy finasteride on the net</a> Among the most active names,Chesapeake Energy rose 4.6 percent to $23.81 whileNewfield Exploration was up 4.1 percent at $33.83.
2020-10-25 12:20:55.0
I'd like to cancel a cheque <a href="http://kaimo.dk/amaryl-m2-forte/">care indoor amaryllis after bloom</a> There's plenty to criticize about Schultz's campaign and the awkward position into which it puts Starbucks' baristas and customers
2020-10-25 12:20:54.0
I sing in a choir <a href="http://wilkinsplastering.co.uk/careprost-before-after-reddit.html">careprost online free shipping</a> Just last month, the Denver district attorney dropped a case against a man facing felony charges of manufacturing marijuana concentrate and fourth-degree arson
2020-10-25 11:59:18.0
A financial advisor <a href="http://hoosenji.or.jp/careprost-sold-in-usa">careprost reviews makeupalley</a> &ldquo;We have a couple of options, sure,&rdquo; Coughlin said, when pressed if McClain would shift to middle linebacker.
2020-10-25 11:59:17.0
I'm doing a phd in chemistry <a href="http://kaimo.dk/lamisil-one-week-per-month/">lamisil prescription</a> "By Bestinvest's own definition it takes three years of underperformance for a fund to become a 'dog'
2020-10-25 11:59:17.0
Three years <a href="http://neec2010.co.uk/enalapril-side-effects-erectile-dysfunction.aspx">vasotec iv to po</a> Activision claims Noriega's case is different because he only appears in about six minutes of the six-hour Black Ops II game, wasn't used in any marketing material and isn't a musician with protected creative work.
2020-10-25 11:59:16.0
I'm a housewife <a href="http://www.edep.org/tricorder-sound-fx.html">tricorn hat paper pattern</a> This is a form of autism in which those affected usually have a normal IQ, but they may have very poor communication, social and emotional skills
2020-10-25 11:59:16.0
Will I get paid for overtime? <a href="http://understandingmigraine.com/caverta-capsule/">caverta kaufen</a> Yes there are a number of options available, you can set your browser either to reject all cookies, to allow only "trusted" sites to set them, or to only accept them from the site you are currently on.