[TOC]
說明
本篇文章只是個(gè)人筆記,沒指望能幫上你什么……
不喜勿噴,大神繞路。
1. 起涂ч梗控制
1.1 linux系統(tǒng)服務(wù)
將redis做成系統(tǒng)服務(wù)后:
$ service redis_6379 {start|stop|restart|status}
或者在redis提供的交互式模式下
127.0.0.1:6379> SHUTDOWN [save|nosave]
not connected> exit
- 如何做成系統(tǒng)服務(wù)請看:http://blog.csdn.net/hylexus/article/details/69103890#14-將redis做成系統(tǒng)服務(wù)可選
1.2 windows
具體可參看
- https://github.com/MSOpenTech/redis
- https://raw.githubusercontent.com/MSOpenTech/redis/3.0/Windows%20Service%20Documentation.md
# 停止
C:\Users\hylexus>redis-server --service-stop
# 啟動(dòng)
C:\Users\hylexus>redis-server --service-start
- 在windows上安裝并做成系統(tǒng)服務(wù)請看:
- http://blog.csdn.net/hylexus/article/details/69103890#3-windows安裝
1.3 Unix內(nèi)核的命令行下操作
# 啟動(dòng)
$ redis-server /path/to/redis.conf
# 停止
$ redis-cli shutdown[save|nosave]
2. 性能測試
在redis裝好之后,可以redis在自己PC上的性能。執(zhí)行如下命令即可:
$ redis-benchmark
3. 基礎(chǔ)命令
- select:切換數(shù)據(jù)庫[0-15]
- FLUSHALL:清空所有數(shù)據(jù)庫
- FLUSHDB:清空當(dāng)前數(shù)據(jù)庫
- info replication
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6379>
- role
127.0.0.1:6379> ROLE
1) "master"
2) (integer) 0
3) (empty list or set)
127.0.0.1:6379>
- config
127.0.0.1:6379> config get dir
1) "dir"
2) "/data/redis"
127.0.0.1:6379> config get logfile
1) "logfile"
2) "/data/redis/log.log"
127.0.0.1:6379> config get port
1) "port"
2) "6379"
127.0.0.1:6379>
有get
當(dāng)然有對應(yīng)的set
了.但是這種設(shè)置會(huì)在重啟后由配置文件中的配置覆蓋掉糯而。