linux判断redis是否启动成功_redis基本安装判断、启动使用方法示例

本文介绍了Redis的基本安装步骤和启动过程。通过`whereis`命令检查Redis是否已安装,然后使用`redis-server &`启动服务。启动后,通过`redis-cli`连接并使用`ping`验证Redis是否正常运行。启动过程中可能遇到的警告包括最大文件描述符限制、TCP backlog设置和内存配置问题。
摘要由CSDN通过智能技术生成

本文实例讲述了redis基本安装判断、启动使用方法。分享给大家供大家参考,具体如下:

1、Redis对否安装(安装好了会出现下面对应的代码)

[root]$ whereis redis-cli

redis-cli: /usr/local/bin/redis-cli

[root]$

[root]$ whereis redis-server

redis-server: /usr/local/bin/redis-server

2、启动Redis

输入代码

redis-server &

30733:C 09 Dec 14:45:30.876 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf

30733:M 09 Dec 14:45:30.879 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.

30733:M 09 Dec 14:45:30.879 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.

30733:M 09 Dec 14:45:30.879 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.

[root]$ _._

_.-``__ ''-._

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

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

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

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

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

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

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

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

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

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

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

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

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

`-._ _.-'

`-.__.-'

30733:M 09 Dec 14:45:30.900 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

30733:M 09 Dec 14:45:30.900 # Server started, Redis version 3.2.0

30733:M 09 Dec 14:45:30.901 # 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.

30733:M 09 Dec 14:45:30.901 # 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.

30733:M 09 Dec 14:45:30.902 * The server is now ready to accept connections on port 6379

3.判断Redis是否启动

[root]# redis-cli -p 6379

127.0.0.1:6379> ping

PONG

127.0.0.1:6379>

希望本文所述对大家Redis数据库程序设计有所帮助。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值