博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
启动redis
阅读量:7046 次
发布时间:2019-06-28

本文共 1514 字,大约阅读时间需要 5 分钟。

  1.  使用Redis内置的配置进行启动

     

    命令:

     

    redis-server &

  2. 2

    看看启动情况

     

    Output:

     

    2403:M 08 Apr 19:34:32.505 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

     

    2403:M 08 Apr 19:34:32.506 # Server started, Redis version 3.0.6

     

    2403:M 08 Apr 19:34:32.506 # 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.

     

    2403:M 08 Apr 19:34:32.506 * DB loaded from disk: 0.000 seconds

     

    2403:M 08 Apr 19:34:32.506 * The server is now ready to accept connections on port 6379

  3. 3

    如果需要指定监听端口呢

     

    命令:

     

    redis-server --port 8888 &

  4. 4

    使用脚本启动

     

    将redis源代码下的文件utils/redis_init_script改名为redis_6380

    然后将redis_6380复制到/etc/init.d/目录

     

    来看下redis_init_script来内容

     

     

    REDISPORT=6379

     

    EXEC=/usr/local/bin/redis-server

     

    CLIEXEC=/usr/local/bin/redis-cli

     

     

    PIDFILE=/var/run/redis_${REDISPORT}.pid

     

    CONF="/etc/redis/${REDISPORT}.conf"

     

     

    因为redis_6380文件的名字中的端口号是6380,

     

    REDISPORT=6379改为REDISPORT=6380

    创建两个文件夹:

    /var/run/

    /etc/redis/

     

     

    将redis源码目录下的redis.conf文件copy到/etc/redis目录,

    然后改名为6380.conf

     

    将port后面的端口号6379改为6380

  5. 5

    启动redis服务器

     

    命令:

     

    /etc/init.d/redis_6380 start&

  6. 6

    如果觉得使用脚本启动比较麻烦,则可以这样实现上面的脚本启动

     

    命令:

     

    redis-server  /etc/redis/6380.conf

  7. 7

    查看一下启动的Redis实例

     

    命令:

     

    ps -ef|grep redis

  8. 8

    如何停止Redis服务器呢?

     

    脚本启动的的停止方式

     

    命令:

     

    /etc/init.d/redis_6380 stop

  9. 9

    如果不是使用脚本启动则需要使用redis-cli  shutdown命令来停止

     

    命令:

     

    redis-cli -p 8888 shutdown

     

    redis-cli -p 6379 shutdown

     

转载地址:http://mvzol.baihongyu.com/

你可能感兴趣的文章
JAVA第一次作业
查看>>
android找不到aar包
查看>>
PHP操作数据库PDO
查看>>
Android colors.xml 颜色列表
查看>>
EF Code First 一对多、多对多关联,如何加载子集合?
查看>>
缓存篇~第六回 Microsoft.Practices.EnterpriseLibrary.Caching实现基于方法签名的数据集缓存...
查看>>
Android ROM 制作教程
查看>>
将一列包含多个ID拆分多行
查看>>
Ibatis入门基本语法(转) good
查看>>
C#.NET如何不序列化字段、属性
查看>>
Labview中的属性节点
查看>>
C语言嵌入式系统编程修炼之(五)键盘操作
查看>>
mysql之数据类型
查看>>
关于SpringMVC的文件上传
查看>>
【翻译svg教程 】svg 的坐标系统
查看>>
彻底理解线索二叉树
查看>>
JMeter学习笔记--详解JMeter定时器
查看>>
3.Java网络编程之IP
查看>>
数学之树
查看>>
JAVA CAS原理深度分析
查看>>