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

版权声明:感谢您阅读我的文章,转载注明出处哦~~ https://blog.csdn.net/haoding205/article/details/82145831

昊鼎王五: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服务器及常用命令,是不是很欢喜 ^_^

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

猜你喜欢

转载自blog.csdn.net/haoding205/article/details/82145831