亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    單機Redis環(huán)境搭建方法

    下面由Redis教程欄目給大家介紹單機Redis環(huán)境搭建方法,希望對需要的朋友有所幫助!

    單機Redis環(huán)境搭建方法

    序言

    在實際開發(fā)項目過程中, 如果說要用到緩存, 那么第一個想到的一定是Redis, 但是為什么選Redis大多數(shù)人都不會去了解, 也不會去思考, 只知道它能當緩存使用, 比數(shù)據(jù)庫快一點, 恰巧我也是這樣的一個人;所以, 當我想寫一篇關于Redis介紹的時候, 我竟然無從說起; 這也是對于Redis以及主流內存數(shù)據(jù)庫不熟的原因; 不過, 在以后的日子里, 一定增加自己對于框架的思考與深入, 讓自己在后面的技術道路上有所沉淀, 希望以后有人讓我簡要介紹Redis的時候, 我不會無從說起;這或許就是我想寫Redis系列博客的目的所在吧!

    一、Redis環(huán)境搭建

    下載redis穩(wěn)定版

    curl -o redis.tar.gz http://download.redis.io/releases/redis-stable.tar.gz

    解壓redis包

    tar -zxvf redis-stable.tar.gz -C ./ // 該命令表示解壓tar.gz包到當前目錄

    編譯安裝redis

    進入到解壓的Redis的目錄下, 使用如下命令編譯安裝Redis

    sudo make && make install PREFIX=/usr/local/redis

    編輯配置Redis配置文件

    sudo cp redis.conf /usr/local/redis/conf/

    啟動Redis服務

    ./redis-server ../conf/redis.conf & //啟動的時候后臺運行

    啟動輸出日志:

    45894:C 02 Nov 2018 22:11:19.922 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=45894, just started 45894:C 02 Nov 2018 22:11:19.922 # Configuration loaded 45894:M 02 Nov 2018 22:11:19.924 * Increased maximum number of open files to 10032 (it was originally set to 256).                 _._                                                              _.-``__ ''-._                                                    _.-``    `.  `_.  ''-._           Redis 5.0.0 (00000000/0) 64 bit   .-`` .-```.  ```/    _.,_ ''-._                                     (    '      ,       .-`  | `,    )     Running in standalone mode  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379  |    `-._   `._    /     _.-'    |     PID: 45894   `-._    `-._  `-./  _.-'    _.-'                                     |`-._`-._    `-.__.-'    _.-'_.-'|                                    |    `-._`-._        _.-'_.-'    |           http://redis.io           `-._    `-._`-.__.-'_.-'    _.-'                                     |`-._`-._    `-.__.-'    _.-'_.-'|                                    |    `-._`-._        _.-'_.-'    |                                     `-._    `-._`-.__.-'_.-'    _.-'                                          `-._    `-.__.-'    _.-'                                                  `-._        _.-'                                                          `-.__.-'                                                45894:M 02 Nov 2018 22:11:19.933 # Server initialized 45894:M 02 Nov 2018 22:11:19.933 * Ready to accept connections

    驗證Redis服務

    使用網(wǎng)絡工具telnet驗證

    terrydeMacBook-Air:bin terrylmay$ telnet 127.0.0.1 6379 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.

    使用系統(tǒng)進程ps 驗證

    terrydeMacBook-Air:bin terrylmay$ ps -ef | grep redis   501 45894 44430   0 10:11下午 ttys000    0:00.04 ./redis-server 127.0.0.1:6379 //一個是Redis服務   501 45897 44430   0 10:11下午 ttys000    0:00.00 grep redis //ps查詢進程自己

    到這里, 一個單機版的Redis服務就搭建完成了!

    二、使用Redis存儲數(shù)據(jù)

    Redis CLI連接Redis服務

    terrydeMacBook-Air:bin terrylmay$ ./redis-cli 127.0.0.1:6379>  127.0.0.1:6379> set name terrylmay OK 127.0.0.1:6379> get name  "terrylmay" 127.0.0.1:6379>

    到此, 我們可以使用Redis系統(tǒng)來存儲數(shù)據(jù)字符串數(shù)據(jù)了.

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號