redis的安裝,以及supervisor對它的運行、關閉等進程管理

來源:互聯網
上載者:User
1:下載
wget http://download.redis.io/releases/redis-3.2.8.tar.gz

下載指定版本,可以登入https://redis.io/download查看 2:安裝

tar zxvf redis-3.2.8.tar.gzcd redis-3.2.8makesudo make install

這時Redis 的可執行檔被放到了/usr/local/bin 3:配置

sudo mkdir /etc/redissudo cp redis.conf /etc/redis/6379.confsudo cp utils/redis_init_script /etc/redis/
4:運行和關閉
cd /etc/redis
#使用root許可權運行sudo ./redis_init_script start
#再開啟一個終端,執行下面的命令關閉rediscd /etc/redis./redis_init_script stop
#也可以通過redis用戶端關閉redis-cli shutdown
5:使用supervisor監控進程
#先開啟supervisor設定檔sudo vi /etc/supervisord.conf

在檔案尾部添加代碼

[program:redisd];command=/etc/redis/redis_init_script start;不可以使用上面這種方式啟動redis進程,用這種方式,supervisor監控的是指令碼redis_init_script,而不是rediscommand=/usr/local/bin/redis-server /etc/redis/6379.confstdout_logfile=/var/log/supervisor/redis.logstdout_logfile_maxbytes=1MBstdout_logfile_backups=10username=rootpassword=root_password
6:更新supervisor配置
sudo supervisorctl update

現在redis服務已經在後台運行 7:關閉redis

在supervisord.conf檔案中,[program:redisd]標誌意味著在管理redis服務時,使用redisd(在redis後面加了一個字母d)去操作。
所以,關閉redis服務的方法有以下幾種

sudo supervisorctl stop redisd
#或者通過redis用戶端的方式關閉redis-cli shutdown
8:再次重新啟動
supervisorctl start redisd

更多supervisor操作,請查看:
linux進程管理工具supervisor http://blog.csdn.net/win_turn/article/details/60466562

相關文章

聯繫我們

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