linux redis cli 参数,redis3.0.2 编译安装(启动参数方式启动)

1.下载redis3.0.2

[root@Moxiaokai ~]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz

[root@Moxiaokai ~]# ll

redis-3.0.2.tar.gz

2.解压并编译安装

[root@Moxiaokai ~]# tar -xzf redis-3.0.2.tar.gz

[root@Moxiaokai ~]# ll

redis-3.0.2  redis-3.0.2.tar.gz

[root@Moxiaokai ~]# cd redis-3.0.2

[root@Moxiaokai redis-3.0.2]# make

检查redis是否有异常

[root@Moxiaokai redis-3.0.2]# make test

[root@Moxiaokai redis-3.0.2]# make install

在 make test时redis-3.0.2的时候可能提示错误:

[root@Moxiaokai redis-3.0.2]# make test

make:cc:Command not found ,make: *** [adlist.o] Error 127

这里是由于新安装的Linux系统没有安装gcc环境,需要安装gcc,为了方便选择用yum进行安装。

[root@Moxiaokai redis-3.0.2]# yum  -y install  gcc

make: *** [test] Error 1

[root@Moxiaokai redis-3.0.2]# make test

You need tcl 8.5 or newer in order to run the Redis test

make: *** [test] Error 1

root@Moxiaokai redis-3.0.2]#wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz

root@Moxiaokai redis-3.0.2]#tar -xzvf tcl8.6.1-src.tar.gz  -C /usr/local/

root@Moxiaokai redis-3.0.2]#cd /usr/local/tcl8.6.1/unix/

root@Moxiaokai redis-3.0.2]# ./configure

root@Moxiaokai redis-3.0.2]# make

root@Moxiaokai redis-3.0.2]# make install

3.运行redis

i)开启Server进程

[root@Moxiaokai redis-3.0.2]# ./src/redis-server

24841:C 08 Nov 07:20:33.378 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf

24841:M 08 Nov 07:20:33.379 * Increased maximum number of open files to 10032 (it was originally set to 1024).

_._

_.-``__ ''-._

_.-``    `.  `_.  ''-._           Redis 3.0.2 (00000000/0) 64 bit

.-`` .-```.  ```\/    _.,_ ''-._

(    '      ,       .-`  | `,    )     Running in standalone mode

|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

|    `-._   `._    /     _.-'    |     PID: 24841

`-._    `-._  `-./  _.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |           http://redis.io

`-._    `-._`-.__.-'_.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |

`-._    `-._`-.__.-'_.-'    _.-'

`-._    `-.__.-'    _.-'

`-._        _.-'

`-.__.-'

24841:M 08 Nov 07:20:33.381 # Server started, Redis version 3.0.2

24841:M 08 Nov 07:20:33.383 # 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.

24841:M 08 Nov 07:20:33.383 # 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.

24841:M 08 Nov 07:20:33.384 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

24841:M 08 Nov 07:20:33.384 * The server is now ready to accept connections on port 6379

ii)关闭Server进程

[root@Moxiaokai redis-3.0.2]#./redis-cli shutdown

登入客户端进行关闭:

[root@Moxiaokai redis-3.0.2]#./redis-cli

127.0.0.1:6379> shutdown

not connected>

4.程序验证:

[root@vstar75 src]# ./redis-cli

127.0.0.1:6379> set MyName 'Moxiaokia'

OK

127.0.0.1:6379> get MyName

"Moxiaokia"

127.0.0.1:6379>

e286125a4d0e3da706ddccf86abac19f.png

5.启动参数方式启动Serverredis.conf

[root@Moxiaokai redis-3.0.2]# ./src/redis-server redis.conf

6.将 Redis 作为 Linux 服务随机启动

[root@Moxiaokai redis-3.0.2]#vi /etc/rc.local

加入:

/root/install/redis-3.0.2/src/redis-server

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值