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

2018-11-13 10:32
8870
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-14 11:14:40.0
What company are you calling from? <a href="http://tashilat.ir/clindamycin-creme-rezeptfrei">clindamycin lyme disease</a> When it came to shooting, we just totally connected, and it continued through the years.&rdquo;
2020-10-14 11:14:40.0
What university do you go to? <a href="http://m-mariage.fr/atorvastatin-calcium-80mg-tab-side-effects">korea lipitor invalid patent</a> Wilson tied it with a pretty 26-yard run around the left side and made it into the end zone untouched.
2020-10-14 11:14:39.0
What company are you calling from? <a href="http://commandandconquer.ir/zenegra-overnight-generic-sildenafil-citrate">sildenafil cit</a> The affair led to the resignation of the ministers of the economy, the interior and urbanization, while European Union Affairs Minister Egemen Bagis lost his post in a subsequent reshuffle
2020-10-14 11:12:57.0
Could you transfer $1000 from my current account to my deposit account? <a href="https://analoggulf.com/methylprednisolone-uses-in-telugu-pbks">methylprednisolone dose pack 4 mg tablet</a> In Citi Holdings, it set aside $451 million for bad loans,benefits and claims, down from $1.23 billion in the same quarterlast year. The bank used money it had previously set aside tocover loan losses, releasing $784 million of reserves, comparedwith $1.01 billion of reserves in the same quarter last year.
2020-10-14 11:12:57.0
Hold the line, please <a href="https://www.eeee.ba/pommade-voltarene-pour-femme-enceinte-0an2">voltaren dispersible tablets</a> Sony, Samsung, LG, Panasonic, Huawei and Toyota are among others hosting both press conferences and stands. Google, Yahoo and Dropbox prefer to just book private meeting rooms. Apple does not attend in any formal capacity.
2020-10-14 11:12:55.0
Have you seen any good films recently? <a href="https://bellafinastrings.com/finasteride-purchase-gv5s">finasteride finasteride 5mg</a> And that’s when something wonderful happened on a day full of sweet memories. A few hours after cheering wildly for Mariano Rivera and all the pinstriped dignitaries who showed up on Mariano Rivera Day, the sellout crowd of 49,197 erupted again, this time for Pettitte.
2020-10-14 11:12:55.0
I'll put him on <a href="https://vandahering.com.br/pill-mobic-15-mg-iv9l">mobicom</a> The water eventually got into Parmitano&rsquo;s eyes. That&rsquo;s when NASA ordered the two men back inside. Then the water drenched his nose and mouths, and he had trouble hearing on the radio lines.
2020-10-14 11:12:55.0
How long are you planning to stay here? <a href="https://theaquaticcity.com/cvs-health-minoxidil-bom-188f">minoxidil 5 foam review</a> He said: "We have learned from the past 10 years, however, that it is not enough to simply alter the balance of military power without careful consideration of what is necessary in order to preserve a functioning state."
2020-10-14 11:12:55.0
Please wait <a href="https://farmasi.in.rs/bestsellers/index.php/buy-trenbolone-acetate-canada-lbxo">xls medical max strength sachets boots</a> When I was dating Lindsay Lohan I flew to New York to see her for her premiere and the next thing you know I&rsquo;m on some guy&rsquo;s private jet flying to Barbados. But at those times I didn&rsquo;t have anything like the money compared with any of those guys. I&rsquo;m still not close to that, but let&rsquo;s say I made five grand &ndash; I would spend that five grand on flying myself to LA and having a hotel room for three weeks. I wouldn&rsquo;t put it in the bank.
2020-10-14 11:12:54.0
Hold the line, please <a href="http://www.verne.cat/bellicon-rebounder-for-sale-canada-1st9">bellicon rebounder amazon uk</a> That was better than a year-earlier result of 2.4 billionyuan, according to Reuters' calculations based on company data, and it also beat an estimate of 3.1 billion yuan from analystspolled by Thomson Reuters I/B/E/S.