`
zhaohaolin
  • 浏览: 1012309 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

redis安装配置及使用【转】

阅读更多
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

命令参考:

Commands Clients Documentation Community Download Issues

All Keys Strings Hashes Lists Sets Sorted Sets Pub/Sub Transactions Connection Server
  • APPEND key value Append a value to a key
  • AUTH password Authenticate to the server
  • BGREWRITEAOF Asynchronously rewrite the append-only file
  • BGSAVE Asynchronously save the dataset to disk
  • BLPOP key [key ...] timeout Remove and get the first element in a list, or block until one is available
  • BRPOP key [key ...] timeout Remove and get the last element in a list, or block until one is available
  • BRPOPLPUSH source destination timeout Pop a value from a list, push it to another list and return it; or block until one is available
  • CONFIG GET parameter Get the value of a configuration parameter
  • CONFIG SET parameter value Set a configuration parameter to the given value
  • CONFIG RESETSTAT Reset the stats returned by INFO
  • DBSIZE Return the number of keys in the selected database
  • DEBUG OBJECT key Get debugging information about a key
  • DEBUG SEGFAULT Make the server crash
  • DECR key Decrement the integer value of a key by one
  • DECRBY key decrement Decrement the integer value of a key by the given number
  • DEL key [key ...] Delete a key
  • DISCARD Discard all commands issued after MULTI
  • ECHO message Echo the given string
  • EXEC Execute all commands issued after MULTI
  • EXISTS key Determine if a key exists
  • EXPIRE key seconds Set a key's time to live in seconds
  • EXPIREAT key timestamp Set the expiration for a key as a UNIX timestamp
  • FLUSHALL Remove all keys from all databases
  • FLUSHDB Remove all keys from the current database
  • GET key Get the value of a key
  • GETBIT key offset Returns the bit value at offset in the string value stored at key
  • GETRANGE key start end Get a substring of the string stored at a key
  • GETSET key value Set the string value of a key and return its old value
  • HDEL key field Delete a hash field
  • HEXISTS key field Determine if a hash field exists
  • HGET key field Get the value of a hash field
  • HGETALL key Get all the fields and values in a hash
  • HINCRBY key field increment Increment the integer value of a hash field by the given number
  • HKEYS key Get all the fields in a hash
  • HLEN key Get the number of fields in a hash
  • HMGET key field [field ...] Get the values of all the given hash fields
  • HMSET key field value [field value ...] Set multiple hash fields to multiple values
  • HSET key field value Set the string value of a hash field
  • HSETNX key field value Set the value of a hash field, only if the field does not exist
  • HVALS key Get all the values in a hash
  • INCR key Increment the integer value of a key by one
  • INCRBY key increment Increment the integer value of a key by the given number
  • INFO Get information and statistics about the server
  • KEYS pattern Find all keys matching the given pattern
  • LASTSAVE Get the UNIX time stamp of the last successful save to disk
  • LINDEX key index Get an element from a list by its index
  • LINSERT key BEFORE|AFTER pivot value Insert an element before or after another element in a list
  • LLEN key Get the length of a list
  • LPOP key Remove and get the first element in a list
  • LPUSH key value Prepend a value to a list
  • LPUSHX key value Prepend a value to a list, only if the list exists
  • LRANGE key start stop Get a range of elements from a list
  • LREM key count value Remove elements from a list
  • LSET key index value Set the value of an element in a list by its index
  • LTRIM key start stop Trim a list to the specified range
  • MGET key [key ...] Get the values of all the given keys
  • MONITOR Listen for all requests received by the server in real time
  • MOVE key db Move a key to another database
  • MSET key value [key value ...] Set multiple keys to multiple values
  • MSETNX key value [key value ...] Set multiple keys to multiple values, only if none of the keys exist
  • MULTI Mark the start of a transaction block
  • PERSIST key Remove the expiration from a key
  • PING Ping the server
  • PSUBSCRIBE pattern [pattern ...] Listen for messages published to channels matching the given patterns
  • PUBLISH channel message Post a message to a channel
  • PUNSUBSCRIBE [pattern [pattern ...]] Stop listening for messages posted to channels matching the given patterns
  • QUIT Close the connection
  • RANDOMKEY Return a random key from the keyspace
  • RENAME key newkey Rename a key
  • RENAMENX key newkey Rename a key, only if the new key does not exist
  • RPOP key Remove and get the last element in a list
  • RPOPLPUSH source destination Remove the last element in a list, append it to another list and return it
  • RPUSH key value Append a value to a list
  • RPUSHX key value Append a value to a list, only if the list exists
  • SADD key member Add a member to a set
  • SAVE Synchronously save the dataset to disk
  • SCARD key Get the number of members in a set
  • SDIFF key [key ...] Subtract multiple sets
  • SDIFFSTORE destination key [key ...] Subtract multiple sets and store the resulting set in a key
  • SELECT index Change the selected database for the current connection
  • SET key value Set the string value of a key
  • SETBIT key offset value Sets or clears the bit at offset in the string value stored at key
  • SETEX key seconds value Set the value and expiration of a key
  • SETNX key value Set the value of a key, only if the key does not exist
  • SETRANGE key offset value Overwrite part of a string at key starting at the specified offset
  • SHUTDOWN Synchronously save the dataset to disk and then shut down the server
  • SINTER key [key ...] Intersect multiple sets
  • SINTERSTORE destination key [key ...] Intersect multiple sets and store the resulting set in a key
  • SISMEMBER key member Determine if a given value is a member of a set
  • SLAVEOF host port Make the server a slave of another instance, or promote it as master
  • SMEMBERS key Get all the members in a set
  • SMOVE source destination member Move a member from one set to another
  • SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] Sort the elements in a list, set or sorted set
  • SPOP key Remove and return a random member from a set
  • SRANDMEMBER key Get a random member from a set
  • SREM key member Remove a member from a set
  • STRLEN key Get the length of the value stored in a key
  • SUBSCRIBE channel [channel ...] Listen for messages published to the given channels
  • SUNION key [key ...] Add multiple sets
  • SUNIONSTORE destination key [key ...] Add multiple sets and store the resulting set in a key
  • SYNC Internal command used for replication
  • TTL key Get the time to live for a key
  • TYPE key Determine the type stored at key
  • UNSUBSCRIBE [channel [channel ...]] Stop listening for messages posted to the given channels
  • UNWATCH Forget about all watched keys
  • WATCH key [key ...] Watch the given keys to determine execution of the MULTI/EXEC block
  • ZADD key score member Add a member to a sorted set, or update its score if it already exists
  • ZCARD key Get the number of members in a sorted set
  • ZCOUNT key min max Count the members in a sorted set with scores within the given values
  • ZINCRBY key increment member Increment the score of a member in a sorted set
  • ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] Intersect multiple sorted sets and store the resulting sorted set in a new key
  • ZRANGE key start stop [WITHSCORES] Return a range of members in a sorted set, by index
  • ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count] Return a range of members in a sorted set, by score
  • ZRANK key member Determine the index of a member in a sorted set
  • ZREM key member Remove a member from a sorted set
  • ZREMRANGEBYRANK key start stop Remove all members in a sorted set within the given indexes
  • ZREMRANGEBYSCORE key min max Remove all members in a sorted set within the given scores
  • ZREVRANGE key start stop [WITHSCORES] Return a range of members in a sorted set, by index, with scores ordered from high to low
  • ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count] Return a range of members in a sorted set, by score, with scores ordered from high to low
  • ZREVRANK key member Determine the index of a member in a sorted set, with scores ordered from high to low
  • ZSCORE key member Get the score associated with the given member in a sorted set
  • ZUNIONSTORE destination 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 software developed by Citrusbyte .

分享到:
评论

相关推荐

    Redis安装配置文档

    通过以上步骤,Redis便安装和配置完成,用户可以使用Redis进行高效的数据存储和管理。 本文档指导用户如何安装和配置Redis,实现高效的数据存储和管理。Redis的安装和配置需要注意许多细节,以避免可能出现的问题。...

    悟空无代码平台-redis安装配置

    CRMHRMERPSRM100+ redis安装配置 redis安装配置 redis安装配置 redis安装配置 redis安装配置

    Redis安装配置

    Redis配置文件详解 Redis的配置文件是redis.conf,下面详细介绍配置文件中的各个配置项: 1. `daemonize no`:设置Redis是否以守护进程方式运行,默认为no,表示Redis以前台进程方式运行。 2. `pidfile /var/run/...

    RunnerGo-redis安装配置

    RunnerGoApache-2.0 license Star redis安装配置 redis安装配置 redis安装配置 redis安装配置 redis安装配置

    WeiXinMPSDK-redis安装配置

    .NET SDK Senparc.Weixin for C# .NET Framework .NET Core.NET 8.0/JSSDK WeChat SDK for C#. redis安装配置 redis安装配置 redis安装配置 redis安装配置 redis安装配置

    redis安装配置.md

    以下是Redis的安装和配置步骤: ### 1. 下载Redis 您可以从Redis官方网站(https://redis.io/download)下载最新版本的Redis。选择合适的版本并下载压缩包到本地。 ### 2. 解压Redis 在您希望安装Redis的目录中...

    redis安装及使用

    ### Redis安装及使用详解 #### 一、Redis简介 Redis是一种高性能的键值对存储系统,采用内存存储机制,能够实现快速的数据访问速度。它支持多种数据结构,包括字符串(Strings)、散列(Hashes)、列表(Lists)、...

    redis 6.0.6配置文件

    redis 6.0.6配置文件

    linux下的redis安装包含配置文件

    本文将详细讲解如何在Linux环境下安装Redis,以及如何配置主服务器和从服务器。 首先,让我们从安装Redis开始。在大多数Linux发行版中,可以通过包管理器进行安装。例如,在Ubuntu或Debian上,可以使用以下命令: ...

    redis安装配置 及主从同步

    本文将详细介绍Redis的安装配置过程以及如何实现主从同步。 一、Redis的安装 1. 下载Redis 首先,你需要从Redis官方网站(https://redis.io/download)下载最新版本的Redis源码包。确保下载的是适合你操作系统...

    redis配置安装详细教程

    "Redis 配置安装详细教程" Redis 是一个开源、基于内存的数据结构存储系统,可以...通过本教程,您已经学会了如何安装、配置和使用 Redis 数据库。Redis 是一个功能强大且灵活的数据存储系统,广泛应用于各种场景中。

    redis的配置及操作

    创建用于存放Redis配置文件的目录。 5. **处理编译过程中的常见问题**: - 如果遇到`gcc:命令未找到`的错误,可以通过以下命令解决: ```bash yum -y install gcc-c++ ``` - 如果出现关于jemalloc的问题,...

    Linux redis安装配置启停手册.docx

    Linux Redis 安装配置启停手册 Linux Redis 安装配置启停手册是一份详细的指南,旨在指导用户在 Linux 系统中安装、配置和启停 Redis 服务器。下面是从这份手册中提炼出的关键知识点: 一、Redis 安装 * 查看 GCC...

    Redis教程 安装配置 软件等

    二、Redis配置 Redis的配置文件通常位于`/etc/redis/redis.conf`。以下是一些重要的配置项: 1. `bind`: 指定Redis监听的IP地址,默认为127.0.0.1,若要允许远程访问,可更改为0.0.0.0。 2. `port`: 设置Redis...

    linux下如何安装配置redis及主从配置

    使用`redis-cli`启动Redis客户端,验证服务器的安装和配置。 2. **设置和获取键值**: 在客户端中进行简单的键值设置和获取操作,以验证Redis是否正常工作。 ### 主从复制配置 主从复制是指一个主Redis服务器将...

    redis安装及php扩展redis的安装

    Redis 安装及 PHP 扩展 Redis 的安装 Redis 是一个开源的、基于内存的数据结构存储系统,可以用作数据库、消息队列、缓存等多种用途。下面是关于 Redis 安装及 PHP 扩展 Redis 的安装的详细知识点: Redis 安装 ...

    redis 安装配置-redis 基础

    redis安装配置

    redis安装使用文档

    - 将Redis配置文件`redis.conf`复制到适当的配置目录,如`/etc/`。 - 修改`redis.conf`配置文件以满足你的需求,例如设置监听端口、密码保护等。 - 使用`sudo systemctl start redis`启动Redis服务。 对于Windows...

    redis安装配置指南

    在centos6.5下源码安装配置redis。Redis 是一个高性能的key-value数据库。 redis的出现,很大程度补偿了memcached这类keyvalue存储的不足,在部 分场合可以对关系数据库起到很好的补充作用。它提供了Python,Ruby,...

Global site tag (gtag.js) - Google Analytics