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

2018-11-13 10:32
8871
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 10:08:48.0
We'll need to take up references <a href="http://weightloss-basics.com/imipramine-cause-weight-gain">imipramine cause weight gain</a> Standardised packaging is the next step towards achieving this," Dr Reilly insisted.
2020-10-25 10:08:47.0
How would you like the money? <a href="http://plateroytu.com/skelaxin-kidney-stones">white pill metaxalone</a> Steelers fans will kill you with kindness, respectfully rabid with vocal cords that will create a potentially eerie vibe at the Meadowlands
2020-10-25 10:08:43.0
Accountant supermarket manager <a href="http://www.coachhiredirectory.co.uk/lamisil-once-reviews/">lamisil athletes foot</a> Theenforcement division has been filing all of its contested casesin federal district courts.
2020-10-25 10:08:43.0
Best Site good looking <a href="http://vaccineresource.com/clozapine-vs-clozaril/">clozaril statistics</a> anti-depressants should not be given unless a person has a diagnosis of depression not for people that are bi-polar i can&#8217;t tell you how many anti-depressants the drs put me on because they said i was bi-polar
2020-10-25 10:08:42.0
Looking for a job <a href="http://vaccineresource.com/where-to-get-cytotec-in-nigeria/">black market cytotec</a> But with the UK Border Agency confirming on Thursday that Rojo has been granted the required paperwork to play for the club, the defender is now in line to make his debut alongside fellow new signings Radamel Falcao and Daley Blind in the Old Trafford fixture against QPR on Sept 14.
2020-10-25 09:47:45.0
I'll call back later <a href="http://alzheimersdiseasetreatment.com/colostomy-bag-change-icd-10">colostomy bag price canada</a> North Belfast MLA Gerry Kelly, from Sinn F&eacute;in, said: "Racists who carry out such despicable actions, in an attempt to instill fear into families living here, need to be taken off our streets."
2020-10-25 09:47:44.0
Withdraw cash <a href="http://harpnfiddle.org/micardis-80-mg-tabletten.html">micardis discount card</a> In 2013, police shot and killed a woman after she rammed security barricades with her car near the White House before racing toward the Capitol
2020-10-25 09:47:44.0
What are the hours of work? <a href="http://prepa-sarcelles.fr/betnovate-cream-uk-online.php">betamethasone 1 mg /g pch</a> They controlled large spells of the match and can now look forward to the quarter-finals
2020-10-25 09:47:43.0
I'm a housewife <a href="http://www.reefonline.com.au/bimatoprost-dosage-form/anset">bimatoprost online</a> The Nikkei 225 index at the Tokyo Stock Exchange gained 56.65 points to 17,357.51, while the Topix index edged up 0.18%, or 2.54 points, to 1,400.18
2020-10-25 09:47:43.0
What's the interest rate on this account? <a href="http://drandrewbrown.co.uk/how-much-does-the-depo-provera-shot-cost-in-australia.html">does the depo provera cause pcos</a> Black missed games with a herniated disc in his neck last season and was shut down in early September with a strain in his right rotator cuff