在虚拟机中的centos7安装redis

一、安装redis

使用redis3.0版本。3.0版本主要增加了redis集群功能。

安装的前提条件:需要安装gcc:yum install gcc-c++

 

1、下载redis的源码包。redis-3.0.0.tar.gz

2、把源码包上传到linux服务器

3、解压源码包

tar -zxvf redis-3.0.0.tar.gz

4、Make //编译,注意,进入redis-3.0.0文件夹内部再执行make

5、Make install

//安装到指定的文件夹下

[root@bogon redis-3.0.0]# make install  PREFIX=/usr/local/redis

二、启动redis

1、前端启动模式

在控制台下执行:/usr/local/redis/bin/redis-server

或者进入redis-server的文件夹下执行:./reids-server

默认是前端启动模式,端口是6379,出现如下即为启动成功

[root@bogon bin]# pwd
/usr/local/redis/bin
[root@bogon bin]# ls
dump.rdb         redis-check-aof   redis-cli       redis-server
redis-benchmark  redis-check-dump  redis-sentinel
[root@bogon bin]# ./redis-seerver
bash: ./redis-seerver: 没有那个文件或目录
[root@bogon bin]# ./redis-server
44229:C 08 Feb 10:49:22.492 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
44229:M 08 Feb 10:49:22.494 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.0 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 44229
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               


44229:M 08 Feb 10:49:22.496 # Server started, Redis version 3.0.0
44229:M 08 Feb 10:49:22.497 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
44229:M 08 Feb 10:49:22.497 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
44229:M 08 Feb 10:49:22.497 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
44229:M 08 Feb 10:49:22.497 * DB loaded from disk: 0.000 seconds
44229:M 08 Feb 10:49:22.497 * The server is now ready to accept connections on port 6379


2、后端启动

1)从redis的源码目录中复制redis.conf到redis的安装目录。

[root@localhost redis-3.0.0]# cp redis.conf /usr/local/redis/bin/

2)修改配置文件

[root@bogon bin]# vim redis.conf

 将reis.conf 中的daemonize no改为daemonize yes

3)启动:[root@bogon bin]# ./redis-server redis.conf

查看进程,6379端口

[root@bogon bin]# ./redis-server redis.conf
[root@bogon bin]# ps aux|grep redis
root     44612  0.2  0.2 140844  2032 ?        Ssl  10:58   0:00 ./redis-server *:6379
root     44631  0.0  0.0 112676   984 pts/1    S+   10:59   0:00 grep --color=auto redis

后端连接命令:

>./redis-cli -h 192.168.200.128 -p 6379



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值