youngfan007 发表于 2018-11-4 12:45:33

redis应用之主从架构配置

#tail -f redis.log  
……………………
  
10370:M 12 Oct 11:02:25.148 # Server started, Redis version 3.0.7
  
10370:M 12 Oct 11:02:25.148 * DB loaded from append only file: 0.000 seconds
  
10370:M 12 Oct 11:02:25.148 * The server is now ready to accept connections on port 6379
  
10370:M 12 Oct 11:02:45.243 * Slave 10.0.18.146:6379 asks for synchronization
  
10370:M 12 Oct 11:02:45.243 * Full resync requested by slave 10.0.18.146:6379
  
10370:M 12 Oct 11:02:45.243 * Starting BGSAVE for SYNC with target: disk
  
10370:M 12 Oct 11:02:45.244 * Background saving started by pid 10384
  
10384:C 12 Oct 11:02:45.254 * DB saved on disk
  
10384:C 12 Oct 11:02:45.255 * RDB: 0 MB of memory used by copy-on-write
  
10370:M 12 Oct 11:02:45.303 * Background saving terminated with success
  
10370:M 12 Oct 11:02:45.303 * Synchronization with slave 10.0.18.146:6379 succeeded
  
在slave 上查看日志,如下:
  
#tail -f redis.log
  
………………
  
20825:S 12 Oct 11:02:44.278 * DB loaded from append only file: 0.000 seconds
  
20825:S 12 Oct 11:02:44.278 * The server is now ready to accept connections on port 6379
  
20825:S 12 Oct 11:02:45.278 * Connecting to MASTER 10.0.18.145:6379
  
20825:S 12 Oct 11:02:45.278 * MASTERSLAVE sync started
  
20825:S 12 Oct 11:02:45.279 * Non blocking connect for SYNC fired the event.
  
20825:S 12 Oct 11:02:45.280 * Master replied to PING, replication can continue...
  
20825:S 12 Oct 11:02:45.282 * Partial resynchronization not possible (no cached master)
  
20825:S 12 Oct 11:02:45.284 * Full resync from master: 80508d50892115ab7d158c643c6ee68cb9282c76:1
  
20825:S 12 Oct 11:02:45.343 * MASTERSLAVE sync: receiving 46 bytes from master
  
20825:S 12 Oct 11:02:45.344 * MASTERSLAVE sync: Flushing old data
  
20825:S 12 Oct 11:02:45.344 * MASTERSLAVE sync: Loading DB in memory
  
20825:S 12 Oct 11:02:45.344 * MASTERSLAVE sync: Finished with success
  
20825:S 12 Oct 11:02:45.345 * Background append only file rewriting started by pid 20828
  
20825:S 12 Oct 11:02:45.370 * AOF rewrite child asks to stop sending diffs.
  
20828:C 12 Oct 11:02:45.370 * Parent agreed to stop sending diffs. Finalizing AOF...
  
20828:C 12 Oct 11:02:45.370 * Concatenating 0.00 MB of AOF diff received from parent.
  
20828:C 12 Oct 11:02:45.371 * SYNC append only file rewrite performed
  
20828:C 12 Oct 11:02:45.371 * AOF rewrite: 0 MB of memory used by copy-on-write
  
20825:S 12 Oct 11:02:45.379 * Background AOF rewrite terminated with success
  
20825:S 12 Oct 11:02:45.379 * Residual parent diff successfully flushed to the rewritten AOF (0.00 MB)
  
20825:S 12 Oct 11:02:45.379 * Background AOF rewrite finished successfully
  
如果都可以正常启动,测试数据可以复制,表示主从复制就配置OK了!
  
注意:进入redis之后,需要认证后才能进去操作
  
#./redis-cli -h 10.0.18.145
  
10.0.18.145:6379> info
  
NOAUTH Authentication required.
  
10.0.18.145:6379> authabcd123    #输入密码
  
ok


页: [1]
查看完整版本: redis应用之主从架构配置