(一)
1.離線(xiàn)安裝
在Tornado官網(wǎng)中獲取
命令:tar xzvf tornado-1.2.1.tar.gz
cd tornado-1.2.1
python setup.py build
sudo python setip.py install
2.在線(xiàn)安裝【pip】
命令:pip install tornado
3.測(cè)試
test.py
import tornado.ioloop
import tornado.web
class MianHandler(tornado.web.RequestHandler):
def get(self):
? ? ? ?self.write("Hello XX")
application = tornado.web.Application([
(r"/",MainHandler),
])
if __name__=="__main__":
?application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
4.輸出
python test.py
啟動(dòng)tornado進(jìn)程叼屠,訪(fǎng)問(wèn)http://127.0.0.1:8888即可打印Hello XX
(二)
1.安裝Nginx
命令:cd /etc
sudo apt-get install nginx
2.啟動(dòng)Nginx
命令:sudo /etc/init.d/nginx start
然后訪(fǎng)問(wèn)http://localhost/
(三)
1.安裝Redis
官網(wǎng)獲取
命令:wget http://download.redis.io/release/redis-3.2.0.tar.gz
解壓:tar xzvf redis-3.2.0.tar.gz
進(jìn)入:cd redis-3.2.0
編譯:sudo make
安裝:sudo make install
測(cè)試:sudo make test
2.移動(dòng)文件统刮,便于管理
sudo mkdir -p /usr/local/redis/bin
sudo mkdir -p /usr/local/redis/etc
mv /Downloads/redis-3.2.0/redis-conf /usr/local/redis/etc
cd /Downloads/redis-3.2.0/src
mv mkreleasehdr.sh redis-benchmark redis-check-aof ?redis-check-rdb redis-cli redis-server /usr/local/redis/bin
3.啟動(dòng)Redis服務(wù)
/usr/local/redis/bin/redis-server
/usr/local/redis/etc/redis.conf
Redis服務(wù)端的默認(rèn)連接端口是6379
4.客戶(hù)端連接
/usr/local/redis/bin/redis-cli
5.停止Redis
/usr/local/redis/bin/redis-cli
shutdown
或者pkill redis-server
6.Redis的配置
daemonize ? ? ? ?如果需要在后臺(tái)運(yùn)行兴泥,把該項(xiàng)改為yes
pidfile ? ? ? ? ? ? ? ? ?配置多個(gè)pid的地址默認(rèn)在/var/run/redis.pid
bind ? ? ? ? ? ? ? ? ? ?綁定ip脂倦,設(shè)置后只接受來(lái)自該ip的請(qǐng)求
port ? ? ? ? ? ? ? ? ? ? 監(jiān)聽(tīng)端口灾而,默認(rèn)為6379
timeout ? ? ? ? ? ?設(shè)置客戶(hù)端連接時(shí)的超時(shí)時(shí)間弄抬,單位為秒
loglevel ? ? ? ? ? ? 分為4級(jí),debug/verbose/notice/warning
logfile ? ? ? ? ? ? ? ? ? 配置log文件地址
databases ? ? ? ? ? ?設(shè)置數(shù)據(jù)庫(kù)的個(gè)數(shù)缕允,默認(rèn)使用的數(shù)據(jù)庫(kù)為0
save ? ? ? ? ? ? ? ? ? 設(shè)置redis進(jìn)行數(shù)據(jù)庫(kù)鏡像的頻率
rbdcompression ? ? 在進(jìn)行鏡像備份時(shí)峡扩,是否進(jìn)行壓縮
Dbfilename ? ? ? ? ? ? 鏡像備份文件的文件名
Dir ? ? ? ? ? ? ? ? ? ? ? ? ?數(shù)據(jù)庫(kù)鏡像備份的文件防止路徑
Slaveof ? ? ? ? ? ? ? ?設(shè)置數(shù)據(jù)庫(kù)為其他數(shù)據(jù)庫(kù)的主從數(shù)據(jù)庫(kù)
Masterauth ? ? ? ? ? ? 主數(shù)據(jù)庫(kù)連接需要的密碼驗(yàn)證
Requirepass ? ? ? ? ? ?設(shè)置登錄時(shí)需要使用的密碼
Maxclients ? ? ? ? ? ? 限制同時(shí)連接的客戶(hù)數(shù)量
Maxmemory ? ? ? ? ?設(shè)置redis能夠使用的最大內(nèi)存
Appendonly ? ? ? 開(kāi)啟append only模式
Appendfsync ? ? ? ? ?設(shè)置對(duì)appendonly.aof文件同步的頻率
vm-enabled ? ? ? 是否開(kāi)啟虛擬內(nèi)存支持
vm-swap-file ? ? ? ? 設(shè)置虛擬內(nèi)存交換文件路徑
vm-max-memory ? ? ?設(shè)置redis使用的最大物理內(nèi)存大小
vm-page-size ? ? ? ? ? ?設(shè)置虛擬內(nèi)存的頁(yè)大小
vm-pages ? ? ? ? ? ? ? ? ? ? 設(shè)置交換文件的總的page數(shù)量
vm-max-threads ? ? ? 設(shè)置VMIO同時(shí)使用的線(xiàn)程數(shù)量
Glueoutputbuf ? ? ? ?把小的輸出緩存存放在一起
hash-max-zipmap-entries ? ? ? ?設(shè)置hash的臨界值
Activerehashing ? ? ? ? ? ?重新hash