在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ 大數(shù)據(jù)/ 5.7 其他好用的配置技巧
6.2 并發(fā)延遲檢查
2.2.2 獲取key對(duì)應(yīng)的string值
11.1.5 其他問題
4.7 客戶端推薦
3.3 查看和修改配置
2.3.7 設(shè)置list中指定下標(biāo)的元素值
9.1 Shell提權(quán)問題
2.3.6 刪除元素
8.3.1 系統(tǒng)內(nèi)存查看
11.1.2 環(huán)境搭建
2.6.3 遞增某一個(gè)域的值
2.7.2 返回給定 HyperLogLog 的基數(shù)估算值
2.3.8 阻塞隊(duì)列
2.5.2 刪除元素
2.4.6 查看集合大小
8.3.4 dump.rdb文件成生內(nèi)存報(bào)告(rdb-tool)
8.3 內(nèi)存檢查
2.1.7 Key的超時(shí)設(shè)置處理
2.5.8 返回集合中元素個(gè)數(shù)
2.7.1 將元素添加至 HyperLogLog
2.5.4 獲取排名
6.1.2 探測(cè)服務(wù)延遲
10.1 概念
7.3 模擬hang
2.6.6 獲取域的數(shù)量
11.1.1 高可用原理
3.5 選擇數(shù)據(jù)庫
4.3 數(shù)據(jù)異常處理
2.4.10 集合差集
2.2.6 改寫字符串
11.1.3 維護(hù)操作
3.13.3 備份
2.2.5 截取字符串
4.6 典型使用場(chǎng)景參考
2.4.4 隨機(jī)返回一個(gè)元素
2.4.11 獲取所有元素
2.4.3 刪除并返回元素
2.4.2 移除元素
8.3.9 Rss增加,內(nèi)存碎片增加
2.4.8 集合交集
2.1.3 刪除給定key
2.5.3 增加score
11.1.4 高可用和異常測(cè)試
底層實(shí)現(xiàn)是hash table,一般操作復(fù)雜度是O(1),要同時(shí)操作多個(gè)field時(shí)就是O(N),N是field的數(shù)量。應(yīng)用場(chǎng)景
5.2 網(wǎng)卡RPS設(shè)置
2.6.7 獲取所有的域名
5.6 具體設(shè)置參數(shù)
生產(chǎn)環(huán)境慎用。
6. 常見運(yùn)維操作
8.3.8 查看key內(nèi)部結(jié)構(gòu)和編碼等信息
4.4 內(nèi)存考慮
4.1 Key設(shè)計(jì)
2.5.5 獲取排行榜
7.1 模擬oom
2.1.2 測(cè)試指定key是否存在
10.3 分片主要場(chǎng)景和對(duì)應(yīng)思路
6.1.1 探測(cè)服務(wù)是否可用
3.13.1 RDB相關(guān)操作
2.3.5 截取list
3.13.4 恢復(fù)
3.10 驗(yàn)證密碼
2.2.4 追加字符串
8.3.6 內(nèi)存抽樣分析
5. 上線部署規(guī)劃
Sorted Set的實(shí)現(xiàn)是hash table(element->score, 用于實(shí)現(xiàn)ZScore及判斷element
4.5 延遲考慮
2.6.1 設(shè)置hash值
8.3.5 query在線分析
6.2.4 檢查連接數(shù)
2.4.9 集合并集
7. 數(shù)據(jù)遷移
4. 開發(fā)設(shè)計(jì)規(guī)范
2.5.9 返回給定元素對(duì)應(yīng)的score
9. Redis安全問題
2.2.7 返回子字符串
3.4 批量執(zhí)行操作
Server
3.1 排序
8.3.2 系統(tǒng)swap內(nèi)存查看
2.6.4 判斷某一個(gè)域是否存在
3.6 清空數(shù)據(jù)庫
2.6.8 獲取所有域的值
3.11 性能測(cè)試命令
  • 1.
6.2.1 檢查CPU情況
7.5 模擬RDB load情形
7.4 快速產(chǎn)生測(cè)試數(shù)據(jù)
7.2 模擬宕機(jī)
2.7.3 合并多個(gè) HyperLogLog
  • 1.
9. 測(cè)試方法
2.7 HyperLogLog操作
3.7 重命名命令
6.1.7 查看日志
6.2.5 檢查持久化
4.2 超時(shí)設(shè)置
8.1 一般處理流程
2.1.4 返回給定key的value類型
5.3 服務(wù)器部署位置
2.5.6 返回給定分?jǐn)?shù)區(qū)間的元素
6.2.6 檢查命令執(zhí)行情況
7.6 模擬AOF加載情形
6.13 持久化與備份恢復(fù)
5.1 內(nèi)存、CPU規(guī)劃
5.5 多實(shí)例配置
2.2.1 設(shè)置key對(duì)應(yīng)的值為string類型的value
6.1.5 獲取慢查詢
incr key
3.4 發(fā)布訂閱
6.2.2 檢查網(wǎng)絡(luò)情況
2.6.5 刪除域
6.2.3 檢查系統(tǒng)情況
8. 數(shù)據(jù)遷移
2.5.7 返回集合中score在給定區(qū)間的數(shù)量
2.1. key操作
3.8 執(zhí)行l(wèi)ua腳本
1. 簡述
11.1 主從復(fù)制-sentinel架構(gòu)
2.3.2 查看列表長度
8.3.3 info查看內(nèi)存
2.6.2 獲取hash值
11. 高可用和集群架構(gòu)與實(shí)踐
3.13.2 AOF相關(guān)操作
2. 數(shù)據(jù)操作
3.3 流水線
3.1 啟動(dòng)
2.3.3 查看元素
2.4.5 集合間移動(dòng)元素
8.3.7 統(tǒng)計(jì)生產(chǎn)上比較大的key
10.4 適用場(chǎng)景對(duì)比列表
3.9 設(shè)置密碼
3.2 事務(wù)
2.1.5 返回從當(dāng)前數(shù)據(jù)庫中隨機(jī)選擇的一個(gè)key
5.7 其他好用的配置技巧
3. 專題功能
2.3.4 查看一段列表
2.4.7 判斷member是否在set中
2.4.1 添加元素
2.1.6 原子的重命名一個(gè)key
2.1.1 列出key
2.6.9 獲取所有域名和值
2.5.10 評(píng)分的聚合
3.12 Redis-cli命令行其他操作
最大字符串為512M,但是大字符串非常不建議。
4.1 將key從當(dāng)前數(shù)據(jù)庫移動(dòng)到指定數(shù)據(jù)庫
6.1.6 查看客戶端
10. 簡述
2.2.10 位操作
2.2.9 取指定key的value值的長度
  • 1.
3.2 停止
5.4 持久化設(shè)置
10.2 高可用主要場(chǎng)景和對(duì)應(yīng)思路
2.5.1 添加元素
2.3.1 添加元素

5.7 其他好用的配置技巧

5.7.1 使用supervisord進(jìn)行進(jìn)程管理

Supervisord是一個(gè)優(yōu)秀的進(jìn)程管理工具,一般在部署redis時(shí)采用它來進(jìn)行redis、sentinel等進(jìn)程的管理,一個(gè)已經(jīng)在生產(chǎn)環(huán)境采用的supervisord配置文件如下: ; Sample supervisor config file. ; ; For more information on the config file, please see: ; http://supervisord.org/configuration.html ; ; Notes: ; - Shell expansion ("~" or "$HOME") is not supported. Environment ; variables can be expanded using this syntax: "%(ENV_HOME)s". ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".

[unix_http_server] 
file=/smsred/redis-3.0.4/run/supervisor.sock ; (the path to the socket file) 
;chmod=0700 ; socket file mode (default 0700) 
;chown=nobody:nogroup ; socket file uid:gid owner 
;username=user ; (default is no username (open server)) 
;password=123 ; (default is no password (open server)) 

;[inet_http_server] ; inet (TCP) server disabled by default 
;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) 
;username=user ; (default is no username (open server)) 
;password=123 ; (default is no password (open server)) 

[supervisord] 
logfile=/smsred/redis-3.0.4/log/supervisord.log ; (main log file;default $CWD/supervisord.log) 
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) 
logfile_backups=10 ; (num of main logfile rotation backups;default 10) 
loglevel=info ; (log level;default info; others: debug,warn,trace) 
pidfile=/smsred/redis-3.0.4/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 
nodaemon=false ; (start in foreground if true;default false) 
minfds=1024 ; (min. avail startup file descriptors;default 1024) 
minprocs=200 ; (min. avail process descriptors;default 200) 
;umask=022 ; (process file creation umask;default 022) 
;user=chrism ; (default is current user, required if root) 
;identifier=supervisor ; (supervisord identifier, default is 'supervisor') 
;directory=/tmp ; (default is not to cd during start) 
;nocleanup=true ; (don't clean up tempfiles at start;default false) 
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) 
;environment=KEY="value" ; (key value pairs to add to environment) 
;strip_ansi=false ; (strip ansi escape codes in logs; def. false) 

; the below section must remain in the config file for RPC 
; (supervisorctl/web interface) to work, additional interfaces may be 
; added by defining them in separate rpcinterface: sections 
[rpcinterface:supervisor] 
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 

[supervisorctl] 
serverurl=unix:///smsred/redis-3.0.4/run/supervisor.sock ; use a unix:// URL for a unix socket 
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket 
;username=chris ; should be same as http_username if set 
;password=123 ; should be same as http_password if set 
;prompt=mysupervisor ; cmd line prompt (default "supervisor") 
;history_file=~/.sc_history ; use readline history if available 

; The below sample program section shows all possible program subsection values, 
; create one or more 'real' program: sections to be able to control them under 
; supervisor. 

;[program:theprogramname] 
;command=/bin/cat ; the program (relative uses PATH, can take args) 
;process_name=%(program_name)s ; process_name expr (default %(program_name)s) 
;numprocs=1 ; number of processes copies to start (def 1) 
;directory=/tmp ; directory to cwd to before exec (def no cwd) 
;umask=022 ; umask for process (default None) 
;priority=999 ; the relative start priority (default 999) 
;autostart=true ; start at supervisord start (default: true) 
;autorestart=unexpected ; whether/when to restart (default: unexpected) 
;startsecs=1 ; number of secs prog must stay running (def. 1) 
;startretries=3 ; max # of serial start failures (default 3) 
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) 
;stopsignal=QUIT ; signal used to kill process (default TERM) 
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=false ; send stop signal to the UNIX process group (default false) 
;killasgroup=false ; SIGKILL the UNIX process group (def false) 
;user=chrism ; setuid to this UNIX account to run the program 
;redirect_stderr=true ; redirect proc stderr to stdout (default false) 
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO 
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) 
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO 
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) 
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2" ; process environment additions (def no adds) 
;serverurl=AUTO ; override serverurl computation (childutils) 

; The below sample eventlistener section shows all possible 
; eventlistener subsection values, create one or more 'real' 
; eventlistener: sections to be able to handle event notifications 
; sent by supervisor. 

;[eventlistener:theeventlistenername] 
;command=/bin/eventlistener ; the program (relative uses PATH, can take args) 
;process_name=%(program_name)s ; process_name expr (default %(program_name)s) 
;numprocs=1 ; number of processes copies to start (def 1) 
;events=EVENT ; event notif. types to subscribe to (req'd) 
;buffer_size=10 ; event buffer queue size (default 10) 
;directory=/tmp ; directory to cwd to before exec (def no cwd) 
;umask=022 ; umask for process (default None) 
;priority=-1 ; the relative start priority (default -1) 
;autostart=true ; start at supervisord start (default: true) 
;autorestart=unexpected ; whether/when to restart (default: unexpected) 
;startsecs=1 ; number of secs prog must stay running (def. 1) 
;startretries=3 ; max # of serial start failures (default 3) 
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) 
;stopsignal=QUIT ; signal used to kill process (default TERM) 
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) 
;stopasgroup=false ; send stop signal to the UNIX process group (default false) 
;killasgroup=false ; SIGKILL the UNIX process group (def false) 
;user=chrism ; setuid to this UNIX account to run the program 
;redirect_stderr=true ; redirect proc stderr to stdout (default false) 
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO 
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) 
;stdout_events_enabled=false ; emit events on stdout writes (default false) 
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO 
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 
;stderr_logfile_backups ; # of stderr logfile backups (default 10) 
;stderr_events_enabled=false ; emit events on stderr writes (default false) 
;environment=A="1",B="2" ; process environment additions 
;serverurl=AUTO ; override serverurl computation (childutils) 

; The below sample group section shows all possible group values, 
; create one or more 'real' group: sections to create "heterogeneous" 
; process groups. 

;[group:thegroupname] 
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions 
;priority=999 ; the relative start priority (default 999) 

; The [include] section can just contain the "files" setting. This 
; setting can list multiple files (separated by whitespace or 
; newlines). It can also contain wildcards. The filenames are 
; interpreted as relative to this file. Included files *cannot* 
; include files themselves. 

;[include] 
;files = relative/directory/*.ini 

[program:redis-1xxx] 
command=/smsred/redis-3.0.4/bin/redis-server /smsred/redis-3.0.4/conf/redis-1xxx.conf 
autostart=true 
autorestart=false 
user=smsred 
stdout_logfile=/smsred/redis-3.0.4/log/redis-1xxx.out.log 
stderr_logfile=/smsred/redis-3.0.4/log/redis-1xxx.err.log 
priority=1000 

[program:redis-1xxx] 
command=/smsred/redis-3.0.4/bin/redis-server /smsred/redis-3.0.4/conf/redis-1xxx.conf 
autostart=true 
autorestart=false 
user=smsred 
stdout_logfile=/smsred/redis-3.0.4/log/redis-1xxx.out.log 
stderr_logfile=/smsred/redis-3.0.4/log/redis-1xxx.err.log 
priority=1000 

[program:redis-1xxx] 
command=/smsred/redis-3.0.4/bin/redis-server /smsred/redis-3.0.4/conf/redis-1xxx.conf 
autostart=true 
autorestart=false 
user=smsred 
stdout_logfile=/smsred/redis-3.0.4/log/redis-1xxx.out.log 
stderr_logfile=/smsred/redis-3.0.4/log/redis-1xxx.err.log 
priority=1000 

[program:redis-sentinel] 
command =/smsred/redis-3.0.4/bin/redis-sentinel /smsred/redis-3.0.4/conf/sentinel.conf 
autostart=true 
autorestart=true 
startsecs=3

5.7.2 使用alias方便操作

如果開多實(shí)例,那么shell下進(jìn)行操作的次數(shù)會(huì)很多,因此你需要一些alias進(jìn)行命令的縮短,這個(gè)技巧并不高深,但是很實(shí)用。一個(gè)實(shí)例如下:

alias cli1='$HOME/redis-3.0.4/bin/redis-cli -a xxx -p 1xx' 
alias cli2='$HOME/redis-3.0.4/bin/redis-cli -a xxx -p 1xx' 
alias cli3='$HOME/redis-3.0.4/bin/redis-cli -a xxx -p 1xx' 
alias clis='$HOME/redis-3.0.4/bin/redis-cli -p 26379' 

alias sctl='supervisorctl -c $HOME/redis-3.0.4/conf/redis-supervisord.conf ' 
alias sstart='supervisord -c $HOME/redis-3.0.4/conf/redis-supervisord.conf' 
alias see='pdsh -R ssh -w MSMSRED[1-3],PSMSRED1,PSMSAPP1 "/usr/local/bin/supervisorctl -c /smsred/redis-3.0.4/conf/redis-supervisord.conf status "' 

5.7.3 使用pdsh/pdcp進(jìn)行多機(jī)器操作

Pdsh/pdcp是一個(gè)python ssh多機(jī)操作的工具,在部署中可以采用它進(jìn)行多機(jī)的同一操作批量執(zhí)行,注意編譯的時(shí)候把ssh編譯進(jìn)去,在執(zhí)行時(shí)指定ssh模式,一個(gè)查看多機(jī)supervisord管理進(jìn)程的命令實(shí)例如下:

pdsh -R ssh -w MSMSRED[1-3],PSMSRED1,PSMSAPP1 "/usr/local/bin/supervisorctl -c /smsred/redis-3.0.4/conf/redis-supervisord.conf status "

前提是你這些機(jī)器已經(jīng)建立了ssh互信。建立互信可以用下邊這個(gè)腳本

#!/bin/bash 
#2015-12-08 
#author gnuhpc 

expect -c "spawn ssh-keygen -t rsa 
expect { 
\":\" {send \"\r\"; exp_continue} 
\"*(y/n)*\" {send \"y\r\"; exp_continue} 
} 
" 
for p in $(cat ip.cfg) 
do 
ip=$(echo "$p"|cut -f1 -d":") 
username=$(echo "$p"|cut -f2 -d":") 
password=$(echo "$p"|cut -f3 -d":") 
echo $password 

expect -c " 
spawn ssh-copy-id ${username}@$ip 
expect { 
\"*yes/no*\" {send \"yes\r\"; exp_continue} 
\"*(y/n)*\" {send \"y\r\"; exp_continue} 
\"*password*\" {send \"$password\r\"; exp_continue} 
\"*Password*\" {send \"$password\r\"; exp_continue} 
} 
" 
expect -c " 
spawn ssh ${username}@$ip "hostname" 
expect { 
\"*yes/no*\" {send \"yes\r\"; exp_continue} 
\"*password*\" {send \"$password\r\"; exp_continue} 
\"*(y/n)*\" {send \"y\r\"; exp_continue} 
\"*Password*\" {send \"$password\r\";} 
} 
" 
done

指定一個(gè)ip.cfg,里面的格式為:IP(主機(jī)名也行,只要能解析):用戶名:密碼 例如:

xxxx.139:username:password 
xxxx.140:username:password 
xxxx.141:username:password 
xxxx.142:username:password 
xxxx.137:username:password

5.7.4 使用腳本進(jìn)行sentinel配置文件的備份

Sentinel在啟動(dòng)、切換時(shí)會(huì)對(duì)config文件進(jìn)行rewrite,在上線前或者某些手動(dòng)維護(hù)后你可能希望把conf文件都變?yōu)樽畛?,?dāng)系統(tǒng)中有很多redis實(shí)例時(shí),這個(gè)手工操作會(huì)讓人瘋掉,那不妨寫個(gè)腳本在配置好sentinel和redis后不啟動(dòng)先備份一下,測(cè)試完畢后再恢復(fù)。

一個(gè)簡單的備份腳本如下:

backupconf.sh 
#!/bin/bash 
for i in `find ~/redis-3.0.4/conf -name *.conf` 
do 
cp -v $i ${i}.bak 
done

恢復(fù)腳本:

 recoveryconf.sh
#!/bin/bash 
for i in `find ~/redis-3.0.4/conf -name *.conf.bak` 
do 
cp -v $i ${i%.*} 
done