redis服務啟動關閉以及其他命令實踐

來源:互聯網
上載者:User
啟動 Redis 服務
redis-server或者redis-server redis.conf

redis-server redis.conf 1>log.log 2>errlog.log

1為標準輸出,2為錯誤輸出 將 Redis 作為 Linux 服務隨機啟動
vim /etc/rc.local, 加入代碼:

/root/install/redis-2.8.4/src/redis-server

用戶端串連 :redis-cli 啟動用戶端

設定redis 許可權認證
config set requirepass Mamaji2015
auth "Mamaji2015"
停止redis服務:pkill redis-server  或者 redis-cli shutdown


取出當前匹配的所有key -- keys *

當前的key是否存在 -- exists larry 

刪除當前key -- del  lv

設定到期時間 -- expire larry 10

移動larry索引值對到ad4資料庫--  move larry ad4

移除當前key的到期時間 -- persist lv

隨機返回一個key -- randomkey

重新命名key -- rename

傳回值的資料類型 -- type
例如:type testlist

返回:list

測試連接是否還在 -- ping

列印 -- echo name

"larry"

資料庫切換 -- select ad4databank
返回:OK

退出串連 -- quit

當前資料庫中key的數量 -- dbsize
(integer) 12

伺服器基本資料 -- info

即時轉儲收到的請求 -- monitor

擷取伺服器的參數配置 -- config get

清空當前資料庫 -- flushdb

清除所有資料庫 -- flushall

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.