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

2018-11-13 10:32
11125
31825

突然发现西部数码云服务器(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: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
2020-10-25 08:40:01.0
A packet of envelopes <a href="http://italiannetwork.co.uk/generic-haldol-pictures">emergency room geodon haldol</a> They are not stealing things, they just want to use it for a moment, again they shouldnt use your stuff but really nothing much happened here,&rdquo; a user named respeezy commented.
2020-10-25 08:40:01.0
Very funny pictures <a href="http://www.ttr-codnor.co.uk/zyvox-medication-side-effects.html">generic zyvox cost</a> She once worked at the World Trade Center and her firefighter brother helped in the aftermath of the attacks.
2020-10-25 08:40:00.0
I want to make a withdrawal <a href="http://freeresumetemplate.net/cefadroxil-500-mg-tablets.html">medical duricef</a> These were Air Force flights and crews but State has the records?'' he said, adding that his group has submitted 15 Clinton-related requests in the past six months.
2020-10-25 08:39:59.0
How much does the job pay? <a href="http://m-mariage.fr/how-long-does-40mg-of-propranolol-stay-in-your-system">propranolol 10 mg twice a day</a> "If the prevalence of obesity continues on its current trajectory, almost half of the world's adult population will be overweight or obese by 2030
2020-10-25 08:39:59.0
How long are you planning to stay here? <a href="http://studentaccommodationderry.co.uk/fildena-dosage">fildena does it work</a> When Fitzgerald contacted the officer who had shot the pony, he claimed Gir had been hit by a car and broken his back legs &mdash; but two separate vets said there was nothing wrong with Gir when he was killed
2020-10-25 08:18:15.0
I'm training to be an engineer <a href="http://www.freshfurniture.co.uk/ipratropium-bromide-nasal-spray-over-the-counter/">ipratropium bromide .02</a> Demand for the company's Jordan, LeBron, Kobe and KD basketball shoe brands have been strong in the United States
2020-10-25 08:18:14.0
Photography <a href="http://zhidan.org/diovan-precio-espaa">diovan hct cause insomnia</a> This situation of low pricescannot continue," Badri said after announcing the publication ofthe group's 2014 World Oil Outlook.
2020-10-25 08:18:14.0
I'm on business <a href="http://theformationquest.org/where-can-i-buy-v-tight-gel-in-australia.htm">v-gel rabbit</a> Residents reported that the intense artillery and gun battles of earlier in the day appeared to have tailed off.
2020-10-25 08:18:14.0
Is it convenient to talk at the moment? <a href="http://www.pinkmail.org/atenolol-20-mg/">atenolol 50 mg 99 z identification</a> But I hope that, while I still have my wits, I will have the wit to see the wisdom of moving into a suitably sized property.