database-replication

PK Violation after transactional replication

老子叫甜甜 提交于 2020-02-06 04:52:08
问题 I have an application set up with transactional replication being pushed to a standby machine that will be used for emergency failovers. The replication appears to be working, any inserts made to Server 1 will automatically appear at Server 2. However, I can't quite get the failover working. In the scenario that Server 1 becomes unavailable (which is the only scenario where Server 2 will ever be used, so the replication is one-way), the idea is that work should continue at Server 2, and that

What's the best way to ensure referential integrity on a replicated database?

此生再无相见时 提交于 2020-01-15 11:51:51
问题 Using SQL SERVER 2005, I have a couple of questions on Replication and referential integrity. 1) Does Replication handle referential integrity? 2) If I do an Insert to Parent table and then to Insert to Child table, in one transaction, on Source DB - will Replicated DB also behave in the same manner? I.e. In Replicated DB record must be present in Master table, before it is referenced in child table? Thanks 回答1: Assuming replication is transactional and you have referential integrity on your

MySQL: Writing to slave node

拟墨画扇 提交于 2020-01-13 09:06:11
问题 Lets say I have a datbase of Cars. I have Makes and Models (FK to Makes). I plan on having users track their cars. each Car has a FK to Model. Now, I have a lot of users, and I want to split up my database to distribute load. The Makes and Models tables don't change so much, but they need to be shared across shards. My thought is to use MySQL replication from a master DB of makes and models to each slave database. My question is: Can I safely write to the slave databases assuming I don't

mariadb, is this kind of increment offset reaction consider normal?

人走茶凉 提交于 2020-01-06 05:57:11
问题 I posted a similar question a bit earlier but I was a bit confused because of the settings already set and by reading this http://mariadb.org/auto-increments-in-galera/ I totally understand and corrected the settings but from what I read the output of the auto increment id will be like both nodes are increment of 2 node 1 with offset 1 1,3,5,7 node 2 with offset 2 2,4,6,8 but when I create new rows...this happens create with node 1, node 1, node 2 would give me 1,3,4 it wouldn't give me 2

How do I keep two article tables synced, but keep stock separate

只谈情不闲聊 提交于 2020-01-05 15:50:07
问题 This is probably a more conceptual problem, but I couldn't find an easy solution. Scenario: Two shops (say 'M' and 'S']. M is the master and determines the articles in the databases. Each maintains an independent stock. I have M's article table replicating to S, and I separated stock into a separate table with a common reference. Now when new articles are added in M, they arrive at S too, but they won't have an entry in S's stock table. Similar problem with delete articles. Possible solutions

mysql failover: how to choose slave as new master?

跟風遠走 提交于 2020-01-03 13:33:06
问题 I'm mysql newbie. when it comes to fail-over, which slave should be promoted to the new master? For example, A is master, B and C are slaves, and A does async replication to B and C. At some point of time, B receives more data from A than C, A crashes. If we promote C to new master, and changes B's master to C, then what happens to B? It truncates its data to match C? Obviously, B is the best new master candidate, but my question is, how to determine this fact? 回答1: From the MySQL

Replicate a single Redis database from an instance that has multiple databases

六眼飞鱼酱① 提交于 2020-01-02 05:48:20
问题 I have one Redis instance that has two databases. Now I want to set up a second instance and replicate the first instance, but the second instance should only have one database and replicate only db 0 from the first instance. When I try to do it (set slaveof ... for the second instance) I get the following error message in the Redis log file: FATAL: Data file was created with a Redis server configured to handle more than 1 databases. Exiting I tried using redis-dump but I get an error when I

Replicate a single Redis database from an instance that has multiple databases

会有一股神秘感。 提交于 2020-01-02 05:48:06
问题 I have one Redis instance that has two databases. Now I want to set up a second instance and replicate the first instance, but the second instance should only have one database and replicate only db 0 from the first instance. When I try to do it (set slaveof ... for the second instance) I get the following error message in the Redis log file: FATAL: Data file was created with a Redis server configured to handle more than 1 databases. Exiting I tried using redis-dump but I get an error when I

cassandra sharding and replication

懵懂的女人 提交于 2020-01-02 05:41:11
问题 I am new to Cassandra was going though this Article explaining sharding and replication and I am stuck at a point that is - I have a cluster with 6 Cassandra nodes configured at my local machine. I create a new keyspace "TestKeySpace" with replication factor as 6 and a table in keyspace "employee" and primary key is auto-increment-number named RID. I am not able to understand how this data will be partitioned and replicated. What I want to know is since I am keeping my replication factor to

how to convert a read only hibernate session to write during a transaction (Master/Slave DB)

冷暖自知 提交于 2019-12-25 08:21:24
问题 Working with MySql replication with spring+hibernate, I have a quick question; The transactions that are opened are in read-only mode i.e pointing to slave DB. What is the best way to convert it to write mode if I want to save/update/delete any thing during that transaction? I do not want to open a write mode transaction as most of the time I want read stuff. Do I need to overide the replication Driver/Hibernate template for this thing? 回答1: We open transactions in read only mode and then