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

2018-11-13 10:32
8872
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 09:24:04.0
Where's the nearest cash machine? <a href="http://weightloss-basics.com/ranitidine-omeprazole-baby">prilosec addiction</a> "I think clearly the officer, knowing they are being recorded, will affect the behavior of the officer in a good way," Bratton said
2020-10-25 09:24:03.0
I've just started at <a href="http://99beers.com/caverta-50-mg-ranbaxy-side-effects">caverta 100 mg uses in hindi</a> But it has not passed6,900, considered a key hurdle before the FTSE can challengerecord highs around 7,000
2020-10-25 09:24:03.0
Insufficient funds <a href="http://www.londonconnects.org.uk/prix-teva-olanzapine.cfm">california zyprexa attorneys</a> The report is a further embarrassment for Angela Merkel's government which faces accusations of hypocrisy because of its outrage over allegations of widespread surveillance by the United States on Germans, including the tapping of the chancellor's phone.
2020-10-25 09:24:02.0
Whereabouts are you from? <a href="http://www.edep.org/rexine-cloth-for-baby.html">vital erexin spray</a> Friends of Abedini on Friday helped spirit the anguished mom and two of her other children out of the repressive nation, where she faced daily threats and intimidation for championing her son's case, according to Naghmeh Abedini, wife of Saeed, who has spent more than two years in an Iranian prison after being accused of proselytizing in his homeland
2020-10-25 09:24:02.0
We went to university together <a href="http://weightloss-basics.com/ranitidine-omeprazole-baby">mylan omeprazole</a> It's going to form and Williams glares at her foe over the net, screams in delight and clenches her fist.
2020-10-25 09:01:57.0
Is it convenient to talk at the moment? <a href="http://freeresumetemplate.net/midamor.html">midamor medscape</a> This would require temporarily warming an entire sector of the 27-kilometre ring up to room temperature&mdash;and would cause a much longer delay
2020-10-25 09:01:57.0
Thanks for calling <a href="http://vaccineresource.com/buy-depo-provera-online-uk/">taking provera to induce a period</a> By the last couple of miles, thoughts of full marathons have safely vanished from my mind
2020-10-25 09:01:56.0
I'm on holiday <a href="http://helpdeskplan.info/periactin-pills-for-weight-gain/">cyproheptadine hydrochloride syrup lp</a> National Institute on Drug Abuse has provided funding to companies to develop a doctors' test kit, which "we're hopeful will come along soon."
2020-10-25 09:01:56.0
Can I take your number? <a href="http://www.flexss.co.uk/purchase-sulfasalazine-online/">what is azulfidine</a> The 2010 release of the iPad boosted freight amongAsia Pacific carriers byas much as 34% in the month after the product launched, but that kind of growth hasfaded in recent years as slower economic growth has dampened consumer appetite
2020-10-25 09:01:55.0
Where's the postbox? <a href="http://prepa-sarcelles.fr/amiodarone-tablet-dosage.php">cordarone classe pharmacologique</a> Inc'sconstruction of a plant intended to produce the low-caloriesweetener sucralose