首页 > 数据库 >Linux如何让Redis-server在后台运行

Linux如何让Redis-server在后台运行

时间:2023-04-03 21:09:55浏览次数:38  
标签:02 23 -._ Redis Linux redis server 56317 _.-

文档课题:Linux如何让Redis-server在后台运行.
系统:rhel 7.9
数据库:redis 6.2.6
1、问题描述
redis安装后运行reids-server命令,内容显示如下.此时在该session中无法执行其它操作,当执行ctrl+c关闭界面后才能输入其它命令,但此时redis进程也会被关闭. 
[root@leo-redis626-a redis-6.2.6]# redis-server
56317:C 02 Apr 2023 23:13:12.679 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
56317:C 02 Apr 2023 23:13:12.679 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=56317, just started
56317:C 02 Apr 2023 23:13:12.679 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
56317:M 02 Apr 2023 23:13:12.681 * Increased maximum number of open files to 10032 (it was originally set to 1024).
56317:M 02 Apr 2023 23:13:12.681 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 56317
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

56317:M 02 Apr 2023 23:13:12.682 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
56317:M 02 Apr 2023 23:13:12.682 # Server initialized
56317:M 02 Apr 2023 23:13:12.682 # 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.
56317:M 02 Apr 2023 23:13:12.682 * Ready to accept connections
2、后台运行redis
如何在后台运行redis?本次测试是新建的配置文件,可在该文件中添加daemonize yes,如此以守护进程的方式启动redis.
[root@leo-redis626-a redis-6.2.6]# vi redis6379.conf 
include /usr/local/src/redis-6.2.6/redis.conf
pidfile /var/run/redis_6379.pid
port 6379
dbfilename dump6379.rdb
daemonize yes
说明:“daemonize yes”为新增内容.
3、结果验证
--如下所示,此时启动redis,不再弹出一堆显示,同时可以在当前session进行其它操作.
[root@leo-redis626-a redis-6.2.6]# redis-server redis6379.conf
[root@leo-redis626-a redis-6.2.6]# ps -ef|grep redis
avahi       831      1  0 08:25 ?        00:00:00 avahi-daemon: running [leo-redis626-a.local]
root       2790      1  1 08:46 ?        00:00:00 redis-server 127.0.0.1:6379
root       2802   2308  0 08:46 pts/0    00:00:00 grep --color=auto redis

参考网址:https://jingyan.baidu.com/article/fc07f98931aa4953fee51948.html

标签:02,23,-._,Redis,Linux,redis,server,56317,_.-
From: https://blog.51cto.com/u_12991611/6167470

相关文章

  • 搭建redis主从复制集群环境时,当从库执行slaveof命令时报错“Error condition on socke
    问题描述:搭建redis主从复制集群环境时,当从库执行slaveof命令时报错“ErrorconditiononsocketforSYNC:Noroutetohost”,如下所示:操作系统:rhel7.964位数据库:redis6.2.6主机名:主库leo-redis626-a,从库leo-redis626-b.1、异常重现[[email protected]]#p......
  • redis主从复制集群环境搭建
    文档课题:redis主从复制集群环境搭建.操作系统:rhel7.964位数据库:redis6.2.6主机名:主库leo-redis626-a,从库1leo-redis626-b,从库2leo-redis626-cIP信息:主库192.168.133.100,从库1192.168.133.101,从库2192.168.133.102端口号:主库6379,从库16380,从库263811、拓扑结构2......
  • 启动redis时,告警日志中出现“The TCP backlog setting of 511……”以及“overcommit_
    问题描述:启动redis时,告警日志中出现“TheTCPbacklogsettingof511……”以及“overcommit_memoryissetto0…..”警告,如下所示:系统:rhel7.9数据库:redis6.2.61、异常重现[[email protected]]#redis-serverredis6379.conf[root@leo-redis626-aredis-6.......
  • linux 安装redis
       一、准备好gcc环境yuminstallgcc-c++复制代码出现以下日志,代表安装成功。Packagegcc-c++-4.8.5-39.el7.x86_64alreadyinstalledandlatestversionLoadedplugins:fastestmirrorDeterminingfastestmirrorsbase......
  • 分布式系统——基于Redis的分布式锁的实现
    分布式锁的介绍分布式锁是分布式系统中用于协调多个进程或线程之间并发访问共享资源的一种机制。在分布式系统中,由于各个节点之间的通信存在延迟、故障等问题,可能会导致数据的不一致性。为了保证数据的一致性,需要使用分布式锁来协调各个节点的并发访问。在分布式系统中,多个节点......
  • Redis常见问题答疑
    数据类型一个数据类型都对应了很多种底层数据结构。以List为例,什么情况下是双向链表,反之又在什么情况下是压缩列表呢?还是说是并存状态?1、Hash和ZSet是数据量少采用压缩列表存储,数据量变大转为哈希表或跳表存储2、但List不是这样,是并存的状态,List是双向链表+压缩列表key过期......
  • LINUX 放开端口,防火墙操作
    防火墙操作:查看防火墙状态systemctlstatusfirewalld、firewall-cmd--state暂时关闭防火墙systemctlstopfirewalld永久关闭防火墙(慎用)systemctldisablefirewalld开启防火墙systemctlstartfirewalld开放指定端口firewall-cmd--zone=public--add-port=8080/tcp--perman......
  • php-websocket hyperf/websocket-server/client 客户端和服务器实时双向数据传输
    WebSocket服务WebSocket是一种通信协议,可在单个TCP连接上进行全双工通信。WebSocket使得客户端和服务器之间的数据交换变得更加简单,允许服务端主动向客户端推送数据。在WebSocketAPI中,浏览器和服务器只需要完成一次握手,两者之间就可以建立持久性的连接,并进行双向数据传输。Hyperf......
  • S5PV210开发 -- Linux dd命令
    昨天群里有人询问,为什么破坏BootLoader破坏不掉。出现错误:dd:writing'/dev/mtdblock0':Operationnotpermitted我说需要插着SD卡才可以。(这个也不对,不插SD卡也可以,那这个错误还是没有搞清楚)然后我们来看一下它操作指令:  busyboxddif=/dev/zeroof=/dev/mmcblk0bs=512......
  • LIVE555再学习 -- testOnDemandRTSPServer 源码分析
    一、简介先看一下官网上的介绍:testOnDemandRTSPServer createsaRTSPserverthatcanstream,viaRTPunicast,fromvarioustypesofmediafile,ondemand.(Supportedmediatypesinclude:MPEG-1or2audioorvideo(elementarystream),includingMP3audio;MPEG-4......