redis's usage

author:headsen  chen

date:2017-12-07 16:33:40

notice:This article is created by  headsen chen ,and not allowed to copy,or you will counter  law  question.

install:

yum -y install epel-release

yum -y install redis

modify redis's control file:

vim  /etc/redis.conf

bind 192.168.1.10     # just listen the real ip of localhost.

daemonize yes    #  redis  can work in daemon states,and when machine is open and redis  service is running.

start:

systemctl enable redis

systemctl start redis

manage:

[root@node1 tmp]# redis-cli -h 192.168.1.10

192.168.13.164:6379[6]> info     # to show more detail of redis

...

# Keyspace
db6:keys=2,expires=0,avg_ttl=0          # db6 means  database is 6  and keys=2 means in 6 has two keys

192.168.13.164:6379[6]> keys *     # keys  *     show keys name
1) "nginx-log"
2) "system"

192.168.13.164:6379[6]> llen system    # see system key information,means that has 121962 values in this key not read ,and when readed for all ,will change to 0
(integer) 121962

192.168.13.164:6379[6]> LINDEX system -1   # to see the latest message of system key
"{\"message\":\"Dec 7 16:37:50 node1 elasticsearch: [2017-12-07 16:37:50,074][WARN ][monitor.jvm ] [node-1] [gc][young][80898][1132] duration [2.8s], collections [1]/[2.9s], total [2.8s]/[1.5m], memory [135.7mb]->[119.2mb]/[1015.6mb], all_pools {[young] [40.1mb]->[21.8mb]/[66.5mb]}{[survivor] [6.9mb]->[8.3mb]/[8.3mb]}{[old] [88.6mb]->[89.1mb]/[940.8mb]}\",\"@version\":\"1\",\"@timestamp\":\"2017-12-07T08:37:52.085Z\",\"path\":\"/var/log/messages\",\"host\":\"node1.com\",\"type\":\"system\"}"

192.168.13.164:6379[6]> quit     # exit of redis  managerment 
[root@node1 tmp]#

上一篇:pip安装


下一篇:vs2017 用 nuget发布包时报错