redis集群 - redis主从配置目的是什么
迷茫
迷茫 2017-04-24 09:12:23
0
1
605

如题,现在在学习redis,看到了主从配置这一块。然后看到某些做法是配置slave为只读,然后master关闭了rdb。上网看了一下redis主从配置 说是可以使数据库读写分离,减轻数据库压力。我想问一下,除了从服务器不能写之外,哪个地方体现了 读与写分离。我的疑惑是,是否数据库的读写分离需要程序支持才可以?(读的时候将数据源指向slave,写的时候指向master)。如果程序不这样做,那么主从配置是否就没了意义了呢?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
小葫芦

(Data layer) read and write separation is transparent to the upper layer (logic layer) which is normal logic. Otherwise there will be coupling. I can’t always use my data service

Change the port and follow the code on the business end.

General read-write separation occurs in the form of middleware or plug-ins, which is transparent to the business logic layer (it also thinks that there is only one
data service in the background, like a reverse proxy), redis has this form. The master determines which one is reading and which one is writing to uniformly schedule the nodes of the cluster. MySQL's read-write separation or master-slave are all accomplished through plug-ins.

Remember that the separation of reading and writing cannot be reflected in the code of the logic layer (reading operations use the connection of the A service, and writing operations use the connection of the B server).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template