码迷,mamicode.com
首页 > 其他好文 > 详细

Redis ——(一)环境安装

时间:2018-07-06 23:34:02      阅读:403      评论:0      收藏:0      [点我收藏+]

标签:pid   cli   mit   kernel   red   环境安装   connect   cep   add   

环境安装

Linux

redis下载地址

[root@VM_0_4_centos ~]# http://download.redis.io/releases/redis-4.0.10.tar.gz
[root@VM_0_4_centos ~]# tar xzf redis-4.0.10.tar.gz
[root@VM_0_4_centos ~]# cd redis-4.0.10/
[root@VM_0_4_centos redis-4.0.10]# make

我在linux安装redis的时候,因为是刚刚在腾讯云上买的服务器,所以没安装编译器,make命令报错

make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/root/redis-4.0.10/deps/hiredis‘
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/root/redis-4.0.10/deps‘
make[1]: [persist-settings] Error 2 (ignored)
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/root/redis-4.0.10/src‘
make: *** [all] Error 2

解决办法就是安装编译器,在运行make即可

[root@VM_0_4_centos ~]# yum install gcc
[root@VM_0_4_centos ~]# yum install gcc -c++
linux 环境就安装好了
运行测试一下

进入reids目录的src目录下 启动服务 如果有reids那个大大Logo构成就代表成功了

[root@VM_0_4_centos redis-4.0.10]#  cd src/
[root@VM_0_4_centos src]# ./redis-server

26783:C 06 Jul 22:08:26.085 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
26783:C 06 Jul 22:08:26.085 # Redis version=4.0.10, bits=64, commit=00000000, mo                          dified=0, pid=26783, just started
26783:C 06 Jul 22:08:26.085 # Warning: no config file specified, using the defau                          lt config. In order to specify a config file use ./redis-server /path/to/redis.c                          onf
                _._
           _.-``__ ‘‘-._
      _.-``    `.  `_.  ‘‘-._           Redis 4.0.10 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ‘‘-._
 (    ‘      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|‘` _.-‘|     Port: 6379
 |    `-._   `._    /     _.-‘    |     PID: 26783
  `-._    `-._  `-./  _.-‘    _.-‘
 |`-._`-._    `-.__.-‘    _.-‘_.-‘|
 |    `-._`-._        _.-‘_.-‘    |           http://redis.io
  `-._    `-._`-.__.-‘_.-‘    _.-‘
 |`-._`-._    `-.__.-‘    _.-‘_.-‘|
 |    `-._`-._        _.-‘_.-‘    |
  `-._    `-._`-.__.-‘_.-‘    _.-‘
      `-._    `-.__.-‘    _.-‘
          `-._        _.-‘
              `-.__.-‘

26783:M 06 Jul 22:08:26.086 # WARNING: The TCP backlog setting of 511 cannot be                           enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
26783:M 06 Jul 22:08:26.086 # Server initialized
26783:M 06 Jul 22:08:26.086 # WARNING overcommit_memory is set to 0! Background                           save may fail under low memory condition. To fix this issue add ‘vm.overcommit_m                          emory = 1‘ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.ove                          rcommit_memory=1‘ for this to take effect.
26783:M 06 Jul 22:08:26.086 # WARNING you have Transparent Huge Pages (THP) supp                          ort enabled in your kernel. This will create latency and memory usage issues wit                          h Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transpar                          ent_hugepage/enabled‘ as root, and add it to your /etc/rc.local in order to reta                          in the setting after a reboot. Redis must be restarted after THP is disabled.
26783:M 06 Jul 22:08:26.086 * Ready to accept connections
进去redis客户端测试下存储数据

./redis-cli 和 ./redis-server 都是在src 目录下

[root@VM_0_4_centos src]# ./redis-cli
127.0.0.1:6379> set name augus
OK
127.0.0.1:6379> get name
"augus"
127.0.0.1:6379>

测试成功,得到了自己的名字,整个环境就算完成了

Windows

windows的安装就简单的说下

windows redis github下载地址 : https://github.com/MSOpenTech/redis/releases

直接解压,cmd命令进入redis目录下,运行redis-server.exe,运行redis-cli.exe启动即可,操作和linux的差不多的,只不过是在redis目录下,不是src目录

Redis ——(一)环境安装

标签:pid   cli   mit   kernel   red   环境安装   connect   cep   add   

原文地址:https://www.cnblogs.com/augusduan/p/9275797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!