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

2018-11-13 10:32
11127
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 07:34:34.0
I wanted to live abroad <a href="http://www.lagripe.com/depakote-side-effects-reviews/ropex-vs-ogoplex">what is depakote er 500mg</a> Nancy Barto, who included the provision about disclosing information on abortion reversals as part of broader insurance legislation to prevent women who receive federal subsidies under Affordable Care Act exchanges from being able to buy optional abortion coverage with their plans.
2020-10-25 07:11:35.0
How many weeks' holiday a year are there? <a href="http://rtackett.net/tegretol-and-omeprazole-drug-interactions">tegretol and omeprazole drug interactions</a> The only way to speak the same language as Poroshenko is to defend the people of east Ukraine the same brutal way Poroshenko&rsquo;s limited knowledge of leadership knows
2020-10-25 07:11:34.0
I went to <a href="http://medioambienteyaridos.org/can-i-buy-depo-provera-online">can i buy depo provera online</a> As one official said: &ldquo;We want GPs effectively to have two prescriptions pads &mdash; one for medical prescriptions and one that can refer patients to supports around work, training, housing and exercise that might offer more long-term solutions than, say, anti-depressants.&rdquo; Another official explained: &ldquo;Some 60% to 70% of people on employment support allowance have an underlying mental health condition
2020-10-25 07:11:34.0
Is it convenient to talk at the moment? <a href="http://www.elifile.com/25-mg-phenergan-pregnancy/">drug promethazine</a> Ortiz and Wallace have pleaded not guilty to murder charges and will be tried separately
2020-10-25 07:11:33.0
Get a job <a href="http://www.aards.com.au/pristiq-and-zoloft-together.htm">pristiq withdrawal symptoms duration</a> &ldquo;Krypton&rdquo; comes courtesy of Warner Horizon Television and DC Entertainment, which found some success on the small screen with the Bat-prequel &ldquo;Gotham&rdquo; that featured a young Bruce Wayne, years before he first donned the cape and cowl.
2020-10-25 07:11:33.0
Free medical insurance <a href="http://peninggipelangsing.info/vxlan/">vpxl barato</a> The festival was founded in 2001 by De Niro, producer Jane Rosenthal and investor Craig Hatkoff to revitalize the downtown New York neighborhood following the Sept
2020-10-25 06:49:03.0
Good crew it's cool :) <a href="http://weightloss-basics.com/levlen-28-side-effects">levonorgestrel and ethinyl estradiol tablets usp reviews</a> And anyone who traveled from Mali and entered the United Stated before Tuesday must still be monitored for the virus for 21 days, the period it takes for symptoms to emerge, the statement said.
2020-10-25 06:49:02.0
There's a three month trial period <a href="http://www.ebookmart.com.au/buy-levlen-ed-online/">lupin levonorgestrel and ethinyl estradiol tablets reviews</a> But it can&rsquo;t compare to what you&rsquo;ve brought me, so for that, thank you very much.
2020-10-25 06:49:01.0
Punk not dead <a href="http://www.kopekoteli.com.tr/cleocin-cream">clindamycin phosphate gel for acne side effects</a> Kadyrov said Dadayev was a &ldquo;deeply religious man&rdquo; who was committed to Russia but had been offended by Nemtsov&rsquo;s comments after the attack on French satirical publication Charlie Hebdo, which had published cartoons of the Prophet Muhammad.
2020-10-25 06:49:00.0
Where do you live? <a href="http://www.ebookmart.com.au/buy-levlen-ed-online/">levonorgestrel and ethinyl estradiol tablets for acne</a> &#8220;A gas shortage destroys trust in gas, and that can not be in the interest of Gazprom