標籤:linux redis nosql
redis的主從配置簡直是太簡單了,簡單到蛋疼啊。650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0012.gif" alt="j_0012.gif" />
主redis的ip:192.168.1.100
從redis的ip:192.168.1.101
修改從redis的設定檔/etc/redis/redis.conf,添加下面的內容
slaveof 192.168.1.100 6379
650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />
從redis操作
[[email protected] ~]# /usr/local/redis/bin/redis-cli -h 192.168.1.101
192.168.1.101:6379> keys *
OK,至此,redis主從配置完成咯。650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0004.gif" alt="j_0004.gif" />
650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />
如果主redis掛了,從redis怎麼升級為主呢?
從redis操作,升級為主redis了,就是這麼簡單。
[[email protected] ~]# /usr/local/redis/bin/redis-cli slaveof NO ONE
650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0003.gif" alt="j_0003.gif" />
本文出自 “逢場做戲。” 部落格,請務必保留此出處http://xiaofengmo.blog.51cto.com/10116365/1757570
redis主從配置