1. 程式人生 > >Python—操作redis及Windows 安裝啟動Redis

Python—操作redis及Windows 安裝啟動Redis

1、Windows 下先安裝 Redis  程式包;

     下載.msi 的安裝包

     到目錄下 

    啟動命令

     【停止服務】


redis-cli  shutdown
redis-cli -p 6379 shutdown
redis-cli -p 8888 shutdown


【啟動命令】
rides 對應目錄下執行命令
redis-serve

#啟動成功
               _._  
           _.-``__ ''-._  
      _.-``    `.  `_.  ''-._           Redis 2.8.12 (00000000/0) 64 bit  
  .-`` .-```.  ```\/    _.,_ ''-._  
 (    '      ,       .-`  | `,    )     Running in stand alone mode  
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379  
 |    `-._   `._    /     _.-'    |     PID: 6736  
  `-._    `-._  `-./  _.-'    _.-'  
 |`-._`-._    `-.__.-'    _.-'_.-'|  
 |    `-._`-._        _.-'_.-'    |           http://redis.io  
  `-._    `-._`-.__.-'_.-'    _.-'  
 |`-._`-._    `-.__.-'    _.-'_.-'|  
 |    `-._`-._        _.-'_.-'    |  
  `-._    `-._`-.__.-'_.-'    _.-'  
      `-._    `-.__.-'    _.-'  
          `-._        _.-'  
              `-.__.-'  
  
[6736] 10 Aug 22:01:22.247 # Server started, Redis version 2.8.12  
[6736] 10 Aug 22:01:22.248 * The server is now ready to accept connections on port 6379

Python  下 安裝擴充套件包

     pip install redis

#例項指令碼
# encoding=utf-8
# 載入模組
import redis

# 連結redis資料庫
r = redis.Redis(host='localhost', port=6379, db=0)

# 往redis中寫資料
r.set('hello','world')
print(r.get('hello'))

r.set('Key', 'value')

# 檢視對應的值
print 'Key', r.get('Key')

r['diaosi'] = 'yy'

r.set('xueba', 'xuexi')

r['xuezha'] = 'wan'

print (r.get('xuezha'))

# 檢視資料庫中有多少個key,多少條資料
print r.dbsize()

# 將資料儲存到硬碟中(儲存時阻塞)
r.save()

# 檢視鍵值是否存在

print "是否存在結果為:",r.exists("doubi")

# 列出所有鍵值
print "列出所有鍵值",r.keys()

# 刪除鍵值對應的資料
print r.delete('diaosi')
print r.delete('xuezha')

# 刪除當前資料庫所有資料
r.flushdb()
    
      




相關推薦

Python操作redisWindows 安裝啟動Redis

1、Windows 下先安裝 Redis  程式包;      下載.msi 的安裝包      到目錄下      啟動命令      【停止服務】 redis-cli  shutdown redi

python---rediswindows安裝以及測試

pri 實現 oca imp AR 兩個 python 安裝 cal pan 手冊以及下載地址http://www.runoob.com/redis/redis-install.html,以及啟動和測試 python 安裝redis模塊 pip3 install redi

centos7安裝redis開機自啟動(單機)

首先現在下載Linux下的安裝包 我是在/usr/local目錄下安裝的,至於安裝目錄自己看著辦吧 下載成功後當前目錄下有安裝包 接下來就是安裝原始碼包了 經過短暫的等待後接續編譯 到這裡,我們安裝的redis可以滿足一般的使用了,如果需要自己特殊的需求

linux(centos6.6) 下安裝,配置redis, 開機自啟動

1.下載Redis wget http://download.redis.io/redis-stable.tar.gz tar -zxvf redis-stable.tar.gz 解壓後進入 redis-stable 目錄 2.編譯,安裝 make &&am

windows啟動redis提示Invalid argument during startup: Failed to open the .conf file: redis.windows.connf CWD=C:UsersAdministrator

環境 ini nbsp invalid file users 但是 user src 環境:Windows 7 64bit 旗艦版 redis 3.2.100 64bit 開始的時候,redis運行的好好的,不過每次啟動都要要進入其路徑,挺麻煩的,

Python操作數據庫(mysql redis

tex 行數 元組 cursor nosql sql數據庫 字段 函數 mysql數據庫 一、python操作mysql數據庫: 數據庫信息:(例如211.149.218.16 szz 123456) 操作mysql用pymysql模塊

windows啟動redis

lin down con div post class tor run use 解決方案 使用現成的基於windows的redis程序 github上有許多封裝好的基於windows的redis程序,可以直接使用,但是版本更新不及時比如: https://github.co

Windows 安裝PHP-redis擴展

-s mic win .dll apache 使用 php.ini bin 一起 有沒有在Windows上安裝了redis但是一直安裝不上php-redis擴展的親呢?來一起學習一波吧!!! 安裝之前百度了好大一波呀,楞時沒裝上。。。 首先查看PHP信息(phpinfo):

Windows啟動Redis服務 並測試Redis

開啟Redis服務: 從cmd 進入到Redis的本地目錄下: 輸入: redis-server.exe redis.windows.conf 開啟了Redis服務,此視窗一直保持著這樣,關閉時會關閉Redis服務 測試Redis: 另起一視窗, 同樣是從cmd進入

VS2010如何一步步開發新增Windows服務(Windows service)服務安裝啟動

partial class MainService : ServiceBase {  private CETCBackServer cetcBackServer;         private IContainer components = null;         priva

Windows啟動redis服務端和客戶端

下載Redis在Redis的官網下載頁上有各種各樣的版本,我這次是在windows上部署的,要去GitHub上下載。目前的是2.8.12版的,直接解壓,在\bin\release 目錄下有個壓縮包,這就是我們需要的:啟動Redis直接在上圖的目錄開啟命令視窗,執行:redis-server redis.win

Windows啟動redis服務

windows下啟動redis服務然後,再開啟一個cmd視窗,啟動redis客戶端:一個redis服務一共有16張表,相當於16個數據庫,然後每個庫裡面可以建立任意多個表,其row(行編號)、value鍵值對如下

ubuntu安裝啟動redis(轉)

1、下載安裝 cd /tmp tar -zxf redis-2.2.13.tar.gz cd redis-2.2.13 make sudo make install 這時Redis 的可執行檔案被放到了/usr/local/bin 2、下載配置檔案和init啟動指令碼: 3、初始化

八、python操作excel網絡編程和異常處理

size let finally 必須 新的 異常信息 屬性 開發 tar 一、python操作excel 1、讀excel,xlrd模塊用來讀excel # book = xlrd.open_workbook(r‘students.xlsx‘)#打開excel# prin

Python操作資料庫mysql服務--安裝

目前,Python分為2.x和3.x版本,根據不同的版本,裝不同的Mysql服務。 1、Python 2.x版本安裝(MySQLdb) MySQLdb 是用於Python連結Mysql資料庫的介面,它實現了 Python 資料庫 API 規範 V2.0,基於 MySQL C API

Redis】CentOS7安裝配置Redis資料庫

第一步,下載 使用wget命令進行下載 wget http://download.redis.io/releases/redis-4.0.9.tar.gz 第二步,安裝編譯 解壓 tar -zxvf 然後進入redis路徑,使用 make

centos6.5 安裝python 3.5pip安裝

1、CentOS6.5 安裝Python 的依賴包 yum groupinstall "Development tools" yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-deve

Python 操作檔案目錄

一、python 檔案操作1.import glob 目錄操作檢視目錄內容:filelist=glob.glob(‘*.*’)filelist=glob.glob(‘c:/*’)檢視指定型別的檔案:filelist=glob.glob(‘c:/*.sys’)為了顯示一個目錄中

Redis 從下載安裝Redis sentinel 的高可用經驗總結

Step 1:Redis的下載安裝 官網下載redis 解壓並安裝: [[email protected] ~]# cd /home/ [[email protected] home]# wget http://download.redis.io/r

新裝固態硬碟SSD,在安裝WIN10,顯示一直請稍後Windows安裝程式無法將Windows配置為此計算機的解決方法(網上都是胡謅)

(破部落格限制圖片最大為2M ,無奈上傳不了圖片) 顯示-Windows安裝程式無法將Windows配置為此計算機的硬體執行 shift+F10進入cmd輸入 cd oobe 再輸入 msoobe