Synchronization between two heterogeneous databases
blog·@spiritabsolute·
0.000 HBDSynchronization between two heterogeneous databases
 Hello everybody! I decided to write about what I'm was doing. As you know, I work as a web developer and now I continue to develop in this direction. Recently, for educational purposes, I opened my resume and received a test task from one of the employers. In this post I will tell you about this task and how I completed it. It was necessary to develop a system that synchronizes data between two heterogeneous databases. The synchronization is performed on demand and can occur from both applications. The ability to add, update and delete items should also be in done. By condition, it was necessary to use the sqlite and php database. It is desirable that the application be console. Honestly, I did not even know at first what heterogeneous databases were! : D I took the task as a challenge and this allowed me to find the necessary information. I understand the basic principles of object-oriented programming and follow them to combat complexity. I think this is the main thing that allowed me to solve the task. Plus, earlier I already had experience working with the Docker, otherwise I simply would not physically did not have time to complete the work in a week. The databases schema looks like this:  I found two theoretical materials describing the algorithm of how this can be implemented, which made me worried because it seemed too complicated. But from them I understood two important things. Firstly, I will need a unique key for storage, because the primary keys may differ. Secondly, I need the ability to create queues with a reliable system for sending data to another database. I also found some articles that were useful to me. But in fact, I had half a hundred open tabs in the browser. Thanks to the Vivaldi browser for grouping the tabs. In addition to everything else, I had to try to complete tasks at my main job and devote time to my family! In general, it was hard, but interesting! ;) As a result of familiarizing myself with all the materials that I managed to find and brainstorming, I realized that I needed to use rabbitmq and in general I began to better understand how to solve the problem! Thanks to all the people who share information and write articles! Thanks to them, we have the opportunity to develop and progress! In this post I will not describe in detail the whole process. If you are interested or something is not clear, then feel free to ask questions in the comments. It turned out two console applications using the same source code, but with different databases, different configurations and some differences in business logic. Applications are launched using "Docker" in two different containers and exchange data with each other using "rabbitmq". You can see and try it here: https://github.com/spiritabsolute/database-synchronization-system The technology stack, libraries and recommendations that I used: - Php (https://www.php.net/) - Psr (https://www.php-fig.org/psr/) - Composer (https://getcomposer.org/) - Symfony components for cli (https://symfony.com/doc/current/components/console.html) - Phinx component from CakePhp for migrations (https://book.cakephp.org/phinx/0/en/intro.html) - Docker (https://www.docker.com/) - Rabbitmq (php-amqplib) (https://github.com/php-amqplib/php-amqplib) P.S. Not a lot about Hive blog. Thanks to all the people who made this hard fork possible. I am very interested to follow the further development. Let's keep getting better and create better content! Do what you love and help other people with useful information!
👍 aafeng, spiritabsolute, mehta, merlin7, raise-me-up, mproxima, golden.future, dunia, liberosist, curie, apsu, simonpeter35, irisworld, greendo, bavi, zerotoone, trevorpetrie, drags, skycae, greddyforce, blewitt, pushpedal, reghunter, kibela, modernzorker, locikll, felixrodriguez, derekvonzarovich, starbooks, sharker, vact, garudi, markmorbidity, somegaming, c3r34lk1ll3r, sankysanket18, itchyfeetdonica, zlatkamrs, ethanlee, jancharlest, rhethypo, ppss, breakout101, disagio.gang, diana.catherine, hendrikdegrote, kimzwarch, zapplwoman, upfundme, ameliabartlett, nezer, nickyhavey, marcocasario, traveler-hwi, tombstone, thecryptodrive, anwenbaumeister, hetty-rowan, bflanagin, jmkengineering, oheyo, rootdraws, anchormetals, dhimmel, sustainablyyours, derosnec, eurodale, minnowpowerup, jlsplatts, ufm.pay, jeffmackinnon, iansart, berien, schroders, tangela, mauriciozoch, makrotheblack, etka, superlotto, justtryme90, postpromoter, teach-me, randomblock1, dauerossi, arnilarn, felt.buzz, gerel, kylealex, jtm.support, thatsweeneyguy, didic, rambutan.art, hjmarseille, hijosdelhombre, epic-fail, ashikstd, edencourage, leighscotford, foreveraverage, fbslo, venalbe, hairgistix, riche-gould, zacherybinx, hanggggbeeee, extremeromance, redcube, aleestra, kork75, sixexgames, niko3d, frissonsteemit, annaabi, predict-crypto, javier.dejuan, victartex, blueorgy, gangstayid, upme, nigerian-yogagal, goblinknackers, cryptofiloz, gmedley, stayoutoftherz, teukurival, esaia.mystic, phgnomo, patris, federacion45, phogyan, outtheshellvlog, truthtrader, fernando.lubezki, iamsaray, eztechwin, uwelang, tazbaz, qberry, khan.dayyanz, nitego, brutledge, yougotavote, nutman, holbein81, florian-glechner, wisewoof, dronegraphica, lekang, srijana-gurung, palasatenea, cecilian, mulletwang, toocurious, enzor, steemjet, cakemonster, deeanndmathews, thecryptosociety, yangoldberg, mhm-philippines, beverages, tuck-fheman, howtostartablog, bibkchhetri, drmake, reizak, vicesrus, vittoriozuccala, bububoomt, cryptological, alaqrab, kenadis, jcalero, trang, bloom, gregan, gordon92, chungsu1, ilazramusic, ilovecryptopl, sadbear, cryptononymous, dacx, kendallron, orthodoxnudism, velmafia, epicdice, musicgeek, braveboat, pulleyhead, shahzain7, velourex, szokerobert, bil.prag, paragism, chickenmeat, nehomar, pechichemena, payger, takowi, movingman, musicvoter, gravii4, steemstorage, anarcist69, kalinka, debbietiyan, badpupper, filosof103, matt-a, revo, gjart, solarphasing, ph1102, juancho10, mr-critic.aaa, forester-joe, lillywilton, praditya, moksamol, infamousit, deathlyhorror, kantos, mastersa, spoke, nmcdougal94, behram, hive-naija, bitrocker2020, fnux, seyiodus, steemlibs, shookriya, clweeks, thevillan, itestify, talli-art, bscrypto, lopzdaniel, fractalfrank, djennyfloro, mahdiyari, hhayweaver, neumannsalva, noloafing, operahoser, photohunt, misan, deholt, musicvoter2, driptorchpress, arnel, gotgame, lightflares, russellstockley, norwegianbikeman, gerdtrudroepke, bluemaskman, hansmast, tngflx, dokter-purnama, sireh, positiveninja, motherofalegend, call-me-howie, ratspencer, drakoscliff, prostosun, minnowbooster, lordjames, honeycup-waters, rem-steem, newtrailers, steveconnor, mininthecity, cheese4ead, xyz001, psygambler, battebilly, stahlberg, iamjadeline, soufianechakrouf, eliasseth, begood2me, hyperbatata, bernardino, netzisde, reverseacid, travisung, loudutim, sportscontest, rachaeldwatson, chris4210, tomatom, c0wtschpotato, double-negative, joshmania, the.success.club, roguewriter, stickchumpion, utube, elsll, minimining, themonkeyzuelans, marcuz, hardaeborla, thepeakstudio, getrichordie, steemvault, foxyspirit, misia1979, niouton, roamingsparrow, dashfit, torico, ambitiouslife, miroslavrc, nashvegas, citizensmith, tommyl33, steemegg, aboutyourbiz, carn, flyerchen, arnaldoropeza, juliantabaresph, waltermeth, mxzn, allcapsonezero, dechastre, steemitbingo, hadley4, myfreebtc, freetissues, thelordsharvest, onemedia, healthexpert, dcinside, yourtop3, smalltall, kimjaguar, majes.tytyty, robibasa, sanderjansenart, enthef, loliver, hashzone91, ibt-survival, reggaesteem, guchtere, justinparke, bluefinstudios, titan-c, drlobes, dnflsms, forykw, rival, pladozero, lextenebris, lightcaptured, daniel.dalo, yehey, giuato, olusolaemmanuel, smacommunity, paradigmprospect, filipino, shares, pesos, peaceandwar, thescubageek, geadriana, qwoyn, fatkat, danile666, prapanth, dearw, macoolette, alvin0617, binkyprod, buttcoins, reconstitution, danaedwards, gracelbm, hive.consultant, shinedojo, vegan.niinja, knightbjj, deadcountry, monkaydee293, deepsouthpiddlin, mammasitta, marcoriccardi, bennettitalia, vaultec, ivna, steem.consultant, massivevibration, mendoza, eric-boucher, stevenwood, stevejhuggett, hhtb, supriya1993, nicole-st, esthersanchez, careassaktart, andylein, alinabarbu, proxy-pal, steemed-proxy, williams-owb, cordeta, drawmeaship, flatman, djlethalskillz, oghie, kitalee, fabrik, lk666, ninyea, xanderslee, ivan-g, wishmaiden, ai1love, jonmagnusson, maxwell95, dream.trip, cyprianj, yajirang, jagged, smjn, sonofsatoshi, cpufronz, zhenek,