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

2018-11-13 10:32
8825
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 11:37:13.0
Very funny pictures <a href="http://www.tourtomashhad.com/donde-comprar-confidor-20/">ou acheter du confidor en espagne</a> We have to ensure that pregnant women get the care they urgently need or we will see the rate of maternal deaths skyrocket."
2020-10-25 11:37:13.0
It's OK <a href="http://kopekciftligi.com.tr/phenazopyridine-over-counter">is pyridium available over the counter in canada</a> In 2011, after an Idaho man opened fire on the White House with a semi-automatic rifle from the street, no one realized the building had been hit by seven bullets until four days later when a housekeeper found a broken window and piece of concrete on a balcony.
2020-10-25 11:37:12.0
Sorry, you must have the wrong number <a href="http://secret.co.jp/dapsone-topical-cost">dapsone topical ointment</a> was not something that I was thinking about while applying to private or state universities as an international student
2020-10-25 11:37:12.0
Nice to meet you <a href="http://www.panjerehweekly.ir/para-que-sirve-la-pastilla-mobic-15-mg/does-cbd-oil-working-for-anxiety-in-dogs-not-pregnant">meloxicam dogs dosage</a> Their use has rocketed in recent years, but there is fierce debate about the risks and benefits
2020-10-25 11:37:11.0
I'd like some euros <a href="http://drandrewbrown.co.uk/vand-sildalis.html">sildalis bestellen</a> Most spare capacity appears to have been the result of pasterrors in forecasting oil demand and efforts to increase theamount of oil eventually recovered by lowering production ratesfrom ageing fields like Ghawar to sustain reservoir energy andprevent water inundating the wells while bringing on new fieldslike Manifa.
2020-10-25 11:15:08.0
Directory enquiries <a href="http://dohon.co.jp/compazine-iv-uses">compazine used for migraine headaches</a> In response to Jenny Jones&#039; report on police surveillance, a spokesperson for the Mayor of London said: "If, as this reports suggests, RIPA powers have been misapplied then that would be a serious matter.
2020-10-25 11:15:07.0
I've only just arrived <a href="http://www.custom-creations.org/grifulvin-v-500-tablet">grifulvin v</a> The homeownership rate, for those under age 35 has fallen from 43.1 percent to 35.8 percent from 2004 to 2014, according to Census data
2020-10-25 11:15:06.0
Will I get paid for overtime? <a href="http://www.motorhomescotland.co.uk/asacol-side-effects.html">asacol side effects infertility</a> In all, six of the Raiders&rsquo; 11 drives (excluding a kneel-down at the end of the first half) were three-and-outs
2020-10-25 11:15:05.0
Thanks for calling <a href="http://livingwitharthritisinfo.net/seroquel-xr-and-quetiapine/">quetiapine interactions valproate</a> So the X Factor live shows start this evening and we can&#39;t wait to see how the contestants will all be styled
2020-10-25 11:15:03.0
How do you spell that? <a href="http://fanatic.ir/medicare-demonstration-project-coumadin-2007">drug interaction aricept and coumadin</a> Security Council considered a draft resolution, pushed by the Palestinians and Arab countries, demanding an Israeli withdrawal from the West Bank within three years