Redis master and slave
1. Download Redis zip package for Windows: https://github.com/ServiceStack/redis-windows
2. Copy redis.windos.conf to master.conf and slave.conf.
3. master.conf
port: 6379
4. slave.conf
port: 6378
slaveof 127.0.0.1 6379
5. Start Redis
redis-server.exe master.conf
redis-server.exe slave.conf
6. Write to master and read from slave:
2. Copy redis.windos.conf to master.conf and slave.conf.
3. master.conf
port: 6379
4. slave.conf
port: 6378
slaveof 127.0.0.1 6379
5. Start Redis
redis-server.exe master.conf
redis-server.exe slave.conf
6. Write to master and read from slave:
-
public class RedisTest {
-
public static void main(String[] args) {
-
Jedis master = new Jedis("127.0.0.1", 6379);
-
Jedis slave = new Jedis("127.0.0.1", 6378);
-
-
master.set("name", "test");
-
-
System.out.println(master.get("name"));
-
System.out.println(slave.get("name"));
-
-
master.close();
-
slave.close();
-
}
- }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10742815/viewspace-2135456/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL Master/Slave Master/MasterMySqlAST
- Redis核心解讀-從Master到Slave的ReplicantionRedisAST
- MySQL master/slaveMySqlAST
- MySql的Master/SlaveMySqlAST
- mysql master和slave配置MySqlAST
- mysql slave 轉為 masterMySqlAST
- MySQL 5.5 Master/Slave 配置MySqlAST
- mysql master slave 主從同步MySqlAST主從同步
- mysql 同步 master-slave薦MySqlAST
- Mysql Slave群切換MasterMySqlAST
- Mysql Slave群切換Master (=)MySqlAST
- Mongodb的master-slave模式與master-master模式實驗MongoDBAST模式
- 實屬無奈!Redis 作者被迫修改 master-slave 架構的描述RedisAST架構
- Jenkins : 安裝 master 和 slaveJenkinsAST
- 用mysqldump --master-data 建立slaveMySqlAST
- slave之Seconds_Behind_Master析AST
- mysql建立master/slave詳細步驟MySqlAST
- 利用mysql slave 修復master MyISAM tableMySqlAST
- Redis for linux原始碼&叢集(cluster)&主從(master-slave)&哨兵(sentinel)安裝配置RedisLinux原始碼AST
- Setup MariaDB Master/Slave Replication for Docker MariaDBASTDocker
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- MySQL master and slave have equal MySQL server UUIDsMySqlASTServerUI
- MySQL錯誤之mysql.slave_master_infoMySqlAST
- MYSQL的master/slave資料同步配置(轉)MySqlAST
- The slave I/O thread stops because master and slave have equal MySQL server UUIDthreadASTMySqlServerUI
- 資料庫讀寫分離Master-Slave資料庫AST
- Mysql Master-slave複製簡單配置記錄MySqlAST
- RESET MASTER和RESET SLAVE使用場景和說明AST
- replace into 導致MASTER/SLAVE的auto_increment值不同ASTREM
- Slave: received 0 length packet from server, apparent master shutdownServerAPPAST
- mysql master-slave複製錯誤[解決事例]MySqlAST
- MYSQL5的master slave資料同步配置(轉)MySqlAST
- 分散式資料中的坑(一)Master-Slave架構分散式AST架構
- mysql slave 跟進 master 的關鍵狀態指標MySqlAST指標
- Mysqldump實現mysql的master-slave主從複製MySqlAST
- master and slave have equal MySQL server UUIDs問題解決ASTMySqlServerUI
- MySQL 5.5.x 配置Master-Slave主從複製MySqlAST
- Linux官網被黑, Redis 被要求修改 “master-slave”幕後:政治正確會毀了技術嗎?LinuxRedisAST