File tree Expand file tree Collapse file tree 1 file changed +22
-9
lines changed
Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -5,21 +5,34 @@ Analyzing memory of redis is to find the keys(prefix) which used a lot of memory
55
66
77## Usage
8- ### Run demo
98
10- - Install
9+ 1 . Install
1110``` Shell
12- cd examples
13- //create file glide.yaml if not exist
14- touch glide.yaml
11+ // cd your-root-folder-of-project
12+ //Create the file glide.yaml if not exist
13+ // touch glide.yaml
1514glide get github.com/hhxsv5/go-redis-memory-analysis#~1.1.0
1615` ` `
1716
18- - Run
17+ 2. Run
1918` ` ` Go
20- //cd examples
21- go run main.go
22- //find reports in current folder
19+ redis, err := NewRedisClient(" 127.0.0.1" , 6379, " " )
20+ if err ! = nil {
21+ fmt.Println(" Connect redis fail" , err)
22+ return
23+ }
24+ defer redis.Close ()
25+
26+ analysis := NewAnalysis(redis)
27+
28+ //Scan the keys which can be split by ' #' ' :'
29+ //Special pattern characters need to escape by ' \'
30+ analysis.Start([]string{" #" , " :" }, 3000)
31+
32+ //Find the csv file in default target folder: ./reports
33+ //CSV file name format: redis-analysis-{host:port}-{db}.csv
34+ //The keys order by count desc
35+ analysis.SaveReports(" ./reports" )
2336` ` `
2437
2538! [CSV](https://raw.githubusercontent.com/hhxsv5/go-redis-memory-analysis/master/examples/demo.png)
You can’t perform that action at this time.
0 commit comments