我使用MySQL數據(1層)創建了一個運行在OpsWOrks(Ubuntu服務器)上的Rails應用程序(2層)。有沒有辦法在OpsWorks中將Redis圖層設置爲現有的Rails應用程序?
有沒有一種方法來創建Redis的另一層,並連接這個Redis的層到現有的Rails層(縣)?我可以創建Redis圖層,但不知道如何連接它們。
我讀過有辦法的Redis使用廚師配方添加到Rails的層,但我不是很熟悉的廚師,所以我要把層的方法。
編輯:
我試圖阻止的Redis中,「Rails的」層下添加此Redis的層,但結果還是一樣 - 我無法驗證Redis的工作。 如果我登錄到服務器(例如在rails-myapp1
一個),然後運行
Redis的-CLI
輸出
redis-cli
WARNING:root:could not open file '/etc/apt/sources.list.d/trusty-multiverse.list'
The program 'redis-cli' is currently not installed. To run 'redis-cli' please ask your administrator to install the package 'redis-tools'
任何提示如何計算出這個?
EDIT2:
我也有redis1
層下 「的Redis」(其中現在是 「無實例」),但結果是一樣的。
EDIT3:
如果我通過SSH連接的服務器上安裝了Redis的地方和運行redis-cli
然後KEYS *
看到所有什麼是Redis的緩存,沒有什麼。
在config/environments/production.rb
設置
#config.cache_store = :redis_store, "redis://localhost:6379/0/cache"
config.cache_store = :redis_store, "redis://127.0.0.1:6379/0/cache"
預先感謝您。
也許這個回答可以幫助你:http://stackoverflow.com/questions/35741359/how-to-run-redis-on-amazon-opsworks-for-a-rails-application –