Linux系統 redis 配置教程,linuxredis

來源:互聯網
上載者:User

Linux系統 redis 配置教程,linuxredis

redis-cli -h 127.0.0.1 -p 6379? [-a passwprd] [-n database] set cli1 1? ? ---- cli執行命令

#RDB
save 900 1    #當有一條Keys資料被改變時,900秒重新整理到Disk一次save 300 10   #當有10條Keys資料被改變時,300秒重新整理到Disk一次save 60 10000 #當有10000條Keys資料被改變時,60秒重新整理到Disk一次
#AOF
 appendonly yes??????? #啟用AOF appendfilename??????? #儲存的檔案!不能有路徑 appendfsync?????????? #always | everysec | no
no-appendfsync-on-rewrite yes ????????#在日誌重寫時不進行命令追加操作auto-aof-rewrite-percentage 100?????? #當增加檔案大小達到原來的AOF檔案的"100%" 時,自動進行重寫auto-aof-rewrite-min-size 64mb??????? #開機記錄重寫的最小值

redis-cli > info????????????????

找到最後幾行:

db0: key的數量是:11,

記憶體使用量量是: 891.52k

#主從配置

主:6379,從6380,6381

cp /usr/local/redis cp /usr/local/redis_6380

cp /usr/local/redis cp /usr/local/redis_6381

修改從6380和6381的redis.conf:設定檔

vi? /usr/local/redis_slave_6380/redis.conf

bind 127.0.0.1port 6380pidfile /var/run/redis_slave_6380.pidslave 127.0.0.7 63??? slave-read-only yesdir /usr/local/redis_slave_6380/data

vi? /usr/local/redis_slave_6381/redis.conf

bind 127.0.0.1port 6381pidfile /var/run/redis_salve_6381.pidslave 127.0.0.7 6379??? slave-read-only yesdir /usr/local/redis_slave_6381/data

修改從6380和6381 sentinel.conf 配置:? (可以忽略)

vi? /usr/local/redis_slave_6380/sentinal.con

port 26379????????????????????????????????????#The port that this sentinel instance will run osentinel monitor mymaster 127.0.0.1 6379 2????#

info replication 可看出6380是從

從伺服器變成主伺服器:

殺掉住伺服器

重啟開啟66379的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.