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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Setup MariaDB Master/Slave Replication for Docker MariaDBASTDocker
- 實屬無奈!Redis 作者被迫修改 master-slave 架構的描述RedisAST架構
- The slave I/O thread stops because master and slave have equal MySQL server UUIDthreadASTMySqlServerUI
- Redis for linux原始碼&叢集(cluster)&主從(master-slave)&哨兵(sentinel)安裝配置RedisLinux原始碼AST
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- 資料庫讀寫分離Master-Slave資料庫AST
- Mysql Master-slave複製簡單配置記錄MySqlAST
- MySQL報錯Slave: received end packet from server, apparent master shutdownMySqlServerAPPAST
- 分散式資料中的坑(一)Master-Slave架構分散式AST架構
- Mysqldump實現mysql的master-slave主從複製MySqlAST
- mysql slave 跟進 master 的關鍵狀態指標MySqlAST指標
- 使用etcd選舉sdk實踐master/slave故障轉移AST
- Linux官網被黑, Redis 被要求修改 “master-slave”幕後:政治正確會毀了技術嗎?LinuxRedisAST
- 故障案例:主從同步報錯Fatal error: The slave I/O thread stops because master and slave have equal MySQL server主從同步ErrorthreadASTMySqlServer
- Innobackupex實現mysql線上搭建master-slave主從複製MySqlAST
- 基於Kubernetes構建企業Jenkins master/slave CI/CD平臺JenkinsAST
- MySQ 資料庫主從同步安裝與配置詳解(Master/Slave)資料庫主從同步AST
- 手把手教你寫一個自己的 master-slave 架構的 TCP 伺服器AST架構TCP伺服器
- CentOS中MySQL5.6 資料庫主從(Master/Slave)同步安裝與配置詳解CentOSMySql資料庫AST
- jenkins slave節點上的job構建記錄 都只會在master伺服器JenkinsAST伺服器
- redis的repl-ping-slave-period和repl-ping-replica-periodRedis
- 1.MongoDB 2.7主從複製(master –> slave)環境基於時間點的恢復MongoDBAST
- redis cluster叢集死一個master剩下的master節點還能提供服務嗎RedisAST
- ! [rejected] master -> master (fetch first)AST
- MySQL複製跳過錯誤--slave_skip_errors、sql_slave_skip_counter、slave_exec_modeMySqlError
- jenkins 動態 slaveJenkins
- slave-skip-errorsError
- sql_slave_skip_counterSQL
- kubernetes跑jenkins動態slaveJenkins
- git merge origin master git merge origin/master區別GitAST
- Redis學習 主從複製(master-replica)架構介紹及實現RedisAST架構
- git rebase masterGitAST
- 1248:Dungeon MasterAST
- Scrum Master JobGPTScrumASTGPT
- MySQL5.7 Master-Master主主搭建for Centos7MySqlASTCentOS
- Master-Worker模式AST模式
- Master-Worker 模式AST模式
- 2 新增standby masterAST
- DocumentDB 報錯“not master”AST