win10下使用python訪問vmbox中的redis

來源:互聯網
上載者:User

標籤:localhost   使用   bind   htm   安裝python   get   imp   res   分享   

  瞭解到redis沒有windows的官方支援,所以在vmbox中的ubuntu裝了redis

#在ubuntu中#搜尋redis相關軟體資訊apt-cache search ^redis #不清楚為什麼不加正則符號出現一些毫不相關的,比如下面#bird-bgp - Internet Routing Daemon [transitional package]#安裝redis用戶端apt-get install redis-server#修改redis設定檔,否則宿主ip會被拒絕sudo vi /etc/redis/redis.conf#注釋掉bind 127.0.0.1 這裡的bind的意思是綁定當前機器的網卡地址,如果有多個網卡,綁定多個地址,空格分離,不是過濾掉外部ip的意思#方正我改成 bind 127.0.0.1 192.168.0.122,重啟redis失敗,bind 192.168.0.122也不行.這個ip是宿主機的ip#重啟redissudo /etc/init.d/redis-server restart#查看連接埠netstat -ntlp|grep 6379#以下是win10操作#查看是否安裝了pipD:\Program Files\Python351\Scripts中是否有pip.exe#如果沒有的話,安裝http://www.cnblogs.com/ptqueen/p/6678015.htmlpip install redis#安裝python的redis模組#python部分 import redis        self.conn = redis.Redis(db=15)
#這裡用的是轉送連接埠,預設localhost和6379,沒有密碼

nat連接埠轉寄:

 

之前橋接網路一直連不上,路過的大大的幫忙看看,感激不盡

http://bbs.csdn.net/topics/392218076

 

win10下使用python訪問vmbox中的redis

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.