0

I need to have one "General login database", with few columns (ID, Pass, User, IP). Users came to site, enter their data (they can chage password\username, and they ip can be changed), all this changes goes to "General Login DB".

And i have 2 another servers, with same database "Login Database 1" "Log.DB 2" and maybe few more (5 or 10)... they have exactly same columns name (id, pass, user,ip) and few more speciefic wich must stay only on (log.db2, 3, 4, 5 etc database) and they dont exist on General DB.

So my questions is how to Link few database.table to another database.table, and keep it "Up-To-Date" online, or how to make automatic changes (Insert\Update\Delete) in them, after changes (ins, upd, del) came to General Login DB.

Image only show direction that i want, and not perfect with structure. I am interested in 2 variants, if it works on One server, and second variant, if it works on 2-3-4-5 servers.

UPDATE: i found some info, about "Replication" https://habrahabr.ru/post/56702/ (you can translate it, or google "Replication mysql" but there only info about 2 identical Database, but my goal is only make identical few columns in one table.

Pic.1

Amaroc
  • 179
  • 1
  • 2
  • 9

1 Answers1

0

Do can arrived this with the Standard Replication from MySQL / MariaDB. There you can select wich tables / Schemas are replicated to the slaves. Any Slave connected to the Master.

see: https://mariadb.com/kb/en/mariadb/standard-replication/

Bernd Buffen
  • 14,525
  • 2
  • 24
  • 39
  • Thank you, you write this comment in one time with me (i update my post) where add info that i found some info about replication, but as i ask, i need to "replicate"\sync only few columns in one table (id, pass) but another columns on another (slaves) database can by uniquie (have another name, quanity of columns, data in them etc.) I also found that is no option to "ignore columns when you make replications" https://forums.mysql.com/read.php?26,621252,621452#msg-621452 – Amaroc Mar 24 '17 at 07:12
  • No, Structure must be the same, but i am not sure if you can create a VIEW on the Master with only the fields to replicate. Or you must create some TRIGGERs on the Master to INSERT/UPDATE/DELETE to store the Infos in a second table. this table then you can replicate – Bernd Buffen Mar 24 '17 at 07:16
  • On Master, i have only 2-3 columns, on slave from 15 to 18 columns (where only id \ pass \ ip (for example) must be identical to Master and have same name of columns. I didnt work before with Triggers, but as i understand they do something on event, but how here it can help (only if it exist on one server with same database)? – Amaroc Mar 24 '17 at 07:22
  • 1
    Ok, 1) you build a new table on the Master which filled from triggers, if you dont want to replicate all fields . 2) Replicate the small or original table to the slaves in a separate table. 3) create triggers on the slave that copys the data from the transfered table into your usertable on the slave. If you want you can call me next 30 Minute, but me english is not the best – Bernd Buffen Mar 24 '17 at 07:29
  • My english not perfect too, i think better talk about it here, for another people in future. I think i understand idea, but for me triggers on Masters dont need. As i see it: [ServerMaster]->[DB]->[LoginTable2-3columns]->replicate->[Server2Slave]-[DB]->[LoginTable2-3columns]->*Trigers->[LoginTable16columns] Huh :) Thanks looks like "dog nail" but as i understand better and easier then "The FEDERATED Storage Engine". – Amaroc Mar 24 '17 at 07:39
  • do not use FEDERATED. its nothing for Production !! every access on the slave will generate a read on the master. so the master must 100% on. It also not the fasted – Bernd Buffen Mar 24 '17 at 07:42
  • but you can generate a VIEW on the slave to mix the columns from the replicated table + the fields from [LoginTa‌​ble16columns] to a complete Table – Bernd Buffen Mar 24 '17 at 07:44