昊鼎王五:linux如何三分钟搭建单台redis服务器及常用命令?

#昊鼎王五:linux如何三分钟搭建单台redis服务器及常用命令?

#1.到官网下载安装包

http://redis.io/download

#2.编译安装
##2.1安装依赖包
yum install -y gcc tcl
##2.2编译安装

ps -ef | grep redis | awk '{print $2}' | xargs kill -9
[root@localhost redis-3.0.5]# make
[root@localhost redis-3.0.5]# make test
[root@localhost redis-3.0.5]# make install

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: 离开目录“/home/setup/redis/redis-3.0.5/src”
[root@localhost redis-3.0.5]#

#3.启动redis服务

[root@localhost redis-3.0.5]# ./src/redis-server redis.conf  &
[1] 51352
[root@localhost redis-3.0.5]# 51352:M 04 Apr 15:43:46.628 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                 
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 51352
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |           http://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |                                 
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

51352:M 04 Apr 15:43:46.633 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
51352:M 04 Apr 15:43:46.634 # Server started, Redis version 3.0.5
51352:M 04 Apr 15:43:46.634 # 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.
51352:M 04 Apr 15:43:46.635 # 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.
51352:M 04 Apr 15:43:46.635 * DB loaded from disk: 0.000 seconds
51352:M 04 Apr 15:43:46.635 * The server is now ready to accept connections on port 6379

[root@localhost redis-3.0.5]# ps -ef|grep redis
root      51352  45367  0 15:43 pts/0    00:00:00 ./src/redis-server *:6379
root      51356  45367  0 15:43 pts/0    00:00:00 grep --color=auto redis

#4.使用客户端连接

./src/redis-cli -p 6379           #redis安装后默认开启6379端口
127.0.0.1:6379> help
redis-cli 3.0.5
Type: "help @<group>" to get a list of commands in <group>
      "help <command>" for help on <command>
      "help <tab>" to get a list of possible help topics
      "quit" to exit
127.0.0.1:6379> info
127.0.0.1:6379>

#5.其他常用命令
##5.1.启动:

./src/redis-server redis.conf  

##5.2.连接:

redis-cli -p 8888

##5.1.停止的命令:

./redis-cli -p 6379  shutdown
51352:M 04 Apr 15:47:26.721 # User requested shutdown...
51352:M 04 Apr 15:47:26.722 * Saving the final RDB snapshot before exiting.
51352:M 04 Apr 15:47:26.728 * DB saved on disk
51352:M 04 Apr 15:47:26.728 # Redis is now ready to exit, bye bye...
[1]+  完成                  ./src/redis-server redis.conf
ps -ef|grep redis           #此时无显示

好了,聪明如你,知道了linux如何三分钟搭建单台redis服务器及常用命令,是不是很欢喜 _

还有其他问题的可以在评论区留言或者扫码加博主获取资源或者提问。
在这里插入图片描述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值