redis 第一个hello world

牛逼的人在干牛逼的事之前总有一段苦逼的岁月,只要像傻逼一样坚持,终究也会牛逼


在开发之前,一般会将redis.conf原始配置进行备份,拷贝一份出来,保留原始配置

拷贝一份到myredis

创建myredis

[root@localhost local]# mkdir myredis

进入redis目录拷贝

[root@localhost redis-3.2.8]# cp redis.conf ../myredis/

查看myredis

[root@localhost redis-3.2.8]# ls -1 ../myredis/
redis.conf

进入myredis,修改redis.conf文件配置

[root@localhost redis-3.2.8]# vim reids.conf

修改GENERAL里面daemonize的配置为yes(这里为在后台开启一个redis的进程)


进入/usr/local/bin目录下启动redis

[root@localhost Desktop]# cd /usr/local/bin/          
[root@localhost bin]# ls
redis-benchmark  redis-check-rdb  redis-sentinel
redis-check-aof  redis-cli        redis-server
[root@localhost bin]# redis-server ../myredis/redis.conf          这里我的myredis目录和bin是同级,需要退一级进入myredis目录 ../myredis

[root@localhost bin]# redis-cli -p 6379
127.0.0.1:6379> 

判断redis是否启动或者成功

回复PONG即成功

127.0.0.1:6379> ping
PONG

127.0.0.1:6379> set hello hello
OK
127.0.0.1:6379> get hello
"hello"
127.0.0.1:6379> 



6379为redis默认端口

还可以在测试下redis是否在后台启动

进入myredis

[root@localhost myredis]# ps -ef|grep redis
root      7225  7149  0 17:05 ?        00:00:00 vim redis.conf
root      7301     1  0 17:14 ?        00:00:00 redis-server 127.0.0.1:6379       
root      7307  7213  0 17:17 pts/1    00:00:00 redis-cli -p 6379
root      7321  7256  0 17:24 pts/2    00:00:00 grep redis

redis成功!


一条博客写的真辛苦,嘿嘿,不过也值了!


如有错误之处,还请提点!




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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值