真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

suse11安裝測試redis-創(chuàng)新互聯(lián)

suse11 安裝測試redis
一,下載安裝redis 最新源碼包
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
--2013-05-12 18:09:57--  http://redis.googlecode.com/files/redis-2.6.13.tar.gz
Resolving redis.googlecode.com... 173.194.72.82, 2404:6800:4008:c00::52
Connecting to redis.googlecode.com|173.194.72.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 994331 (971K) [application/x-gzip]
Saving to: `redis-2.6.13.tar.gz'

100%[======================================================================================>] 994,331   3.26M/s  in 0.3s

2013-05-12 18:09:57 (3.26 MB/s) - `redis-2.6.13.tar.gz' saved [994331/994331]
SLES11-108:~/nosql # tar zxvf redis-2.6.13.tar.gz
SLES11-108:~/nosql # cd redis-2.6.13/
make
  CC sentinel.o
  LINK redis-server
  INSTALL redis-sentinel
  CC redis-cli.o
  LINK redis-cli
  CC redis-benchmark.o
  LINK redis-benchmark
  CC redis-check-dump.o
  LINK redis-check-dump
  CC redis-check-aof.o
  LINK redis-check-aof

Hint: To run 'make test' is a good idea ;)
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-server /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-cli /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp ../redis.conf  /etc/

SLES11-108:~/nosql/redis-2.6.13/src #

daemonize yesSLES11-108:/etc # cat /etc/redis.conf  |grep -Ev "^#|^$"
pidfile /var/run/redis.pid
port 6379
timeout 0
tcp-keepalive 0
loglevel notice
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
二,啟動redis
SLES11-108:/etc # ps -ef |grep redis
root   23801   1  0 18:16 ?     00:00:00 redis-server /etc/redis.conf
root   23805 21983  0 18:17 pts/0   00:00:00 grep redis
SLES11-108:/etc # netstat -tplun |grep 6379
tcp     0    0 0.0.0.0:6379       0.0.0.0:*        LISTEN    23801/redis-server
SLES11-108:/etc #
三,測試redis  (測試list類型數(shù)據(jù))
SLES11-108:~ # redis-cli
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> help set  #查看幫助參數(shù),在命令的前面加help

 SET key value
 summary: Set the string value of a key
 since: 1.0.0
 group: string
 redis 127.0.0.1:6379> help @set  #如果要查看一個類型的全部命令 加@

 SADD key member [member ...]
 summary: Add one or more members to a set
 since: 1.0.0

 SCARD key
 summary: Get the number of members in a set
 since: 1.0.0

 SDIFF key [key ...]
 summary: Subtract multiple sets
 since: 1.0.0
...
后續(xù)省略

redis 127.0.0.1:6379> lpush test a b c #該命令會創(chuàng)建該鍵及與其關聯(lián)的List,之后在將參數(shù)中的values從左到右依次插入。
(integer) 3
redis 127.0.0.1:6379> lrange test 0 -1 #取鏈表中的全部元素,其中0表示第一個元素,-1表示最后一個元素。
1) "c"
2) "b"
3) "a"
redis 127.0.0.1:6379> lpushx test1 d #庫中沒有該鍵值,顯示為0
(integer) 0
redis 127.0.0.1:6379> lpushx test d  # 庫中有該鍵值,并且把剛剛加的d 添加進去了
(integer) 4
redis 127.0.0.1:6379> lrange test1
(error) ERR wrong number of arguments for 'lrange' command
redis 127.0.0.1:6379> lrange test1 0 -1
(empty list or set)
redis 127.0.0.1:6379> lrange test 0 -1
1) "d"
2) "c"
3) "b"
4) "a"
redis 127.0.0.1:6379>

四,下載安裝python連接redis模塊
SLES11-108:~/nosql # wget https://pypi.python.org/packages/source/r/redis/redis-2.7.4.tar.gz
--2013-05-12 18:18:58--  https://pypi.python.org/packages/source/r/redis/redis-2.7.4.tar.gz
Resolving pypi.python.org... 140.211.10.69
Connecting to pypi.python.org|140.211.10.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 79715 (78K) [application/octet-stream]
Saving to: `redis-2.7.4.tar.gz'

100%[======================================================================================>] 79,715    183K/s  in 0.4s

2013-05-12 18:18:59 (183 KB/s) - `redis-2.7.4.tar.gz' saved [79715/79715]
SLES11-108:~/nosql/redis-2.7.4 # python setup.py  install
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
 warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/redis
copying redis/exceptions.py -> build/lib/redis
copying redis/_compat.py -> build/lib/redis
copying redis/connection.py -> build/lib/redis
copying redis/client.py -> build/lib/redis
copying redis/__init__.py -> build/lib/redis
copying redis/utils.py -> build/lib/redis
running install_lib
creating /usr/local/lib64/python2.6
creating /usr/local/lib64/python2.6/site-packages
creating /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/exceptions.py -> /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/_compat.py -> /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/connection.py -> /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/client.py -> /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/__init__.py -> /usr/local/lib64/python2.6/site-packages/redis
copying build/lib/redis/utils.py -> /usr/local/lib64/python2.6/site-packages/redis
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/exceptions.py to exceptions.pyc
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/_compat.py to _compat.pyc
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/connection.py to connection.pyc
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/client.py to client.pyc
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/__init__.py to __init__.pyc
byte-compiling /usr/local/lib64/python2.6/site-packages/redis/utils.py to utils.pyc
running install_egg_info
Writing /usr/local/lib64/python2.6/site-packages/redis-2.7.4-py2.6.egg-info
五,簡單測試python連接redis
SLES11-108:~/nosql/redis-2.7.4 # python
Python 2.6 (r26:66714, Feb  2 2012, 16:59:44)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import redis
>>> a = redis.testredis(host='localhost',port=6379,db=0)
Traceback (most recent call last):
 File "", line 1, in
AttributeError: 'module' object has no attribute 'testredis'
>>> a = redis.Redis(host='localhost',port=6379,db=0)
>>> a.set('test','abc')  #設置一個字符串類型的名稱為test的key,內容為abc
True
>>> a.get('test')  #顯示該test的內容
'abc'
>>> a.dbsize()  #查看庫里有多少數(shù)據(jù)
1L
>>> a.get('test1')  #get 一個庫里沒有的,顯示為空
>>> a.delete('test')  #刪除
True
>>> a.dbsize()  #再查看庫里的數(shù)據(jù),沒有了
0L
>>> a.exists('test')  #判斷 該名稱的的key 是否存在,因為剛刪除,為空
False
>>> a.set('mykey','cde')  #新加一個mykey名稱的key
True
>>> a.exists('mykey')  #判斷為真 ,證明添加上了
True
>>> a.keys()  #查看庫里key的列表
['mykey']
>>> quit() #退出

10年的永勝網(wǎng)站建設經(jīng)驗,針對設計、前端、開發(fā)、售后、文案、推廣等六對一服務,響應快,48小時及時工作處理。營銷型網(wǎng)站的優(yōu)勢是能夠根據(jù)用戶設備顯示端的尺寸不同,自動調整永勝建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設計,從而大程度地提升瀏覽體驗。成都創(chuàng)新互聯(lián)從事“永勝網(wǎng)站設計”,“永勝網(wǎng)站推廣”以來,每個客戶項目都認真落實執(zhí)行。

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。


網(wǎng)頁名稱:suse11安裝測試redis-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://weahome.cn/article/dsgdgc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部