2012-07-31 177 views
6

我試圖在debian機器上設置主從同步。我總是得到這個錯誤在我的日誌,我無法揣摩出的臨時文件應該是=/複製的Redis臨時文件的位置?

[9559] 31 Jul 11:48:17 * Connecting to MASTER... 
[9559] 31 Jul 11:48:17 * MASTER <-> SLAVE sync started 
[9559] 31 Jul 11:48:17 * Non blocking connect for SYNC fired the event. 
[9559] 31 Jul 11:48:22 # Opening the temp file needed for MASTER <-> SLAVE synchronization: Permission denied 

希望你們能幫助我:)

回答

7

運行redis-server進程的用戶很可能無法訪問工作目錄。

檢查redis.conf(在大多數情況下/etc/redis.conf),並找到dir設置(搜索「工作目錄」來找到它,併爲它的文檔),請確保該目錄是通過運行redis-server用戶可寫。

+0

我知道這是一箇舊的消息,但對我來說問題是在sentinel.conf中定義了臨時目錄路徑(redis-3.0.1) – mcorbe 2015-06-02 05:26:43

6

實際上由主在生成的文件SYNC時間是一個正常的快照文件(即rdb文件),寫在與任何其他rdb文件相同的位置。

此位置在主實例的Redis配置文件中設置 - 請參閱dir和dbfilename參數。

例如以產生/data/redis/dump.rdb

# The filename where to dump the DB 
dbfilename dump.rdb 

# The working directory. 
# 
# The DB will be written inside this directory, with the filename specified 
# above using the 'dbfilename' configuration directive. 
# 
# Also the Append Only File will be created inside this directory. 
# 
# Note that you must specify a directory here, not a file name. 
dir /data/redis 

當然轉儲,Redis的是爲推出的用戶必須擁有適當的訪問權限到這個位置。

現在,在從屬端,從主服務器讀取的轉儲文件被複制到臨時文件中,其名稱類似於temp-%d。%ld.rdb(包括時間戳和pid)。該文件在工作目錄中創建,該目錄對應於從實例配置中的dir參數。因此,即使RDB在從站側未處於活動狀態,也必須正確設置dir參數,並指向具有適當訪問權限的目錄。

相關問題