设为首页 收藏本站
查看: 739|回复: 0

[经验分享] redis安装配置及使用【转】

[复制链接]

尚未签到

发表于 2016-12-20 08:11:20 | 显示全部楼层 |阅读模式
2011-03-27  20:41
  http://code.google.com/p/redis/
http://redis.io/commands/slaveof
http://redis.io/documentation
http://baike.baidu.com/view/4595959.htm
  在线演示:
http://try.redis-db.com/
  参考链接:
http://redis.io/
http://github.com/jdp/redisent/tree/master
http://github.com/owlient/phpredis
http://rediska.geometria-lab.net/
  python client : https://github.com/andymccurdy/redis-py/downloads
  安装:
  #yum install sinasrv2-redis
  wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
tar -zxvf redis-2.2.2.tar.gz
cd redis-2.2.2
make
make install
##
cp -p redis-server /usr/local/bin
cp -p redis-benchmark /usr/local/bin
cp -p redis-cli /usr/local/bin
cp -p redis-check-dump /usr/local/bin
cp -p redis-check-aof /usr/local/bin
  启动及停止:
nohup redis-server /etc/redis.conf &
redis-cli
/usr/local/sinasrv2/bin/redis-cli -p 7517 shutdown  
  http://redis.io/topics/data-types-intro
  配置:
  
daemonize yes
port 7613
pidfile /var/run/redis7613.pid
timeout 28800
loglevel verbose
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dir /data1/redis7613
dbfilename r7613.rdb
appendonly no
appendfsync everysec
vm-enabled no
vm-swap-file /data1/redis7613/r7613.swap
vm-max-memory 0
vm-page-size 32
vm-pages 134217728
vm-max-threads 4
glueoutputbuf yes
hash-max-zipmap-entries 64
hash-max-zipmap-value 512
activerehashing yes
  appendonly yes #持久化
82 # SLAVEOF host port
192.168.x.1 # slaveof 192.168.x.1 7113

  命令参考:

  CommandsClientsDocumentationCommunityDownloadIssues
AllKeysStringsHashesListsSetsSorted SetsPub/SubTransactionsConnectionServer

  • APPENDkey value Append a value to a key
  • AUTHpassword Authenticate to the server
  • BGREWRITEAOFAsynchronously rewrite the append-only file
  • BGSAVEAsynchronously save the dataset to disk
  • BLPOPkey [key ...] timeout Remove and get the first element in a list, or block until one is available
  • BRPOPkey [key ...] timeout Remove and get the last element in a list, or block until one is available
  • BRPOPLPUSHsource destination timeout Pop a value from a list, push it to another list and return it; or block until one is available
  • CONFIG GETparameter Get the value of a configuration parameter
  • CONFIG SETparameter value Set a configuration parameter to the given value
  • CONFIG RESETSTATReset the stats returned by INFO
  • DBSIZEReturn the number of keys in the selected database
  • DEBUG OBJECTkey Get debugging information about a key
  • DEBUG SEGFAULTMake the server crash
  • DECRkey Decrement the integer value of a key by one
  • DECRBYkey decrement Decrement the integer value of a key by the given number
  • DELkey [key ...] Delete a key
  • DISCARDDiscard all commands issued after MULTI
  • ECHOmessage Echo the given string
  • EXECExecute all commands issued after MULTI
  • EXISTSkey Determine if a key exists
  • EXPIREkey seconds Set a key's time to live in seconds
  • EXPIREATkey timestamp Set the expiration for a key as a UNIX timestamp
  • FLUSHALLRemove all keys from all databases
  • FLUSHDBRemove all keys from the current database
  • GETkey Get the value of a key
  • GETBITkey offset Returns the bit value at offset in the string value stored at key
  • GETRANGEkey start end Get a substring of the string stored at a key
  • GETSETkey value Set the string value of a key and return its old value
  • HDELkey field Delete a hash field
  • HEXISTSkey field Determine if a hash field exists
  • HGETkey field Get the value of a hash field
  • HGETALLkey Get all the fields and values in a hash
  • HINCRBYkey field increment Increment the integer value of a hash field by the given number
  • HKEYSkey Get all the fields in a hash
  • HLENkey Get the number of fields in a hash
  • HMGETkey field [field ...] Get the values of all the given hash fields
  • HMSETkey field value [field value ...] Set multiple hash fields to multiple values
  • HSETkey field value Set the string value of a hash field
  • HSETNXkey field value Set the value of a hash field, only if the field does not exist
  • HVALSkey Get all the values in a hash
  • INCRkey Increment the integer value of a key by one
  • INCRBYkey increment Increment the integer value of a key by the given number
  • INFOGet information and statistics about the server
  • KEYSpattern Find all keys matching the given pattern
  • LASTSAVEGet the UNIX time stamp of the last successful save to disk
  • LINDEXkey index Get an element from a list by its index
  • LINSERTkey BEFORE|AFTER pivot value Insert an element before or after another element in a list
  • LLENkey Get the length of a list
  • LPOPkey Remove and get the first element in a list
  • LPUSHkey value Prepend a value to a list
  • LPUSHXkey value Prepend a value to a list, only if the list exists
  • LRANGEkey start stop Get a range of elements from a list
  • LREMkey count value Remove elements from a list
  • LSETkey index value Set the value of an element in a list by its index
  • LTRIMkey start stop Trim a list to the specified range
  • MGETkey [key ...] Get the values of all the given keys
  • MONITORListen for all requests received by the server in real time
  • MOVEkey db Move a key to another database
  • MSETkey value [key value ...] Set multiple keys to multiple values
  • MSETNXkey value [key value ...] Set multiple keys to multiple values, only if none of the keys exist
  • MULTIMark the start of a transaction block
  • PERSISTkey Remove the expiration from a key
  • PINGPing the server
  • PSUBSCRIBEpattern [pattern ...] Listen for messages published to channels matching the given patterns
  • PUBLISHchannel message Post a message to a channel
  • PUNSUBSCRIBE[pattern [pattern ...]] Stop listening for messages posted to channels matching the given patterns
  • QUITClose the connection
  • RANDOMKEYReturn a random key from the keyspace
  • RENAMEkey newkey Rename a key
  • RENAMENXkey newkey Rename a key, only if the new key does not exist
  • RPOPkey Remove and get the last element in a list
  • RPOPLPUSHsource destination Remove the last element in a list, append it to another list and return it
  • RPUSHkey value Append a value to a list
  • RPUSHXkey value Append a value to a list, only if the list exists
  • SADDkey member Add a member to a set
  • SAVESynchronously save the dataset to disk
  • SCARDkey Get the number of members in a set
  • SDIFFkey [key ...] Subtract multiple sets
  • SDIFFSTOREdestination key [key ...] Subtract multiple sets and store the resulting set in a key
  • SELECTindex Change the selected database for the current connection
  • SETkey value Set the string value of a key
  • SETBITkey offset value Sets or clears the bit at offset in the string value stored at key
  • SETEXkey seconds value Set the value and expiration of a key
  • SETNXkey value Set the value of a key, only if the key does not exist
  • SETRANGEkey offset value Overwrite part of a string at key starting at the specified offset
  • SHUTDOWNSynchronously save the dataset to disk and then shut down the server
  • SINTERkey [key ...] Intersect multiple sets
  • SINTERSTOREdestination key [key ...] Intersect multiple sets and store the resulting set in a key
  • SISMEMBERkey member Determine if a given value is a member of a set
  • SLAVEOFhost port Make the server a slave of another instance, or promote it as master
  • SMEMBERSkey Get all the members in a set
  • SMOVEsource destination member Move a member from one set to another
  • SORTkey [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] Sort the elements in a list, set or sorted set
  • SPOPkey Remove and return a random member from a set
  • SRANDMEMBERkey Get a random member from a set
  • SREMkey member Remove a member from a set
  • STRLENkey Get the length of the value stored in a key
  • SUBSCRIBEchannel [channel ...] Listen for messages published to the given channels
  • SUNIONkey [key ...] Add multiple sets
  • SUNIONSTOREdestination key [key ...] Add multiple sets and store the resulting set in a key
  • SYNCInternal command used for replication
  • TTLkey Get the time to live for a key
  • TYPEkey Determine the type stored at key
  • UNSUBSCRIBE[channel [channel ...]] Stop listening for messages posted to the given channels
  • UNWATCHForget about all watched keys
  • WATCHkey [key ...] Watch the given keys to determine execution of the MULTI/EXEC block
  • ZADDkey score member Add a member to a sorted set, or update its score if it already exists
  • ZCARDkey Get the number of members in a sorted set
  • ZCOUNTkey min max Count the members in a sorted set with scores within the given values
  • ZINCRBYkey increment member Increment the score of a member in a sorted set
  • ZINTERSTOREdestination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] Intersect multiple sorted sets and store the resulting sorted set in a new key
  • ZRANGEkey start stop [WITHSCORES] Return a range of members in a sorted set, by index
  • ZRANGEBYSCOREkey min max [WITHSCORES] [LIMIT offset count] Return a range of members in a sorted set, by score
  • ZRANKkey member Determine the index of a member in a sorted set
  • ZREMkey member Remove a member from a sorted set
  • ZREMRANGEBYRANKkey start stop Remove all members in a sorted set within the given indexes
  • ZREMRANGEBYSCOREkey min max Remove all members in a sorted set within the given scores
  • ZREVRANGEkey start stop [WITHSCORES] Return a range of members in a sorted set, by index, with scores ordered from high to low
  • ZREVRANGEBYSCOREkey max min [WITHSCORES] [LIMIT offset count] Return a range of members in a sorted set, by score, with scores ordered from high to low
  • ZREVRANKkey member Determine the index of a member in a sorted set, with scores ordered from high to low
  • ZSCOREkey member Get the score associated with the given member in a sorted set
  • ZUNIONSTOREdestination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] Add multiple sorted sets and store the resulting sorted set in a new key
  This website is open source softwaredeveloped by Citrusbyte.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-316644-1-1.html 上篇帖子: 使用redis保存httpsession--tomcat8实现 下篇帖子: redis.conf 文件中的参数说明《转》
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表